On boot, check system theme and set MIH Theme
This commit is contained in:
parent
ba4e8227ae
commit
3a99ce636b
1 changed files with 10 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue