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
flutter/lib

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

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