BirjuVachhani / adaptive_theme

Easiest way to add support for light and dark theme in your flutter app.
https://pub.dev/packages/adaptive_theme
Apache License 2.0
479 stars 37 forks source link

AdaptiveTheme.of(context).setTheme is not working #47

Closed MaheshPeri19 closed 1 year ago

MaheshPeri19 commented 1 year ago

I am setting both Light and Dark Theme with initial Primary Color. Later in Settings screen, i am using setTheme() to change entire color theme with other primary color. But it is not changing to new color. I have checked in both iOS and Android.

void setApplicationColorTheme(
    {required BuildContext context, required Color primaryAppColor}) {
  print("primaryAppColor is $primaryAppColor");
  AdaptiveTheme.of(context).setTheme(
      light: getLightThemeData(primaryAppColor: primaryAppColor),
      dark: getDarkThemeData(primaryAppColor: primaryAppColor),
      notify: true);
}

Expected behavior It should change entire app theme with new primary color.

Please suggest me to fix this issue.

MaheshPeri19 commented 1 year ago

My Bad. I forgot to change initial color to Theme.of(context).primaryColor.

It is working fine.

Thank you.