Skip to content

Commit

Permalink
formated
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr Oliinyk committed Jan 6, 2023
1 parent ffe9402 commit c15e8cb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lib/src/shake/default_shake_detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class DefaultShakeDetector implements ShakeDetector {
.map((lastShakeTimestamp) {
var now = DateTime.now().millisecondsSinceEpoch;

_shakeCount = lastShakeTimestamp + shakeCountResetTime < now ? 0 : _shakeCount + 1;
_shakeCount = lastShakeTimestamp + shakeCountResetTime < now
? 0
: _shakeCount + 1;
_lastShakeTimestamp = now;

return _shakeCount;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/theme/log_console_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class LogConsoleTheme {
ThemeData theme,
) =>
LogConsoleTheme._(
bottomAppBarColor: theme.bottomAppBarTheme.color ?? theme.bottomAppBarColor,
bottomAppBarColor:
theme.bottomAppBarTheme.color ?? theme.bottomAppBarColor,
scaffoldBackgroundColor: theme.scaffoldBackgroundColor,
bodyLarge: theme.textTheme.bodyLarge,
);
Expand Down
7 changes: 5 additions & 2 deletions lib/src/utils/log_console_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ class LogConsoleManager extends ChangeNotifier {
String _filterText = '';

List<LogRenderedEvent> get logs => _buffer
.where((element) => _filterLevel == null ? true : element.level == _filterLevel)
.where((element) => _filterText.isEmpty ? true : element.lowerCaseText.contains(_filterText))
.where((element) =>
_filterLevel == null ? true : element.level == _filterLevel)
.where((element) => _filterText.isEmpty
? true
: element.lowerCaseText.contains(_filterText))
.toList();

void setFilterLevel(Level? level) {
Expand Down
5 changes: 2 additions & 3 deletions lib/src/widgets/log_console_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class _LogConsoleContentState extends State<LogConsoleContent> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);

return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
Expand All @@ -57,7 +55,8 @@ class _LogConsoleContentState extends State<LogConsoleContent> {
itemBuilder: (context, index) => Text.rich(
widget.logConsoleManager.logs[index].span,
key: ValueKey(widget.logConsoleManager.logs[index].id),
style: widget.theme.bodyLarge?.copyWith(fontSize: widget.logFontSize),
style:
widget.theme.bodyLarge?.copyWith(fontSize: widget.logFontSize),
),
itemCount: widget.logConsoleManager.logs.length,
),
Expand Down
6 changes: 4 additions & 2 deletions lib/src/widgets/log_console_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class _LogConsoleWidgetState extends State<LogConsoleWidget> {
Future<void> _checkScrollPosition({Duration delay = Duration.zero}) async {
await Future.delayed(delay);

final scrolledToBottom = _scrollController.offset >= _scrollController.position.maxScrollExtent;
final scrolledToBottom =
_scrollController.offset >= _scrollController.position.maxScrollExtent;

if (_followBottom != scrolledToBottom) {
setState(() {
Expand All @@ -52,7 +53,8 @@ class _LogConsoleWidgetState extends State<LogConsoleWidget> {
}
}

void _updateLogManagerCallback() => _checkScrollPosition(delay: const Duration(milliseconds: 400));
void _updateLogManagerCallback() =>
_checkScrollPosition(delay: const Duration(milliseconds: 400));

@override
void dispose() {
Expand Down

0 comments on commit c15e8cb

Please sign in to comment.