Skip to content

Commit

Permalink
Improve logcat performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernthedev committed Dec 3, 2023
1 parent 17d88a4 commit 5f50fe4
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions lib/pages/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,7 @@ class _LogPageState extends State<LogPage> {
padding: const EdgeInsets.all(8.0),
child: Visibility(
visible: showLogs,
replacement: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: CircularProgressIndicator(),
),
Text("Reading from logcat")
],
),
),
replacement: _loadingSpinner(),
child: Container(
color: Theme.of(context).colorScheme.background,
child: buildList(),
Expand All @@ -137,6 +126,21 @@ class _LogPageState extends State<LogPage> {
);
}

Widget _loadingSpinner() {
return const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: CircularProgressIndicator(),
),
Text("Reading from logcat")
],
),
);
}

Future<AlertDialog?> _showError(String error) {
return showDialog<AlertDialog>(
context: context,
Expand Down Expand Up @@ -166,6 +170,8 @@ class _LogPageState extends State<LogPage> {
key: ValueKey(index),
)),
itemCount: logs.length,
findChildIndexCallback: (key) => (key as ValueKey).value,
prototypeItem: const SelectableText(""),
);
}

Expand Down

0 comments on commit 5f50fe4

Please sign in to comment.