diff --git a/lib/main.dart b/lib/main.dart index a6556b2..7839fbc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -459,6 +459,33 @@ class _MyHomePageState extends State { ); final actionButtonLogs = FloatingActionButton( + onPressed: () { + // Copy the logs to the clipboard + final error = widget.errorNotifier.value; + if (error != null) { + SystemChannels.platform.invokeMethod( + 'Clipboard.setData', + {'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( onPressed: () => obtainKeyPair(regenerate: true), tooltip: 'Regenerate Key', @@ -479,7 +506,7 @@ class _MyHomePageState extends State { } else if (navIndex == 2) { // Logs page bodyComponent = bodyComponentLogs; - actionButton = null; + actionButton = actionButtonLogs; } else { throw Exception('Unknown navIndex: $navIndex'); }