On boot, check system theme and set MIH Theme

This commit is contained in:
2025-01-17 10:36:48 +02:00
parent ba4e8227ae
commit 3a99ce636b

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
//import 'package:fpjs_pro_plugin/error.dart';
import '../mih_env/env.dart';
import '../mih_router/routeGenerator.dart';
@@ -79,7 +80,15 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
_themeMode = ThemeMode.dark;
theme = MyTheme();
theme.platform = Theme.of(context).platform;
theme.mode = "Dark";
var brightness =
SchedulerBinding.instance.platformDispatcher.platformBrightness;
bool isDarkMode = brightness == Brightness.dark;
if (isDarkMode) {
theme.mode = "Dark";
} else {
theme.mode = "Light";
}
super.initState();
//doInit();
}