Public Access
feat(ui): add dynamic color Scheme (based on wallpaper) if supported
This commit is contained in:
+23
-17
@@ -6,6 +6,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart'; //for testing on desktop
|
||||
import 'utilities.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
|
||||
void main() async {
|
||||
await dotenv.load();
|
||||
@@ -18,29 +19,34 @@ void main() async {
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
final _defaultLightScheme = ColorScheme.fromSeed(seedColor: Colors.yellow);
|
||||
final _defaultDarkScheme = ColorScheme.fromSeed(
|
||||
seedColor: Colors.yellow,
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Oeffimaster',
|
||||
theme: ThemeData(
|
||||
brightness: Brightness.light,
|
||||
colorSchemeSeed: Colors.yellow,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
colorSchemeSeed: Colors.yellow,
|
||||
),
|
||||
themeMode: ThemeMode.system,
|
||||
// home: const MyHomePage(title: 'Oeffimaster'), //this is what matters
|
||||
home: const JourneyOverviewPage(),
|
||||
// routes: {
|
||||
// //'/': (context) => const MyHomePage(title: 'Oeffimaster'),
|
||||
// '/stations': (context) => const ChooseStationPage(),
|
||||
// },
|
||||
return DynamicColorBuilder(
|
||||
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: lightDynamic ?? _defaultLightScheme,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: darkDynamic ?? _defaultDarkScheme,
|
||||
),
|
||||
themeMode: ThemeMode.system,
|
||||
home: const JourneyOverviewPage(),
|
||||
title: 'Oeffimaster',
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user