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
464 stars 37 forks source link

[Question] How to only toggle between two themes, dark and light? #14

Closed sameer882000 closed 3 years ago

BirjuVachhani commented 3 years ago

@sameer882000

For now you can do this:

final mode = AdaptiveTheme.of(context).mode;
if (mode == AdaptiveThemeMode.light) {
  AdaptiveTheme.of(context).setDark();
} else {
  AdaptiveTheme.of(context).setLight();
}

Maybe I'll add this option in the toggleThemeMode() method like this in future:

AdaptiveTheme.of(context).toggleThemeMode(useSystem: false);
sameer882000 commented 3 years ago

@BirjuVachhani Thanks. Got it.