theme_preference.dart 424 B

1234567891011121314151617
  1. /// The three theme choices exposed in Settings.
  2. enum ThemePreference {
  3. light('light'),
  4. dark('dark'),
  5. automatic('automatic');
  6. const ThemePreference(this.storageValue);
  7. final String storageValue;
  8. static ThemePreference fromStorage(String? value) {
  9. return ThemePreference.values.firstWhere(
  10. (preference) => preference.storageValue == value,
  11. orElse: () => ThemePreference.automatic,
  12. );
  13. }
  14. }