From 4c3b02bdb04e4a9bda74ceecbbb040f9ec2b5b26 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/utils/ansi_parser.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/src/utils/ansi_parser.dart b/lib/src/utils/ansi_parser.dart index 7e4bfb6..bac028d 100644 --- a/lib/src/utils/ansi_parser.dart +++ b/lib/src/utils/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; @@ -117,11 +119,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"); + }); } }