feat(ground-suite): add system glass themes
This commit is contained in:
1 parent
01fb9f7292
commit
fd26a0bd14
9 files changed
+422
-136
No files matched your search
@@ -11,7 +11,9 @@ class GroundSuiteApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
title: 'Ground Suite',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: groundSuiteTheme(),
|
||||
theme: groundSuiteLightTheme(),
|
||||
darkTheme: groundSuiteDarkTheme(),
|
||||
themeMode: ThemeMode.system,
|
||||
home: const AppShell(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../features/diagnostics/presentation/diagnostics_page.dart';
|
||||
import '../features/observability/presentation/observability_controller.dart';
|
||||
import '../features/overview/presentation/overview_page.dart';
|
||||
import '../shared/widgets/glass_panel.dart';
|
||||
|
||||
enum _Destination { overview, diagnostics }
|
||||
|
||||
@@ -23,34 +24,36 @@ class _AppShellState extends ConsumerState<AppShell> {
|
||||
const pages = <Widget>[OverviewPage(), DiagnosticsPage()];
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final compact = constraints.maxWidth < 760;
|
||||
final content = _Workspace(
|
||||
state: state,
|
||||
selectedIndex: _destination.index,
|
||||
pages: pages,
|
||||
compact: compact,
|
||||
);
|
||||
return compact
|
||||
? _CompactShell(
|
||||
selectedIndex: _destination.index,
|
||||
onSelected: _selectDestination,
|
||||
content: content,
|
||||
)
|
||||
: _WideShell(
|
||||
selectedIndex: _destination.index,
|
||||
onSelected: _selectDestination,
|
||||
content: content,
|
||||
);
|
||||
},
|
||||
),
|
||||
if (state.accessibilityAnnouncement case final announcement?)
|
||||
_CriticalAnnouncement(message: announcement),
|
||||
],
|
||||
body: OrkavianBackdrop(
|
||||
child: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final compact = constraints.maxWidth < 760;
|
||||
final content = _Workspace(
|
||||
state: state,
|
||||
selectedIndex: _destination.index,
|
||||
pages: pages,
|
||||
compact: compact,
|
||||
);
|
||||
return compact
|
||||
? _CompactShell(
|
||||
selectedIndex: _destination.index,
|
||||
onSelected: _selectDestination,
|
||||
content: content,
|
||||
)
|
||||
: _WideShell(
|
||||
selectedIndex: _destination.index,
|
||||
onSelected: _selectDestination,
|
||||
content: content,
|
||||
);
|
||||
},
|
||||
),
|
||||
if (state.accessibilityAnnouncement case final announcement?)
|
||||
_CriticalAnnouncement(message: announcement),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -76,15 +79,18 @@ class _WideShell extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
selectedIndex: selectedIndex,
|
||||
labelType: NavigationRailLabelType.all,
|
||||
onDestinationSelected: onSelected,
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Icon(Icons.flight_takeoff_outlined, size: 28),
|
||||
GlassPanel(
|
||||
borderRadius: BorderRadius.zero,
|
||||
child: NavigationRail(
|
||||
selectedIndex: selectedIndex,
|
||||
labelType: NavigationRailLabelType.all,
|
||||
onDestinationSelected: onSelected,
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Icon(Icons.flight_takeoff_outlined, size: 28),
|
||||
),
|
||||
destinations: _destinations,
|
||||
),
|
||||
destinations: _destinations,
|
||||
),
|
||||
const VerticalDivider(width: 1),
|
||||
Expanded(child: content),
|
||||
@@ -109,21 +115,24 @@ class _CompactShell extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(child: content),
|
||||
NavigationBar(
|
||||
selectedIndex: selectedIndex,
|
||||
onDestinationSelected: onSelected,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.space_dashboard_outlined),
|
||||
selectedIcon: Icon(Icons.space_dashboard),
|
||||
label: 'Overview',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.receipt_long_outlined),
|
||||
selectedIcon: Icon(Icons.receipt_long),
|
||||
label: 'Diagnostics',
|
||||
),
|
||||
],
|
||||
GlassPanel(
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
|
||||
child: NavigationBar(
|
||||
selectedIndex: selectedIndex,
|
||||
onDestinationSelected: onSelected,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.space_dashboard_outlined),
|
||||
selectedIcon: Icon(Icons.space_dashboard),
|
||||
label: 'Overview',
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.receipt_long_outlined),
|
||||
selectedIcon: Icon(Icons.receipt_long),
|
||||
label: 'Diagnostics',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -194,18 +203,26 @@ class _ConnectionBar extends StatelessWidget {
|
||||
horizontal: compact ? 16 : 24,
|
||||
vertical: 12,
|
||||
),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.visibility_outlined, color: theme.colorScheme.primary),
|
||||
Text('Observation only', style: theme.textTheme.titleSmall),
|
||||
_StatusChip(label: state.sourceLabel),
|
||||
_StatusChip(label: state.status.label),
|
||||
Text(peer),
|
||||
Text(frameTime),
|
||||
],
|
||||
child: GlassPanel(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.visibility_outlined,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
Text('Observation only', style: theme.textTheme.titleSmall),
|
||||
_StatusChip(label: state.sourceLabel),
|
||||
_StatusChip(label: state.status.label),
|
||||
Text(peer),
|
||||
Text(frameTime),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,17 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
ThemeData groundSuiteTheme() {
|
||||
const seed = Color(0xff006c8f);
|
||||
final scheme = ColorScheme.fromSeed(seedColor: seed);
|
||||
/// Orkavian's restrained green accent, used sparingly against neutral surfaces.
|
||||
const orkavianGreen = Color(0xff00ff41);
|
||||
|
||||
ThemeData groundSuiteLightTheme() => _theme(
|
||||
brightness: Brightness.light,
|
||||
seed: const Color(0xff007a2e),
|
||||
surface: const Color(0xfff6f8f5),
|
||||
onSurface: const Color(0xff172019),
|
||||
outline: const Color(0xffbdc7bc),
|
||||
);
|
||||
|
||||
ThemeData groundSuiteDarkTheme() => _theme(
|
||||
brightness: Brightness.dark,
|
||||
seed: orkavianGreen,
|
||||
surface: const Color(0xff0a0a0a),
|
||||
onSurface: const Color(0xffe7e7e7),
|
||||
outline: const Color(0xff333333),
|
||||
);
|
||||
|
||||
ThemeData _theme({
|
||||
required Brightness brightness,
|
||||
required Color seed,
|
||||
required Color surface,
|
||||
required Color onSurface,
|
||||
required Color outline,
|
||||
}) {
|
||||
final scheme = ColorScheme.fromSeed(seedColor: seed, brightness: brightness)
|
||||
.copyWith(
|
||||
primary: seed,
|
||||
onPrimary: brightness == Brightness.dark
|
||||
? const Color(0xff031207)
|
||||
: Colors.white,
|
||||
surface: surface,
|
||||
onSurface: onSurface,
|
||||
outline: outline,
|
||||
surfaceContainer: brightness == Brightness.dark
|
||||
? const Color(0xff111111)
|
||||
: const Color(0xffedf1ec),
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: scheme,
|
||||
scaffoldBackgroundColor: scheme.surface,
|
||||
scaffoldBackgroundColor: Colors.transparent,
|
||||
visualDensity: VisualDensity.standard,
|
||||
cardTheme: CardThemeData(
|
||||
fontFamily: 'monospace',
|
||||
cardTheme: const CardThemeData(
|
||||
color: Colors.transparent,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
margin: EdgeInsets.zero,
|
||||
),
|
||||
dividerTheme: DividerThemeData(color: outline.withValues(alpha: 0.72)),
|
||||
navigationRailTheme: NavigationRailThemeData(
|
||||
backgroundColor: Colors.transparent,
|
||||
indicatorColor: seed.withValues(
|
||||
alpha: brightness == Brightness.dark ? 0.2 : 0.13,
|
||||
),
|
||||
selectedIconTheme: IconThemeData(color: seed),
|
||||
selectedLabelTextStyle: TextStyle(
|
||||
color: seed,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: Colors.transparent,
|
||||
indicatorColor: seed.withValues(
|
||||
alpha: brightness == Brightness.dark ? 0.2 : 0.13,
|
||||
),
|
||||
labelTextStyle: WidgetStatePropertyAll(
|
||||
TextStyle(color: onSurface, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
chipTheme: ChipThemeData(
|
||||
backgroundColor: scheme.surfaceContainer.withValues(alpha: 0.72),
|
||||
selectedColor: seed.withValues(
|
||||
alpha: brightness == Brightness.dark ? 0.22 : 0.16,
|
||||
),
|
||||
side: BorderSide(color: outline.withValues(alpha: 0.75)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: scheme.surfaceContainer.withValues(alpha: 0.7),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: outline),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: outline.withValues(alpha: 0.8)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderSide: BorderSide(color: seed, width: 1.5),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user