refactor power
This commit is contained in:
28
lib/core/enums/enums.dart
Normal file
28
lib/core/enums/enums.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum AppThemeMode {
|
||||
light('light', 'Chiaro', ThemeMode.light, Icons.light_mode),
|
||||
dark('dark', 'Scuro', ThemeMode.dark, Icons.dark_mode),
|
||||
system('system', 'Sistema', ThemeMode.system, Icons.brightness_auto);
|
||||
|
||||
const AppThemeMode(this.value, this.label, this.themeMode, this.icon);
|
||||
final String value;
|
||||
final String label;
|
||||
final ThemeMode themeMode;
|
||||
final IconData icon;
|
||||
|
||||
static AppThemeMode fromValue(String? value) {
|
||||
return AppThemeMode.values.firstWhere(
|
||||
(e) => e.value == value,
|
||||
orElse: () => AppThemeMode.system,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum PrefKeys {
|
||||
theme('themeModeSetting'),
|
||||
lastStore('lastStore');
|
||||
|
||||
const PrefKeys(this.value);
|
||||
final String value;
|
||||
}
|
||||
Reference in New Issue
Block a user