|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
|
|
import 'package:dynamic_color/dynamic_color.dart'; |
|
|
|
|
import 'package:fluent_ui/fluent_ui.dart' as f; |
|
|
|
|
import 'package:flutter/cupertino.dart' as c; |
|
|
|
|
import 'package:flutter/gestures.dart'; |
|
|
|
@ -20,6 +21,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
import 'package:timezone/data/latest.dart'; |
|
|
|
|
|
|
|
|
|
void main() async { |
|
|
|
|
WidgetsFlutterBinding.ensureInitialized(); |
|
|
|
|
initializeTimeZones(); |
|
|
|
|
final sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
|
runApp( |
|
|
|
@ -107,52 +109,82 @@ class StartPoint extends ConsumerWidget {
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) { |
|
|
|
|
final uiDesign = ref.watch(uiDesignProvider); |
|
|
|
|
if (uiDesign == UiDesign.CUPERTINO) { |
|
|
|
|
return AnnotatedRegion( |
|
|
|
|
value: const SystemUiOverlayStyle( |
|
|
|
|
statusBarBrightness: c.Brightness.dark, |
|
|
|
|
), |
|
|
|
|
child: c.CupertinoApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: c.CupertinoThemeData( |
|
|
|
|
primaryColor: m.Colors.blue.shade600, |
|
|
|
|
brightness: c.Brightness.dark, |
|
|
|
|
// textTheme: CupertinoTextThemeData( |
|
|
|
|
// textStyle: TextStyle( |
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible', |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
), |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragCupertinoScrollBevahior() : null, |
|
|
|
|
routes: routes, |
|
|
|
|
), |
|
|
|
|
return DynamicColorBuilder( |
|
|
|
|
builder: (lightScheme, darkScheme) { |
|
|
|
|
return AnnotatedRegion( |
|
|
|
|
value: const SystemUiOverlayStyle( |
|
|
|
|
statusBarBrightness: c.Brightness.dark, |
|
|
|
|
), |
|
|
|
|
child: c.CupertinoApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: c.CupertinoThemeData( |
|
|
|
|
primaryColor: darkScheme?.primary ?? m.Colors.blue.shade600, |
|
|
|
|
brightness: c.Brightness.dark, |
|
|
|
|
// textTheme: CupertinoTextThemeData( |
|
|
|
|
// textStyle: TextStyle( |
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible', |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
), |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragCupertinoScrollBevahior() : null, |
|
|
|
|
routes: routes, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else if (uiDesign == UiDesign.FLUENT) { |
|
|
|
|
return f.FluentApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: f.ThemeData( |
|
|
|
|
brightness: f.Brightness.dark, |
|
|
|
|
accentColor: f.Colors.blue, |
|
|
|
|
), |
|
|
|
|
routes: routes, |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragFluentScrollBevahior() : const f.FluentScrollBehavior(), |
|
|
|
|
return DynamicColorBuilder( |
|
|
|
|
builder: (lightScheme, darkScheme) { |
|
|
|
|
return f.FluentApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: f.FluentThemeData( |
|
|
|
|
brightness: f.Brightness.light, |
|
|
|
|
accentColor: lightScheme != null ? f.AccentColor.swatch({ |
|
|
|
|
'normal': lightScheme.primary, |
|
|
|
|
}) : f.Colors.blue, |
|
|
|
|
), |
|
|
|
|
darkTheme: f.FluentThemeData( |
|
|
|
|
brightness: f.Brightness.dark, |
|
|
|
|
accentColor: darkScheme != null ? f.AccentColor.swatch({ |
|
|
|
|
'normal': darkScheme.primary, |
|
|
|
|
}) : f.Colors.blue, |
|
|
|
|
), |
|
|
|
|
routes: routes, |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragFluentScrollBevahior() : const f.FluentScrollBehavior(), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
return m.MaterialApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: m.ThemeData( |
|
|
|
|
primarySwatch: m.Colors.blue, |
|
|
|
|
colorScheme: m.ColorScheme.fromSwatch( |
|
|
|
|
return DynamicColorBuilder( |
|
|
|
|
builder: (lightScheme, darkScheme) { |
|
|
|
|
lightScheme ??= m.ColorScheme.fromSwatch( |
|
|
|
|
brightness: m.Brightness.light, |
|
|
|
|
primarySwatch: m.Colors.blue, |
|
|
|
|
); |
|
|
|
|
darkScheme ??= m.ColorScheme.fromSwatch( |
|
|
|
|
brightness: m.Brightness.dark, |
|
|
|
|
primarySwatch: m.Colors.blue, |
|
|
|
|
accentColor: m.Colors.blue.shade700, |
|
|
|
|
), |
|
|
|
|
useMaterial3: true, |
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible', |
|
|
|
|
), |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragMaterialScrollBevahior() : null, |
|
|
|
|
routes: routes, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return m.MaterialApp( |
|
|
|
|
title: appTitle, |
|
|
|
|
theme: m.ThemeData( |
|
|
|
|
colorScheme: lightScheme, |
|
|
|
|
useMaterial3: true, |
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible', |
|
|
|
|
), |
|
|
|
|
darkTheme: m.ThemeData( |
|
|
|
|
colorScheme: darkScheme, |
|
|
|
|
useMaterial3: true, |
|
|
|
|
// fontFamily: 'Atkinson Hyperlegible', |
|
|
|
|
), |
|
|
|
|
scrollBehavior: Platform.isLinux ? const DragMaterialScrollBevahior() : null, |
|
|
|
|
routes: routes, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|