mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-30 09:46:55 -06:00
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: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<MyApp> with UiLoggy {
|
||||
String _veilidVersion = 'Unknown';
|
||||
bool _startedUp = false;
|
||||
Stream<VeilidUpdate>? _updateStream;
|
||||
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
|
||||
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<MyApp> 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<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")),
|
||||
])
|
||||
]),
|
||||
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<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: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<LogTerminal> {
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -9,6 +9,9 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Colors
|
||||
|
||||
const Map<int, Color> primaryColorSwatch = {
|
||||
50: Color(0xffe9e9f3),
|
||||
100: Color(0xffc7c8e2),
|
||||
@ -233,10 +236,58 @@ const Map<int, Color> 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(),
|
||||
);
|
||||
}
|
@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
flutter_pty
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
flutter_pty
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
Loading…
Reference in New Issue
Block a user