21 lines
No EOL
670 B
Dart
21 lines
No EOL
670 B
Dart
import 'package:flutter/material.dart';
|
|
import 'app_colors.dart';
|
|
import '../services/storage_service.dart';
|
|
|
|
class ThemeManager extends ChangeNotifier {
|
|
late AppThemeType _currentThemeType;
|
|
|
|
ThemeManager() {
|
|
// Quando l'app parte, legge il tema dalla memoria!
|
|
_currentThemeType = AppThemeType.values[StorageService.instance.savedThemeIndex];
|
|
}
|
|
|
|
AppThemeType get currentThemeType => _currentThemeType;
|
|
ThemeColors get currentColors => AppColors.getTheme(_currentThemeType);
|
|
|
|
void setTheme(AppThemeType type) {
|
|
_currentThemeType = type;
|
|
StorageService.instance.saveTheme(type); // Salva la scelta nel "disco fisso"
|
|
notifyListeners();
|
|
}
|
|
} |