fix desktop dark mode

This commit is contained in:
csf 2022-08-09 21:12:55 +08:00
parent 42f27922bf
commit dd8812dd88
2 changed files with 7 additions and 2 deletions

View File

@ -118,7 +118,9 @@ void window_on_top(int? id) {
windowManager.show();
windowManager.focus();
} else {
WindowController.fromWindowId(id)..focus()..show();
WindowController.fromWindowId(id)
..focus()
..show();
}
}

View File

@ -479,6 +479,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Get.changeTheme(MyTheme.lightTheme);
}
Get.find<SharedPreferences>().setString("darkTheme", choice);
Get.forceAppUpdate();
}
void onSelectMenu(String key) async {
@ -489,7 +490,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
final option = await bind.mainGetOption(key: key);
final choice = option == "Y" ? "" : "Y";
bind.mainSetOption(key: key, value: choice);
changeTheme(choice);
if (key == "allow-darktheme") changeTheme(choice);
} else if (key == "stop-service") {
final option = await bind.mainGetOption(key: key);
bind.mainSetOption(key: key, value: option == "Y" ? "" : "Y");
@ -516,6 +517,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
bool enable;
if (key == "stop-service") {
enable = v != "Y";
} else if (key.startsWith("allow-")) {
enable = v == "Y";
} else {
enable = v != "N";
}