On boot, check system theme and set MIH Theme
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/scheduler.dart';
|
||||||
//import 'package:fpjs_pro_plugin/error.dart';
|
//import 'package:fpjs_pro_plugin/error.dart';
|
||||||
import '../mih_env/env.dart';
|
import '../mih_env/env.dart';
|
||||||
import '../mih_router/routeGenerator.dart';
|
import '../mih_router/routeGenerator.dart';
|
||||||
@@ -79,7 +80,15 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
|||||||
_themeMode = ThemeMode.dark;
|
_themeMode = ThemeMode.dark;
|
||||||
theme = MyTheme();
|
theme = MyTheme();
|
||||||
theme.platform = Theme.of(context).platform;
|
theme.platform = Theme.of(context).platform;
|
||||||
|
var brightness =
|
||||||
|
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||||
|
bool isDarkMode = brightness == Brightness.dark;
|
||||||
|
if (isDarkMode) {
|
||||||
theme.mode = "Dark";
|
theme.mode = "Dark";
|
||||||
|
} else {
|
||||||
|
theme.mode = "Light";
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
//doInit();
|
//doInit();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user