refactor power

This commit is contained in:
2026-04-07 11:55:01 +02:00
parent 130780cbb8
commit f4d3ec4bca
12 changed files with 157 additions and 74 deletions

28
lib/core/enums/enums.dart Normal file
View 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;
}