import 'package:flutter/material.dart'; import 'package:audioplayers/audioplayers.dart'; import '../core/app_colors.dart'; class AudioService extends ChangeNotifier { static final AudioService instance = AudioService._internal(); AudioService._internal(); bool isMuted = false; final AudioPlayer _sfxPlayer = AudioPlayer(); void toggleMute() { isMuted = !isMuted; notifyListeners(); } void playLineSfx(AppThemeType theme) async { if (isMuted) return; String file = ''; switch (theme) { case AppThemeType.minimal: file = 'minimal_line.wav'; break; case AppThemeType.doodle: case AppThemeType.wood: file = 'doodle_line.wav'; break; case AppThemeType.cyberpunk: file = 'cyber_line.wav'; break; } await _sfxPlayer.play(AssetSource('audio/sfx/$file')); } void playBoxSfx(AppThemeType theme) async { if (isMuted) return; String file = ''; switch (theme) { case AppThemeType.minimal: file = 'minimal_box.wav'; break; case AppThemeType.doodle: case AppThemeType.wood: file = 'doodle_box.wav'; break; case AppThemeType.cyberpunk: file = 'cyber_box.wav'; break; } await _sfxPlayer.play(AssetSource('audio/sfx/$file')); } // --- NUOVI EFFETTI SPECIALI --- void playBonusSfx() async { if (isMuted) return; // Assicurati di aggiungere questo file nella cartella assets/audio/sfx/ await _sfxPlayer.play(AssetSource('audio/sfx/bonus.wav')); } void playBombSfx() async { if (isMuted) return; // Assicurati di aggiungere questo file nella cartella assets/audio/sfx/ await _sfxPlayer.play(AssetSource('audio/sfx/bomb.wav')); } }