From dd8812dd88c9c697804ec076c93c212e8bdde228 Mon Sep 17 00:00:00 2001 From: csf Date: Tue, 9 Aug 2022 21:12:55 +0800 Subject: [PATCH] fix desktop dark mode --- flutter/lib/common.dart | 4 +++- flutter/lib/desktop/pages/desktop_home_page.dart | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 26398b7e4..3b026141d 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -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(); } } diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 1d15a30a9..8496b0eda 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -479,6 +479,7 @@ class _DesktopHomePageState extends State Get.changeTheme(MyTheme.lightTheme); } Get.find().setString("darkTheme", choice); + Get.forceAppUpdate(); } void onSelectMenu(String key) async { @@ -489,7 +490,7 @@ class _DesktopHomePageState extends State 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 bool enable; if (key == "stop-service") { enable = v != "Y"; + } else if (key.startsWith("allow-")) { + enable = v == "Y"; } else { enable = v != "N"; }