theming
This commit is contained in:
parent
572f0f23ed
commit
36b6e7446f
2
external/keyring-manager
vendored
2
external/keyring-manager
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b127b2d3c653fea163a776dd58b3798f28aeeee3
|
Subproject commit c153eb3015d6d118e5d467865510d053ddd84533
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:veilid/veilid.dart';
|
import 'package:veilid/veilid.dart';
|
||||||
import 'package:loggy/loggy.dart';
|
import 'package:loggy/loggy.dart';
|
||||||
|
import 'package:veilid_example/veilid_theme.dart';
|
||||||
|
|
||||||
import 'log_terminal.dart';
|
import 'log_terminal.dart';
|
||||||
import 'config.dart';
|
import 'config.dart';
|
||||||
@ -18,6 +19,7 @@ class MyApp extends StatefulWidget {
|
|||||||
|
|
||||||
class _MyAppState extends State<MyApp> with UiLoggy {
|
class _MyAppState extends State<MyApp> with UiLoggy {
|
||||||
String _veilidVersion = 'Unknown';
|
String _veilidVersion = 'Unknown';
|
||||||
|
bool _startedUp = false;
|
||||||
Stream<VeilidUpdate>? _updateStream;
|
Stream<VeilidUpdate>? _updateStream;
|
||||||
Future<void>? _updateProcessor;
|
Future<void>? _updateProcessor;
|
||||||
|
|
||||||
@ -102,11 +104,31 @@ class _MyAppState extends State<MyApp> with UiLoggy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> 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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ButtonStyle buttonStyle =
|
|
||||||
ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20));
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Veilid Plugin Version $_veilidVersion'),
|
title: Text('Veilid Plugin Version $_veilidVersion'),
|
||||||
@ -114,73 +136,53 @@ class _MyAppState extends State<MyApp> with UiLoggy {
|
|||||||
body: Column(children: [
|
body: Column(children: [
|
||||||
const Expanded(child: LogTerminal()),
|
const Expanded(child: LogTerminal()),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 8, 8, 12),
|
decoration: BoxDecoration(color: materialPrimaryColor, boxShadow: [
|
||||||
child: Row(children: [
|
BoxShadow(
|
||||||
ElevatedButton(
|
color: Colors.black.withOpacity(0.15),
|
||||||
style: buttonStyle,
|
spreadRadius: 4,
|
||||||
onPressed: _updateStream != null
|
blurRadius: 4,
|
||||||
? null
|
)
|
||||||
: () async {
|
]),
|
||||||
var updateStream = await Veilid.instance
|
padding: const EdgeInsets.all(5.0),
|
||||||
.startupVeilidCore(
|
child: Row(children: [
|
||||||
await getDefaultVeilidConfig());
|
Expanded(
|
||||||
setState(() {
|
child: pad(TextField(
|
||||||
_updateStream = updateStream;
|
decoration:
|
||||||
_updateProcessor = processUpdates();
|
newInputDecoration('Debug Command', _startedUp),
|
||||||
});
|
textInputAction: TextInputAction.send,
|
||||||
await Veilid.instance.attach();
|
enabled: _startedUp,
|
||||||
},
|
onSubmitted: (String v) async {
|
||||||
child: const Text('Startup'),
|
loggy.info(await Veilid.instance.debug(v));
|
||||||
),
|
}))),
|
||||||
ElevatedButton(
|
pad(const Text('Startup')),
|
||||||
style: buttonStyle,
|
pad(Switch(
|
||||||
onPressed: _updateStream == null
|
value: _startedUp,
|
||||||
? null
|
onChanged: (bool value) async {
|
||||||
: () async {
|
await toggleStartup(value);
|
||||||
await Veilid.instance.shutdownVeilidCore();
|
})),
|
||||||
if (_updateProcessor != null) {
|
pad(DropdownButton<LogLevel>(
|
||||||
await _updateProcessor;
|
value: loggy.level.logLevel,
|
||||||
}
|
onChanged: (LogLevel? newLevel) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_updateProcessor = null;
|
setRootLogLevel(newLevel);
|
||||||
_updateStream = null;
|
});
|
||||||
});
|
},
|
||||||
},
|
items: const [
|
||||||
child: const Text('Shutdown'),
|
DropdownMenuItem<LogLevel>(
|
||||||
),
|
value: LogLevel.error, child: Text("Error")),
|
||||||
])),
|
DropdownMenuItem<LogLevel>(
|
||||||
Row(children: [
|
value: LogLevel.warning, child: Text("Warning")),
|
||||||
Expanded(
|
DropdownMenuItem<LogLevel>(
|
||||||
child: TextField(
|
value: LogLevel.info, child: Text("Info")),
|
||||||
decoration: const InputDecoration(
|
DropdownMenuItem<LogLevel>(
|
||||||
border: OutlineInputBorder(),
|
value: LogLevel.debug, child: Text("Debug")),
|
||||||
labelText: 'Debug Command'),
|
DropdownMenuItem<LogLevel>(
|
||||||
textInputAction: TextInputAction.send,
|
value: traceLevel, child: Text("Trace")),
|
||||||
onSubmitted: (String v) async {
|
DropdownMenuItem<LogLevel>(
|
||||||
loggy.info(await Veilid.instance.debug(v));
|
value: LogLevel.all, child: Text("All")),
|
||||||
})),
|
])),
|
||||||
DropdownButton<LogLevel>(
|
]),
|
||||||
value: loggy.level.logLevel,
|
),
|
||||||
onChanged: (LogLevel? newLevel) {
|
|
||||||
setState(() {
|
|
||||||
setRootLogLevel(newLevel);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
items: const [
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: LogLevel.error, child: Text("Error")),
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: LogLevel.warning, child: Text("Warning")),
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: LogLevel.info, child: Text("Info")),
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: LogLevel.debug, child: Text("Debug")),
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: traceLevel, child: Text("Trace")),
|
|
||||||
DropdownMenuItem<LogLevel>(
|
|
||||||
value: LogLevel.all, child: Text("All")),
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:xterm/xterm.dart';
|
import 'package:xterm/xterm.dart';
|
||||||
import 'log.dart';
|
import 'log.dart';
|
||||||
|
import 'veilid_theme.dart';
|
||||||
|
|
||||||
|
const kDefaultTerminalStyle = TerminalStyle(
|
||||||
|
fontSize: kDefaultMonoTerminalFontSize,
|
||||||
|
height: kDefaultMonoTerminalFontHeight,
|
||||||
|
fontFamily: kDefaultMonoTerminalFontFamily);
|
||||||
|
|
||||||
class LogTerminal extends StatefulWidget {
|
class LogTerminal extends StatefulWidget {
|
||||||
const LogTerminal({Key? key}) : super(key: key);
|
const LogTerminal({Key? key}) : super(key: key);
|
||||||
@ -31,30 +37,26 @@ class _LogTerminalState extends State<LogTerminal> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return TerminalView(
|
||||||
backgroundColor: Colors.transparent,
|
terminal,
|
||||||
body: SafeArea(
|
textStyle: kDefaultTerminalStyle,
|
||||||
child: TerminalView(
|
controller: terminalController,
|
||||||
terminal,
|
autofocus: true,
|
||||||
controller: terminalController,
|
backgroundOpacity: 0.7,
|
||||||
autofocus: true,
|
onSecondaryTapDown: (details, offset) async {
|
||||||
backgroundOpacity: 0.7,
|
final selection = terminalController.selection;
|
||||||
onSecondaryTapDown: (details, offset) async {
|
if (selection != null) {
|
||||||
final selection = terminalController.selection;
|
final text = terminal.buffer.getText(selection);
|
||||||
if (selection != null) {
|
terminalController.clearSelection();
|
||||||
final text = terminal.buffer.getText(selection);
|
await Clipboard.setData(ClipboardData(text: text));
|
||||||
terminalController.clearSelection();
|
} else {
|
||||||
await Clipboard.setData(ClipboardData(text: text));
|
final data = await Clipboard.getData('text/plain');
|
||||||
} else {
|
final text = data?.text;
|
||||||
final data = await Clipboard.getData('text/plain');
|
if (text != null) {
|
||||||
final text = data?.text;
|
terminal.paste(text);
|
||||||
if (text != null) {
|
}
|
||||||
terminal.paste(text);
|
}
|
||||||
}
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:veilid/veilid.dart';
|
import 'package:veilid/veilid.dart';
|
||||||
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
||||||
|
|
||||||
import 'veilid_color.dart';
|
import 'veilid_theme.dart';
|
||||||
import 'log.dart';
|
import 'log.dart';
|
||||||
import 'app.dart';
|
import 'app.dart';
|
||||||
import 'veilid_init.dart';
|
import 'veilid_init.dart';
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
// Colors
|
||||||
|
|
||||||
const Map<int, Color> primaryColorSwatch = {
|
const Map<int, Color> primaryColorSwatch = {
|
||||||
50: Color(0xffe9e9f3),
|
50: Color(0xffe9e9f3),
|
||||||
100: Color(0xffc7c8e2),
|
100: Color(0xffc7c8e2),
|
||||||
@ -233,10 +236,58 @@ const Map<int, Color> popComplentaryColorSwatch = {
|
|||||||
const MaterialColor materialPopComplementaryColor =
|
const MaterialColor materialPopComplementaryColor =
|
||||||
MaterialColor(0xff59f282, popComplentaryColorSwatch);
|
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() {
|
ThemeData newVeilidTheme() {
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
primarySwatch: materialPrimaryColor,
|
primarySwatch: materialPrimaryColor,
|
||||||
secondaryHeaderColor: materialSecondaryColor,
|
secondaryHeaderColor: materialSecondaryColor,
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
|
inputDecorationTheme: newInputDecorationTheme(),
|
||||||
);
|
);
|
||||||
}
|
}
|
@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
flutter_pty
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- flutter_acrylic (0.1.0):
|
- flutter_acrylic (0.1.0):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- flutter_pty (0.0.1):
|
|
||||||
- FlutterMacOS
|
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
- path_provider_macos (0.0.1):
|
- path_provider_macos (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
@ -11,7 +9,6 @@ PODS:
|
|||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- flutter_acrylic (from `Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos`)
|
- flutter_acrylic (from `Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos`)
|
||||||
- flutter_pty (from `Flutter/ephemeral/.symlinks/plugins/flutter_pty/macos`)
|
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
||||||
- veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`)
|
- veilid (from `Flutter/ephemeral/.symlinks/plugins/veilid/macos`)
|
||||||
@ -19,8 +16,6 @@ DEPENDENCIES:
|
|||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
flutter_acrylic:
|
flutter_acrylic:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/flutter_acrylic/macos
|
||||||
flutter_pty:
|
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_pty/macos
|
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral
|
:path: Flutter/ephemeral
|
||||||
path_provider_macos:
|
path_provider_macos:
|
||||||
@ -30,7 +25,6 @@ EXTERNAL SOURCES:
|
|||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
flutter_acrylic: c3df24ae52ab6597197837ce59ef2a8542640c17
|
flutter_acrylic: c3df24ae52ab6597197837ce59ef2a8542640c17
|
||||||
flutter_pty: 41b6f848ade294be726a6b94cdd4a67c3bc52f59
|
|
||||||
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
|
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
|
||||||
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
|
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
|
||||||
veilid: f2b3b5b3ac8cd93fc5443ab830d5153575dacf36
|
veilid: f2b3b5b3ac8cd93fc5443ab830d5153575dacf36
|
||||||
|
@ -111,20 +111,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
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:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -268,13 +254,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
rxdart:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: rxdart
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.27.7"
|
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -33,11 +33,9 @@ dependencies:
|
|||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
loggy: ^2.0.1+1
|
loggy: ^2.0.1+1
|
||||||
flutter_loggy: ^2.0.1
|
|
||||||
path_provider: ^2.0.11
|
path_provider: ^2.0.11
|
||||||
path: ^1.8.1
|
path: ^1.8.1
|
||||||
xterm: ^3.4.0
|
xterm: ^3.4.0
|
||||||
flutter_pty: ^0.3.1
|
|
||||||
flutter_acrylic: ^1.0.0+2
|
flutter_acrylic: ^1.0.0+2
|
||||||
ansicolor: ^2.0.1
|
ansicolor: ^2.0.1
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||||
flutter_pty
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||||
|
Loading…
Reference in New Issue
Block a user