fix: synchronize macOS window theme on flutter theme changed.

This commit is contained in:
Kingtous 2023-02-02 13:57:20 +08:00
parent 76adc8de20
commit 6119e04006
6 changed files with 94 additions and 1 deletions

View file

@ -108,6 +108,8 @@ Future<void> initEnv(String appType) async {
await initGlobalFFI();
// await Firebase.initializeApp();
_registerEventHandler();
// Update the system theme.
updateSystemWindowTheme();
}
void runMainApp(bool startService) async {
@ -327,6 +329,8 @@ class _AppState extends State<App> {
to = ThemeMode.light;
}
Get.changeThemeMode(to);
// Synchronize the window theme of the system.
updateSystemWindowTheme();
if (desktopType == DesktopType.main) {
bind.mainChangeTheme(dark: to.toShortString());
}