1

I have a conditional theme widget:

 return Theme(
        data: themeMode == ThemeMode.light ? formThemeTwo : formThemeTwoDark,
        child: Scaffold(

That changes the theme depending on the ThemeMode.

When the theme changes, this doesn't change:

TextStyle(
fontWeight: FontWeight.w600,
            fontSize: 40,
            color: Theme.of(context).primaryColor)

So there are two themes, and when the theme changes to formThemeTwoDark, Theme.of(context).primaryColor is not updating to use the primaryColor of formThemeTwoDark. It is updating colors that are not declared by using Theme.of(context) (e.g. widgets that don't specify the color at all and instead use the themes default).

Ken White
  • 123,280
  • 14
  • 225
  • 444
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287

0 Answers0