Jonny Borges
Committed by GitHub

Merge pull request #1262 from GoldenSoju/master

Fix for darkTheme not getting changed correctly if default value is set in GetMaterialApp
... ... @@ -245,7 +245,7 @@ class GetMaterialApp extends StatelessWidget {
onGenerateTitle: onGenerateTitle,
color: color,
theme: _.theme ?? theme ?? ThemeData.fallback(),
darkTheme: darkTheme,
darkTheme: _.darkTheme ?? darkTheme ?? ThemeData.fallback(),
themeMode: _.themeMode ?? themeMode,
locale: Get.locale ?? locale,
localizationsDelegates: localizationsDelegates,
... ... @@ -293,7 +293,7 @@ class GetMaterialApp extends StatelessWidget {
onGenerateTitle: onGenerateTitle,
color: color,
theme: _.theme ?? theme ?? ThemeData.fallback(),
darkTheme: darkTheme,
darkTheme: _.darkTheme ?? darkTheme ?? ThemeData.fallback(),
themeMode: _.themeMode ?? themeMode,
locale: Get.locale ?? locale,
localizationsDelegates: localizationsDelegates,
... ...
... ... @@ -10,6 +10,7 @@ class GetMaterialController extends GetxController {
bool testMode = false;
Key? unikey;
ThemeData? theme;
ThemeData? darkTheme;
ThemeMode? themeMode;
bool defaultPopGesture = GetPlatform.isIOS;
... ... @@ -36,7 +37,15 @@ class GetMaterialController extends GetxController {
Map<int, GlobalKey<NavigatorState>> keys = {};
void setTheme(ThemeData value) {
theme = value;
if (darkTheme == null) {
theme = value;
} else {
if (value.brightness == Brightness.light) {
theme = value;
} else {
darkTheme = value;
}
}
update();
}
... ...