add dark theme toggle
This commit is contained in:
@@ -20,6 +20,7 @@ class _MainAppState extends State<MainApp> {
|
||||
List<TimelineGroup> _groups = const [];
|
||||
List<TimelineEntry> _entries = const [];
|
||||
TimelineViewportNotifier? _viewport;
|
||||
bool _darkMode = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -53,6 +54,7 @@ class _MainAppState extends State<MainApp> {
|
||||
_state = state;
|
||||
_groups = groups;
|
||||
_entries = entries;
|
||||
_darkMode = state.darkMode;
|
||||
|
||||
_viewport ??= TimelineViewportNotifier(
|
||||
start: domain.start,
|
||||
@@ -207,7 +209,9 @@ class _MainAppState extends State<MainApp> {
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData.dark(useMaterial3: true),
|
||||
theme: _darkMode
|
||||
? ThemeData.dark(useMaterial3: true)
|
||||
: ThemeData.light(useMaterial3: true),
|
||||
home: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: _state == null || viewport == null
|
||||
|
||||
Reference in New Issue
Block a user