From e3b08a5c4a7b4a4d8197de95a37a220302bb1f45 Mon Sep 17 00:00:00 2001 From: peiwenqin Date: Thu, 17 Dec 2020 10:46:52 +0800 Subject: [PATCH] add logger content can copy; history logger can clearl; --- lib/src/ansi_parser.dart | 18 ++++++++++++------ lib/src/log_console.dart | 10 ++++++++++ pubspec.yaml | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/src/ansi_parser.dart b/lib/src/ansi_parser.dart index 98104d3..8552b16 100644 --- a/lib/src/ansi_parser.dart +++ b/lib/src/ansi_parser.dart @@ -1,4 +1,6 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class AnsiParser { static const TEXT = 0, BRACKET = 1, CODE = 2; @@ -116,11 +118,15 @@ class AnsiParser { TextSpan createSpan(String text) { return TextSpan( - text: text, - style: TextStyle( - color: foreground, - backgroundColor: background, - ), - ); + text: text, + style: TextStyle( + color: foreground, + backgroundColor: background, + ), + recognizer: LongPressGestureRecognizer() + ..onLongPress = () { + Clipboard.setData(ClipboardData(text: text)); + // Toast.toast("Copy to paste board"); + }); } } diff --git a/lib/src/log_console.dart b/lib/src/log_console.dart index fdf5b77..b97090a 100644 --- a/lib/src/log_console.dart +++ b/lib/src/log_console.dart @@ -195,6 +195,16 @@ class _LogConsoleState extends State { ), ), Spacer(), + IconButton( + icon: Icon(Icons.cancel), + onPressed: () { + setState(() { + //Clear historical data in order to find the target data + _outputEventBuffer.clear(); + _filteredBuffer.clear(); + }); + }, + ), IconButton( icon: Icon(Icons.add), onPressed: () { diff --git a/pubspec.yaml b/pubspec.yaml index f0026e5..0e2549e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,5 +11,5 @@ dependencies: flutter: sdk: flutter - logger: ">=0.7.0" + logger: ^0.7.0 sensors: ^0.4.0+1 \ No newline at end of file