mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-01 20:43:20 +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
|
image: ios_shortcuts.png
|
||||||
- text: "Custom SSH keys with passwords can now be used - #227"
|
- text: "Custom SSH keys with passwords can now be used - #227"
|
||||||
- text: "Create new note when clicking on non existing Wiki Link - #240"
|
- 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:
|
bugs:
|
||||||
- text: "Fix notes not always showing up - #270"
|
- text: "Fix notes not always showing up - #270"
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -52,6 +55,10 @@ class _DebugScreenState extends State<DebugScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.copy),
|
||||||
|
onPressed: _copyToClipboard,
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.filter_list),
|
icon: const Icon(Icons.filter_list),
|
||||||
onPressed: _showFilterSelection,
|
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) {
|
Widget _buildLogWidget(LogMessage msg) {
|
||||||
var textStyle = Theme.of(context)
|
var textStyle = Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
|
Reference in New Issue
Block a user