mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-06-25 23:30:50 -04:00
cleanup veilid-flutter
This commit is contained in:
parent
b948c53863
commit
439d2641f1
16 changed files with 275 additions and 291 deletions
|
@ -17,39 +17,39 @@ class LogTerminal extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _LogTerminalState extends State<LogTerminal> {
|
||||
final terminal = Terminal(
|
||||
final _terminal = Terminal(
|
||||
maxLines: 10000,
|
||||
);
|
||||
|
||||
final terminalController = TerminalController();
|
||||
final _terminalController = TerminalController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
terminal.setLineFeedMode(true);
|
||||
_terminal.setLineFeedMode(true);
|
||||
globalTerminalPrinter.setCallback((log) {
|
||||
terminal.write('${log.pretty()}\n');
|
||||
_terminal.write('${log.pretty()}\n');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => TerminalView(
|
||||
terminal,
|
||||
_terminal,
|
||||
textStyle: kDefaultTerminalStyle,
|
||||
controller: terminalController,
|
||||
controller: _terminalController,
|
||||
autofocus: true,
|
||||
backgroundOpacity: 0.9,
|
||||
onSecondaryTapDown: (details, offset) async {
|
||||
final selection = terminalController.selection;
|
||||
final selection = _terminalController.selection;
|
||||
if (selection != null) {
|
||||
final text = terminal.buffer.getText(selection);
|
||||
terminalController.clearSelection();
|
||||
final text = _terminal.buffer.getText(selection);
|
||||
_terminalController.clearSelection();
|
||||
await Clipboard.setData(ClipboardData(text: text));
|
||||
} else {
|
||||
final data = await Clipboard.getData('text/plain');
|
||||
final text = data?.text;
|
||||
if (text != null) {
|
||||
terminal.paste(text);
|
||||
_terminal.paste(text);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue