Add clear button to logs
This commit is contained in:
parent
a2e70f7dff
commit
b3718932e1
@ -458,32 +458,54 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
);
|
||||
|
||||
final actionButtonLogs = FloatingActionButton(
|
||||
onPressed: () {
|
||||
// Copy the logs to the clipboard
|
||||
final error = widget.errorNotifier.value;
|
||||
if (error != null) {
|
||||
SystemChannels.platform.invokeMethod<void>(
|
||||
'Clipboard.setData',
|
||||
<String, dynamic>{'text': error},
|
||||
);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Logs copied to clipboard."),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("No logs to copy."),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
tooltip: 'Copy Logs',
|
||||
child: const Icon(Icons.copy),
|
||||
final actionButtonLogs = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 30),
|
||||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
// Clear the logs
|
||||
widget.errorNotifier.value = null;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Logs cleared."),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
},
|
||||
tooltip: 'Clear Logs',
|
||||
child: const Icon(Icons.delete),
|
||||
),
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
// Copy the logs to the clipboard
|
||||
final error = widget.errorNotifier.value;
|
||||
if (error != null) {
|
||||
SystemChannels.platform.invokeMethod<void>(
|
||||
'Clipboard.setData',
|
||||
<String, dynamic>{'text': error},
|
||||
);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Logs copied to clipboard."),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("No logs to copy."),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
tooltip: 'Copy Logs',
|
||||
child: const Icon(Icons.copy),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
final actionButtonInfo = FloatingActionButton(
|
||||
|
Loading…
x
Reference in New Issue
Block a user