diff options
Diffstat (limited to 'lib/presentation/screens/media_player')
-rw-r--r-- | lib/presentation/screens/media_player/widgets/media_volume_bar.dart | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart b/lib/presentation/screens/media_player/widgets/media_volume_bar.dart index 2b063b4..ed962a7 100644 --- a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart +++ b/lib/presentation/screens/media_player/widgets/media_volume_bar.dart @@ -14,28 +14,30 @@ class CustomVolumeSlider extends ConsumerStatefulWidget { class CustomVolumeSliderState extends ConsumerState<CustomVolumeSlider> { void _increase() { + _currentVal += 10; + if (_currentVal > 100) { + _currentVal = 100; + } setState(() { - if (_currentVal < 20) { - _currentVal++; - ref.read(audioStateProvider.notifier).setVolume(_currentVal); - } + ref.read(vehicleProvider.notifier).setVolume(_currentVal); }); } void _dercrease() { + _currentVal -= 10; + if (_currentVal < 0) { + _currentVal = 0; + } setState(() { - if (_currentVal > 0) { - _currentVal--; - ref.read(audioStateProvider.notifier).setVolume(_currentVal); - } + ref.read(vehicleProvider.notifier).setVolume(_currentVal); }); } - double _currentVal = 5; + double _currentVal = 50; @override Widget build(BuildContext context) { final volumeValue = - ref.watch(audioStateProvider.select((audio) => audio.volume)); + ref.watch(vehicleProvider.select((audio) => audio.mediaVolume)); return Column( //crossAxisAlignment: CrossAxisAlignment.center, @@ -99,12 +101,12 @@ class CustomVolumeSliderState extends ConsumerState<CustomVolumeSlider> { //trackHeight: 5, ), child: Slider( - divisions: 20, + divisions: 10, min: 0, - max: 20, - value: volumeValue, + max: 100, + value: volumeValue.toDouble(), onChanged: (newValue) { - ref.read(audioStateProvider.notifier).setVolume(newValue); + ref.read(vehicleProvider.notifier).setVolume(newValue); _currentVal = newValue; }, ), |