2.0.0-dev.6 and ThemeData not updating UI #1416
MitchWenceInfocorp
started this conversation in
General
Replies: 3 comments 1 reply
-
It seems to me that you are not watching the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, that is an issue. However, now that it is watching it I need to run a |
Beta Was this translation helpful? Give feedback.
1 reply
-
You should instead do: final themeDataProvider = StateProvider((ref) =>ThemeData(<your theme here>));
class _MyAppState extends ConsumerState<MyApp> {
@override
Widget build(BuildContext context) {
final themeData = ref.watch(themeDataProvider);
return MaterialApp.router(
title: 'My App',
theme: themeData,
routerDelegate: _appRouter.delegate(),
routeInformationParser: _appRouter.defaultRouteParser(),
);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to move the ThemeData via riverpod and it is not working. Not sure If I am doing something wrong, riverpod shouldn't be used for this or a bug. This is in Flutter 3. Here is what I am doing:
main.dart
Note I am also using auto_route
This correctly loads the theme. Then in another widget, there is a button and in the onPress
I can see in print statements that the Brightness.dark is set however the app doesn't change.
Beta Was this translation helpful? Give feedback.
All reactions