mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
Debug Screen: Add a button to copy messages to the clipboard
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
image: ios_shortcuts.png
|
||||
- text: "Custom SSH keys with passwords can now be used - #227"
|
||||
- text: "Create new note when clicking on non existing Wiki Link - #240"
|
||||
- text: "Debug Screen: Add a button to easily copy all the logs"
|
||||
bugs:
|
||||
- text: "Fix notes not always showing up - #270"
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -52,6 +55,10 @@ class _DebugScreenState extends State<DebugScreen> {
|
||||
},
|
||||
),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy),
|
||||
onPressed: _copyToClipboard,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.filter_list),
|
||||
onPressed: _showFilterSelection,
|
||||
@ -123,6 +130,16 @@ class _DebugScreenState extends State<DebugScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _copyToClipboard() async {
|
||||
var messages = <String>[];
|
||||
for (var logMsg in _logs) {
|
||||
var msg = json.encode(logMsg.toMap());
|
||||
messages.add(msg);
|
||||
}
|
||||
|
||||
Clipboard.setData(ClipboardData(text: messages.join('\n')));
|
||||
}
|
||||
|
||||
Widget _buildLogWidget(LogMessage msg) {
|
||||
var textStyle = Theme.of(context)
|
||||
.textTheme
|
||||
|
Reference in New Issue
Block a user