kdsuneraavinash / theme_provider

Easy to use, customizable and pluggable Theme Provider.
https://pub.dartlang.org/packages/theme_provider
MIT License
152 stars 28 forks source link

Change theme dynamic #9

Closed brasizza closed 4 years ago

brasizza commented 4 years ago

Hi! is there a way to add more themes when in other page and use it?

I have an app that will change the theme when the user select some company and the app will get their color.

I tried to use the allthemes.add(Mytheme) but i can`t use it.

kdsuneraavinash commented 4 years ago

Sorry for the late reply.

I added this feature in 0.4.0. Now this is possible like

// Add theme
if (ThemeController.of(context).hasTheme('new_theme')){
  ThemeController.of(context).addTheme(newAppTheme);
}

// Remove theme
if (ThemeController.of(context).hasTheme('new_theme')){
  if (ThemeController.of(context).theme.id != 'new_theme'){
    ThemeController.of(context).removeTheme('new_theme')
  }
}

Thank you for the suggestion.