fix theme radio update (#9647)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-10-14 17:46:38 +08:00 committed by GitHub
parent ae1c1a56e6
commit 55187e9243
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -555,7 +555,7 @@ class MyTheme {
return themeModeFromString(bind.mainGetLocalOption(key: kCommConfKeyTheme));
}
static void changeDarkMode(ThemeMode mode) async {
static Future<void> changeDarkMode(ThemeMode mode) async {
Get.changeThemeMode(mode);
if (desktopType == DesktopType.main || isAndroid || isIOS || isWeb) {
if (mode == ThemeMode.system) {

View File

@ -369,8 +369,8 @@ class _GeneralState extends State<_General> {
Widget theme() {
final current = MyTheme.getThemeModePreference().toShortString();
onChanged(String value) {
MyTheme.changeDarkMode(MyTheme.themeModeFromString(value));
onChanged(String value) async {
await MyTheme.changeDarkMode(MyTheme.themeModeFromString(value));
setState(() {});
}

View File

@ -507,7 +507,7 @@ _registerEventHandler() {
platformFFI.registerEventHandler('theme', 'theme', (evt) async {
String? dark = evt['dark'];
if (dark != null) {
MyTheme.changeDarkMode(MyTheme.themeModeFromString(dark));
await MyTheme.changeDarkMode(MyTheme.themeModeFromString(dark));
}
});
platformFFI.registerEventHandler('language', 'language', (_) async {