Make logs copyable
This commit is contained in:
parent
99abd7a571
commit
a2e70f7dff
@ -459,6 +459,33 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final actionButtonLogs = FloatingActionButton(
|
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 actionButtonInfo = FloatingActionButton(
|
final actionButtonInfo = FloatingActionButton(
|
||||||
onPressed: () => obtainKeyPair(regenerate: true),
|
onPressed: () => obtainKeyPair(regenerate: true),
|
||||||
tooltip: 'Regenerate Key',
|
tooltip: 'Regenerate Key',
|
||||||
@ -479,7 +506,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
} else if (navIndex == 2) {
|
} else if (navIndex == 2) {
|
||||||
// Logs page
|
// Logs page
|
||||||
bodyComponent = bodyComponentLogs;
|
bodyComponent = bodyComponentLogs;
|
||||||
actionButton = null;
|
actionButton = actionButtonLogs;
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Unknown navIndex: $navIndex');
|
throw Exception('Unknown navIndex: $navIndex');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user