diff --git a/external/keyring-manager b/external/keyring-manager index b127b2d3..c153eb30 160000 --- a/external/keyring-manager +++ b/external/keyring-manager @@ -1 +1 @@ -Subproject commit b127b2d3c653fea163a776dd58b3798f28aeeee3 +Subproject commit c153eb3015d6d118e5d467865510d053ddd84533 diff --git a/veilid-flutter/example/lib/app.dart b/veilid-flutter/example/lib/app.dart index 84e03d8f..041d427a 100644 --- a/veilid-flutter/example/lib/app.dart +++ b/veilid-flutter/example/lib/app.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:veilid/veilid.dart'; import 'package:loggy/loggy.dart'; +import 'package:veilid_example/veilid_theme.dart'; import 'log_terminal.dart'; import 'config.dart'; @@ -18,6 +19,7 @@ class MyApp extends StatefulWidget { class _MyAppState extends State with UiLoggy { String _veilidVersion = 'Unknown'; + bool _startedUp = false; Stream? _updateStream; Future? _updateProcessor; @@ -102,11 +104,31 @@ class _MyAppState extends State with UiLoggy { } } + Future toggleStartup(bool startup) async { + if (startup && !_startedUp) { + var updateStream = await Veilid.instance + .startupVeilidCore(await getDefaultVeilidConfig()); + setState(() { + _updateStream = updateStream; + _updateProcessor = processUpdates(); + _startedUp = true; + }); + await Veilid.instance.attach(); + } else if (!startup && _startedUp) { + await Veilid.instance.shutdownVeilidCore(); + if (_updateProcessor != null) { + await _updateProcessor; + } + setState(() { + _updateProcessor = null; + _updateStream = null; + _startedUp = false; + }); + } + } + @override Widget build(BuildContext context) { - final ButtonStyle buttonStyle = - ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20)); - return Scaffold( appBar: AppBar( title: Text('Veilid Plugin Version $_veilidVersion'), @@ -114,73 +136,53 @@ class _MyAppState extends State with UiLoggy { body: Column(children: [ const Expanded(child: LogTerminal()), Container( - padding: const EdgeInsets.fromLTRB(8, 8, 8, 12), - child: Row(children: [ - ElevatedButton( - style: buttonStyle, - onPressed: _updateStream != null - ? null - : () async { - var updateStream = await Veilid.instance - .startupVeilidCore( - await getDefaultVeilidConfig()); - setState(() { - _updateStream = updateStream; - _updateProcessor = processUpdates(); - }); - await Veilid.instance.attach(); - }, - child: const Text('Startup'), - ), - ElevatedButton( - style: buttonStyle, - onPressed: _updateStream == null - ? null - : () async { - await Veilid.instance.shutdownVeilidCore(); - if (_updateProcessor != null) { - await _updateProcessor; - } - setState(() { - _updateProcessor = null; - _updateStream = null; - }); - }, - child: const Text('Shutdown'), - ), - ])), - Row(children: [ - Expanded( - child: TextField( - decoration: const InputDecoration( - border: OutlineInputBorder(), - labelText: 'Debug Command'), - textInputAction: TextInputAction.send, - onSubmitted: (String v) async { - loggy.info(await Veilid.instance.debug(v)); - })), - DropdownButton( - value: loggy.level.logLevel, - onChanged: (LogLevel? newLevel) { - setState(() { - setRootLogLevel(newLevel); - }); - }, - items: const [ - DropdownMenuItem( - value: LogLevel.error, child: Text("Error")), - DropdownMenuItem( - value: LogLevel.warning, child: Text("Warning")), - DropdownMenuItem( - value: LogLevel.info, child: Text("Info")), - DropdownMenuItem( - value: LogLevel.debug, child: Text("Debug")), - DropdownMenuItem( - value: traceLevel, child: Text("Trace")), - DropdownMenuItem( - value: LogLevel.all, child: Text("All")), - ]) - ]), + decoration: BoxDecoration(color: materialPrimaryColor, boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.15), + spreadRadius: 4, + blurRadius: 4, + ) + ]), + padding: const EdgeInsets.all(5.0), + child: Row(children: [ + Expanded( + child: pad(TextField( + decoration: + newInputDecoration('Debug Command', _startedUp), + textInputAction: TextInputAction.send, + enabled: _startedUp, + onSubmitted: (String v) async { + loggy.info(await Veilid.instance.debug(v)); + }))), + pad(const Text('Startup')), + pad(Switch( + value: _startedUp, + onChanged: (bool value) async { + await toggleStartup(value); + })), + pad(DropdownButton( + value: loggy.level.logLevel, + onChanged: (LogLevel? newLevel) { + setState(() { + setRootLogLevel(newLevel); + }); + }, + items: const [ + DropdownMenuItem( + value: LogLevel.error, child: Text("Error")), + DropdownMenuItem( + value: LogLevel.warning, child: Text("Warning")), + DropdownMenuItem( + value: LogLevel.info, child: Text("Info")), + DropdownMenuItem( + value: LogLevel.debug, child: Text("Debug")), + DropdownMenuItem( + value: traceLevel, child: Text("Trace")), + DropdownMenuItem( + value: LogLevel.all, child: Text("All")), + ])), + ]), + ), ])); } } diff --git a/veilid-flutter/example/lib/log_terminal.dart b/veilid-flutter/example/lib/log_terminal.dart index 2ba817f3..cf33c1e0 100644 --- a/veilid-flutter/example/lib/log_terminal.dart +++ b/veilid-flutter/example/lib/log_terminal.dart @@ -5,6 +5,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:xterm/xterm.dart'; import 'log.dart'; +import 'veilid_theme.dart'; + +const kDefaultTerminalStyle = TerminalStyle( + fontSize: kDefaultMonoTerminalFontSize, + height: kDefaultMonoTerminalFontHeight, + fontFamily: kDefaultMonoTerminalFontFamily); class LogTerminal extends StatefulWidget { const LogTerminal({Key? key}) : super(key: key); @@ -31,30 +37,26 @@ class _LogTerminalState extends State { @override Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.transparent, - body: SafeArea( - child: TerminalView( - terminal, - controller: terminalController, - autofocus: true, - backgroundOpacity: 0.7, - 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); - } - } - }, - ), - ), + return TerminalView( + terminal, + textStyle: kDefaultTerminalStyle, + controller: terminalController, + autofocus: true, + backgroundOpacity: 0.7, + 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); + } + } + }, ); } } diff --git a/veilid-flutter/example/lib/main.dart b/veilid-flutter/example/lib/main.dart index 66e8ecdf..b93e91bd 100644 --- a/veilid-flutter/example/lib/main.dart +++ b/veilid-flutter/example/lib/main.dart @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:veilid/veilid.dart'; import 'package:flutter_acrylic/flutter_acrylic.dart'; -import 'veilid_color.dart'; +import 'veilid_theme.dart'; import 'log.dart'; import 'app.dart'; import 'veilid_init.dart'; diff --git a/veilid-flutter/example/lib/veilid_color.dart b/veilid-flutter/example/lib/veilid_theme.dart similarity index 80% rename from veilid-flutter/example/lib/veilid_color.dart rename to veilid-flutter/example/lib/veilid_theme.dart index a5e45d1f..ef7b5b0a 100644 --- a/veilid-flutter/example/lib/veilid_color.dart +++ b/veilid-flutter/example/lib/veilid_theme.dart @@ -9,6 +9,9 @@ import 'package:flutter/material.dart'; +///////////////////////////////////////////////////////// +// Colors + const Map primaryColorSwatch = { 50: Color(0xffe9e9f3), 100: Color(0xffc7c8e2), @@ -233,10 +236,58 @@ const Map popComplentaryColorSwatch = { const MaterialColor materialPopComplementaryColor = MaterialColor(0xff59f282, popComplentaryColorSwatch); +///////////////////////////////////////////////////////// +// Spacing + +const kDefaultSpacingFactor = 4.0; + +const kDefaultMonoTerminalFontFamily = "CascadiaMonoPL.ttf"; +const kDefaultMonoTerminalFontHeight = 1.2; +const kDefaultMonoTerminalFontSize = 12.0; + +double spacingFactor(double multiplier) { + return multiplier * kDefaultSpacingFactor; +} + +Padding pad(Widget child) { + return Padding( + padding: const EdgeInsets.all(kDefaultSpacingFactor), child: child); +} + +///////////////////////////////////////////////////////// +// Theme + +InputDecoration newInputDecoration(String labelText, bool enabled) { + return InputDecoration( + labelText: labelText, + fillColor: enabled + ? materialPrimaryColor.shade200 + : materialPrimaryColor.shade200.withOpacity(0.5)); +} + +InputDecorationTheme newInputDecorationTheme() { + return InputDecorationTheme( + border: const OutlineInputBorder(), + filled: true, + fillColor: materialPrimaryColor.shade200, + disabledBorder: const OutlineInputBorder( + borderSide: + BorderSide(color: Color.fromARGB(0, 0, 0, 0), width: 0.0)), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: materialPrimaryColor.shade900, width: 0.0)), + floatingLabelBehavior: FloatingLabelBehavior.never, + floatingLabelStyle: TextStyle( + color: materialPrimaryColor.shade900, + letterSpacing: 1.2, + )); +} + ThemeData newVeilidTheme() { return ThemeData( primarySwatch: materialPrimaryColor, secondaryHeaderColor: materialSecondaryColor, visualDensity: VisualDensity.adaptivePlatformDensity, + inputDecorationTheme: newInputDecorationTheme(), ); } diff --git a/veilid-flutter/example/linux/flutter/generated_plugins.cmake b/veilid-flutter/example/linux/flutter/generated_plugins.cmake index ec1406bc..3989c459 100644 --- a/veilid-flutter/example/linux/flutter/generated_plugins.cmake +++ b/veilid-flutter/example/linux/flutter/generated_plugins.cmake @@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST - flutter_pty ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/veilid-flutter/example/macos/Podfile.lock b/veilid-flutter/example/macos/Podfile.lock index 319eb3d2..0626573c 100644 --- a/veilid-flutter/example/macos/Podfile.lock +++ b/veilid-flutter/example/macos/Podfile.lock @@ -1,8 +1,6 @@ PODS: - flutter_acrylic (0.1.0): - FlutterMacOS - - flutter_pty (0.0.1): - - FlutterMacOS - FlutterMacOS (1.0.0) - path_provider_macos (0.0.1): - FlutterMacOS @@ -11,7 +9,6 @@ PODS: DEPENDENCIES: - flutter_acrylic (from `Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos`) - - flutter_pty (from `Flutter/ephemeral/.symlinks/plugins/flutter_pty/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) - veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`) @@ -19,8 +16,6 @@ DEPENDENCIES: EXTERNAL SOURCES: flutter_acrylic: :path: Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos - flutter_pty: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_pty/macos FlutterMacOS: :path: Flutter/ephemeral path_provider_macos: @@ -30,7 +25,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: flutter_acrylic: c3df24ae52ab6597197837ce59ef2a8542640c17 - flutter_pty: 41b6f848ade294be726a6b94cdd4a67c3bc52f59 FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 veilid: f2b3b5b3ac8cd93fc5443ab830d5153575dacf36 diff --git a/veilid-flutter/example/pubspec.lock b/veilid-flutter/example/pubspec.lock index 494f5706..74aca102 100644 --- a/veilid-flutter/example/pubspec.lock +++ b/veilid-flutter/example/pubspec.lock @@ -111,20 +111,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - flutter_loggy: - dependency: "direct main" - description: - name: flutter_loggy - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - flutter_pty: - dependency: "direct main" - description: - name: flutter_pty - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.1" flutter_test: dependency: "direct dev" description: flutter @@ -268,13 +254,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.0" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.dartlang.org" - source: hosted - version: "0.27.7" sky_engine: dependency: transitive description: flutter diff --git a/veilid-flutter/example/pubspec.yaml b/veilid-flutter/example/pubspec.yaml index 0d674e85..fee9152c 100644 --- a/veilid-flutter/example/pubspec.yaml +++ b/veilid-flutter/example/pubspec.yaml @@ -33,11 +33,9 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 loggy: ^2.0.1+1 - flutter_loggy: ^2.0.1 path_provider: ^2.0.11 path: ^1.8.1 xterm: ^3.4.0 - flutter_pty: ^0.3.1 flutter_acrylic: ^1.0.0+2 ansicolor: ^2.0.1 diff --git a/veilid-flutter/example/windows/flutter/generated_plugins.cmake b/veilid-flutter/example/windows/flutter/generated_plugins.cmake index 4ba079ee..4c215c3a 100644 --- a/veilid-flutter/example/windows/flutter/generated_plugins.cmake +++ b/veilid-flutter/example/windows/flutter/generated_plugins.cmake @@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST - flutter_pty ) set(PLUGIN_BUNDLED_LIBRARIES)