I have set the theme properties properly in the app. I am trying to give the user the freedom to change colour of the app (primary colour) as the user wishes. I tried implementing state management on the "main.dart" file but once the theme has been initialized in runApp, while the app is running it does not let me change the primary colour of the theme, only allows change of modes (light and dark). Is there a way to change the primary colour of a theme on button press?
2
Answers
i think you have to assign the color to provider and save it in the sharedprefrences after that you have to re-run the app and the theme from sharedpreferences
I would have used something like this (to change primary color to green for example) :
But it seems to raise an well known error (see : https://github.com/flutter/flutter/issues/103864)