mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-08-09 15:12:50 -04:00
update ndk and gradle versions
add subpackage to veilid-flutter with test fixtures for writing veilid integration tests in dart
This commit is contained in:
parent
bcacaeb300
commit
bcee358a0e
20 changed files with 305 additions and 80 deletions
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:veilid/veilid.dart';
|
||||
import 'package:loggy/loggy.dart';
|
||||
import 'package:ansicolor/ansicolor.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loggy/loggy.dart';
|
||||
import 'package:veilid/veilid.dart';
|
||||
|
||||
// Loggy tools
|
||||
const LogLevel traceLevel = LogLevel('Trace', 1);
|
||||
|
@ -86,24 +86,23 @@ class CallbackPrinter extends LoggyPrinter {
|
|||
callback?.call(record);
|
||||
}
|
||||
|
||||
void setCallback(Function(LogRecord)? cb) {
|
||||
// ignore: use_setters_to_change_properties
|
||||
void setCallback(void Function(LogRecord)? cb) {
|
||||
callback = cb;
|
||||
}
|
||||
}
|
||||
|
||||
var globalTerminalPrinter = CallbackPrinter();
|
||||
CallbackPrinter globalTerminalPrinter = CallbackPrinter();
|
||||
|
||||
extension TraceLoggy on Loggy {
|
||||
void trace(dynamic message, [Object? error, StackTrace? stackTrace]) =>
|
||||
log(traceLevel, message, error, stackTrace);
|
||||
}
|
||||
|
||||
LogOptions getLogOptions(LogLevel? level) {
|
||||
return LogOptions(
|
||||
level ?? LogLevel.all,
|
||||
stackTraceLevel: LogLevel.error,
|
||||
);
|
||||
}
|
||||
LogOptions getLogOptions(LogLevel? level) => LogOptions(
|
||||
level ?? LogLevel.all,
|
||||
stackTraceLevel: LogLevel.error,
|
||||
);
|
||||
|
||||
void initLoggy() {
|
||||
Loggy.initLoggy(
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'veilid_theme.dart';
|
|||
|
||||
const kDefaultTerminalStyle = TerminalStyle(
|
||||
fontSize: kDefaultMonoTerminalFontSize,
|
||||
height: kDefaultMonoTerminalFontHeight,
|
||||
fontFamily: kDefaultMonoTerminalFontFamily);
|
||||
|
||||
class LogTerminal extends StatefulWidget {
|
||||
|
@ -14,7 +13,7 @@ class LogTerminal extends StatefulWidget {
|
|||
|
||||
@override
|
||||
// ignore: library_private_types_in_public_api
|
||||
_LogTerminalState createState() => _LogTerminalState();
|
||||
State<LogTerminal> createState() => _LogTerminalState();
|
||||
}
|
||||
|
||||
class _LogTerminalState extends State<LogTerminal> {
|
||||
|
@ -28,32 +27,31 @@ class _LogTerminalState extends State<LogTerminal> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
terminal.setLineFeedMode(true);
|
||||
globalTerminalPrinter
|
||||
.setCallback((log) => {terminal.write("${log.pretty()}\n")});
|
||||
globalTerminalPrinter.setCallback((log) {
|
||||
terminal.write('${log.pretty()}\n');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TerminalView(
|
||||
terminal,
|
||||
textStyle: kDefaultTerminalStyle,
|
||||
controller: terminalController,
|
||||
autofocus: true,
|
||||
backgroundOpacity: 0.9,
|
||||
onSecondaryTapDown: (details, offset) async {
|
||||
final selection = terminalController.selection;
|
||||
if (selection != null) {
|
||||
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);
|
||||
Widget build(BuildContext context) => TerminalView(
|
||||
terminal,
|
||||
textStyle: kDefaultTerminalStyle,
|
||||
controller: terminalController,
|
||||
autofocus: true,
|
||||
backgroundOpacity: 0.9,
|
||||
onSecondaryTapDown: (details, offset) async {
|
||||
final selection = terminalController.selection;
|
||||
if (selection != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue