feat(audio): 화면들 채널별 SFX API 적용

- game_play_screen: playPlayerSfx/playMonsterSfx 분리 사용
- settings_screen: 오디오 설정 UI 개선
This commit is contained in:
JiWoong Sul
2025-12-31 01:33:18 +09:00
parent 764a8353fb
commit 72676485d3
2 changed files with 43 additions and 14 deletions

View File

@@ -13,6 +13,8 @@ class SettingsScreen extends StatefulWidget {
required this.currentThemeMode,
required this.onThemeModeChange,
this.onLocaleChange,
this.onBgmVolumeChange,
this.onSfxVolumeChange,
});
final SettingsRepository settingsRepository;
@@ -20,6 +22,12 @@ class SettingsScreen extends StatefulWidget {
final void Function(ThemeMode mode) onThemeModeChange;
final void Function(String locale)? onLocaleChange;
/// BGM 볼륨 변경 콜백 (AudioService 연동용)
final void Function(double volume)? onBgmVolumeChange;
/// SFX 볼륨 변경 콜백 (AudioService 연동용)
final void Function(double volume)? onSfxVolumeChange;
@override
State<SettingsScreen> createState() => _SettingsScreenState();
@@ -30,6 +38,8 @@ class SettingsScreen extends StatefulWidget {
required ThemeMode currentThemeMode,
required void Function(ThemeMode mode) onThemeModeChange,
void Function(String locale)? onLocaleChange,
void Function(double volume)? onBgmVolumeChange,
void Function(double volume)? onSfxVolumeChange,
}) {
return showModalBottomSheet<void>(
context: context,
@@ -45,6 +55,8 @@ class SettingsScreen extends StatefulWidget {
currentThemeMode: currentThemeMode,
onThemeModeChange: onThemeModeChange,
onLocaleChange: onLocaleChange,
onBgmVolumeChange: onBgmVolumeChange,
onSfxVolumeChange: onSfxVolumeChange,
),
),
);
@@ -147,6 +159,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
onChanged: (value) {
setState(() => _bgmVolume = value);
widget.settingsRepository.saveBgmVolume(value);
widget.onBgmVolumeChange?.call(value);
},
),
const SizedBox(height: 8),
@@ -157,6 +170,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
onChanged: (value) {
setState(() => _sfxVolume = value);
widget.settingsRepository.saveSfxVolume(value);
widget.onSfxVolumeChange?.call(value);
},
),
const SizedBox(height: 24),
@@ -241,7 +255,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
Icon(
icon,
color: isSelected
? theme.colorScheme.primary
? theme.colorScheme.onPrimaryContainer
: theme.colorScheme.onSurface,
),
const SizedBox(height: 4),
@@ -251,7 +265,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
fontSize: 12,
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
color: isSelected
? theme.colorScheme.primary
? theme.colorScheme.onPrimaryContainer
: theme.colorScheme.onSurface,
),
),