kherel/animated_theme_switcher

How to get current theme after switch?

Closed this issue · 2 comments

Hi, so onPressed this is my code

ThemeSwitcher.of(context)!.changeTheme(
theme: ThemeProvider.of(context)!.brightness == Brightness.light ? Util.getThemeDark() : Util.getThemeLight(),
);

How to get the current theme? I figured there would be something like a .then() after changeTheme() but none.

So if i call it after the block of code above.

ThemeProvider.of(context)!.brightness.toString() or
WidgetsBinding.instance!.window.platformBrightness.toString()

It does not get the current theme that is being switched to. Thoughts?

ThemeData? theme = ThemeProvider.of(context);

You can get theme like this