fix theme sync

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-12-03 16:32:22 +08:00
parent 8646733ae7
commit fb0c75f188

View File

@ -215,18 +215,15 @@ class MyTheme {
} }
static void changeDarkMode(ThemeMode mode) { static void changeDarkMode(ThemeMode mode) {
final preference = getThemeModePreference(); Get.changeThemeMode(mode);
if (preference != mode) { if (desktopType == DesktopType.main) {
if (mode == ThemeMode.system) { if (mode == ThemeMode.system) {
bind.mainSetLocalOption(key: kCommConfKeyTheme, value: ''); bind.mainSetLocalOption(key: kCommConfKeyTheme, value: '');
} else { } else {
bind.mainSetLocalOption( bind.mainSetLocalOption(
key: kCommConfKeyTheme, value: mode.toShortString()); key: kCommConfKeyTheme, value: mode.toShortString());
} }
Get.changeThemeMode(mode); bind.mainChangeTheme(dark: currentThemeMode().toShortString());
if (desktopType == DesktopType.main) {
bind.mainChangeTheme(dark: currentThemeMode().toShortString());
}
} }
} }