Skip to content

Commit 87c709b

Browse files
committed
fix:解決主題閃動問題
1 parent e7d6bb4 commit 87c709b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class MainAppState extends State<MainApp> {
3838
//实例化多语言
3939
super.initState();
4040
_delegate = AppLocalizationsDelegate();
41+
model.dispatch('config', 'getTheme');
4142
}
4243

4344
@override

lib/store/models/config_state_model.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class ConfigModel {
4949
break;
5050
case 'setTheme':
5151
_appConfigInfo.theme = payload;
52-
LocalStorage.set('theme',payload);
52+
LocalStorage.set('theme', payload);
53+
break;
54+
case 'getTheme':
55+
await this.getTheme();
5356
break;
5457
}
5558
}

lib/store/models/main_state_model.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class MainStateModel extends Model with UserModel {
2222
'config': config,
2323
};
2424
//
25-
config.getTheme();
2625
}
2726

2827
/**

0 commit comments

Comments
 (0)