Skip to content

Commit

Permalink
feat: optimize log viewer with chunked loading and auto-scroll
Browse files Browse the repository at this point in the history
- Implement chunked loading for large log files
- Add auto-scroll toggle with immediate scroll to bottom
  • Loading branch information
3003h committed Jan 20, 2025
1 parent e7e8f1e commit f426398
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 81 deletions.
5 changes: 5 additions & 0 deletions lib/common/controller/log_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const _kSuffix = '.log';
class LogService extends GetxController {
final logFiles = <File>[].obs;

// 添加自动滚动控制
final _autoScroll = true.obs;
bool get autoScroll => _autoScroll.value;
set autoScroll(bool val) => _autoScroll.value = val;

final _curFileName = 'eh.log'.obs;
String get curFileName => _curFileName.value;
set curFileName(String val) => _curFileName.value = val;
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
_listener.dispose();
super.dispose();
}

Expand Down
Loading

0 comments on commit f426398

Please sign in to comment.