// =========================================================================== // FILE: lib/core/theme_manager.dart // =========================================================================== import 'package:flutter/material.dart'; import 'app_colors.dart'; import '../services/storage_service.dart'; import '../services/audio_service.dart'; // <-- NUOVO IMPORT PER LA MUSICA class ThemeManager extends ChangeNotifier { late AppThemeType _currentThemeType; ThemeManager() { // Quando l'app parte, legge il tema dalla memoria! _currentThemeType = AppThemeType.values[StorageService.instance.savedThemeIndex]; // Fai partire subito la colonna sonora del tema salvato! AudioService.instance.playBgm(_currentThemeType); } 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" // Cambia magicamente la canzone in sottofondo! AudioService.instance.playBgm(type); notifyListeners(); } }