You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like onInitCallback called every time when the application moved to the background and back. Every time there is an animation of changing theme from light to dark.
void _onThemesInitCallback(ThemeController controller, previouslySavedThemeFuture) async {
print("_onThemesInitCallback ${controller.currentThemeId}");
String? savedTheme = await previouslySavedThemeFuture;
print("savedTheme $savedTheme");
if (savedTheme != null) {
controller.setTheme(savedTheme);
} else {
// If previous theme not found, use platform default
Brightness platformBrightness = SchedulerBinding.instance!.window.platformBrightness;
if (platformBrightness == Brightness.dark) {
controller.setTheme('dark');
} else {
controller.setTheme('light');
}
// Forget the saved theme(which were saved just now by previous lines)
controller.forgetSavedTheme();
}
print("_onThemesInitCallback END ${controller.currentThemeId}");
}
Also, I have prints on the application moved to the background and foreground (AppLifecycleState.resumed and .paused)
What I see in the logs during the test on the video:
I/flutter ( 5434): Application is on the foreground
I/flutter ( 5434): _onThemesInitCallback light
I/flutter ( 5434): savedTheme dark
I/flutter ( 5434): _onThemesInitCallback END dark
I/flutter ( 5434): _onThemesInitCallback light
I/flutter ( 5434): savedTheme dark
I/flutter ( 5434): _onThemesInitCallback END dark
I/flutter ( 5434): Application is on the background
I/flutter ( 5434): _onThemesInitCallback light
I/flutter ( 5434): savedTheme dark
I/flutter ( 5434): _onThemesInitCallback END dark
Seems like onInitCallback called every time when the application moved to the background and back. Every time there is an animation of changing theme from light to dark.
My
build
method:And
_onThemesInitCallback
method:Also, I have prints on the application moved to the background and foreground (
AppLifecycleState.resumed
and.paused
)What I see in the logs during the test on the video:
Video:
https://youtu.be/79vcS8sgYys
Tried to fix it by myself in my application, but seems like something strange in the package.
Thanks a lot for the package and your awesome work!
The text was updated successfully, but these errors were encountered: