forked from yaso_meth/mih-project
Merge pull request #56 from yaso-meth/BUG-theme-linking-issue
BUG-theme-linking-issue
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
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';
|
||||
import '../mih_theme/mih_theme.dart';
|
||||
|
||||
//import 'package:fpjs_pro_plugin/fpjs_pro_plugin.dart';
|
||||
|
||||
class MzanziInnovationHub extends StatefulWidget {
|
||||
const MzanziInnovationHub({
|
||||
super.key,
|
||||
@@ -84,14 +80,14 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
||||
_themeMode = ThemeMode.dark;
|
||||
theme = MyTheme();
|
||||
theme.platform = Theme.of(context).platform;
|
||||
var brightness =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
bool isDarkMode = brightness == Brightness.dark;
|
||||
if (isDarkMode) {
|
||||
theme.mode = "Dark";
|
||||
} else {
|
||||
theme.mode = "Light";
|
||||
}
|
||||
// var brightness =
|
||||
// SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
// bool isDarkMode = brightness == Brightness.dark;
|
||||
// if (isDarkMode) {
|
||||
// theme.mode = "Dark";
|
||||
// } else {
|
||||
// theme.mode = "Light";
|
||||
// }
|
||||
|
||||
super.initState();
|
||||
//doInit();
|
||||
@@ -99,6 +95,14 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// var brightness =
|
||||
// SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
// bool isDarkMode = brightness == Brightness.dark;
|
||||
// if (isDarkMode) {
|
||||
// theme.mode = "Dark";
|
||||
// } else {
|
||||
// theme.mode = "Light";
|
||||
// }
|
||||
double width = MediaQuery.sizeOf(context).width;
|
||||
theme.setScreenType(width);
|
||||
precacheImage(theme.loadingImage(), context);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:Mzansi_Innovation_Hub/main.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/authentication/biometric_check.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
import 'package:supertokens_flutter/supertokens.dart';
|
||||
import 'package:no_screenshot/no_screenshot.dart';
|
||||
@@ -42,6 +44,14 @@ class _AuthCheckState extends State<AuthCheck> {
|
||||
void initState() {
|
||||
//signedIn = doesSessionExist();
|
||||
disableScreenshot();
|
||||
var brightness =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness;
|
||||
bool isDarkMode = brightness == Brightness.dark;
|
||||
if (isDarkMode) {
|
||||
MzanziInnovationHub.of(context)!.theme.mode = "Dark";
|
||||
} else {
|
||||
MzanziInnovationHub.of(context)!.theme.mode = "Light";
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user