From 2d395f4431ba4aa5055d02437463588f4d4c8127 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Wed, 3 Jan 2024 18:14:12 -0500 Subject: Initial mediaplayer implementation Notable changes: - Added dart_mpd package as a dependency. - Added MPD client class and associated provider. - Added MPD client configuration to the configuration file for potential usecases where MPD may not be available locally. - Added playlist, play state, art, etc. providers for use in the mediaplayer front end UI. - Reworked MediaPlayer classes to wire up MPD client backend. - Removed volume slider from the bottom of the media pages to make more room for playlist / preset tables, as only being able to show 3 entries in each was not usable in practice. - Reworked media player mocked up position indicator into an actual slider control, and reworked the radio slider styling to match for better UI consistency. - Reworked media player and radio playlist / preset tables to attempt to have them layout at the same location and add an always visible scroll bar. The scroll bars currently have a layout issue with respect to scroll track size that does not seem to have an obvious fix. They are usable for now, and further investigation will be done when time permits. - Wired up play/pause button on the side volume control via a new set of play state and controller providers. Bug-AGL: SPEC-5028, SPEC-5029 Change-Id: I87efecc58b4e185443942eb32ff8148ebcd675c3 Signed-off-by: Scott Murray --- lib/presentation/common_widget/volume_bar.dart | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'lib/presentation/common_widget/volume_bar.dart') diff --git a/lib/presentation/common_widget/volume_bar.dart b/lib/presentation/common_widget/volume_bar.dart index b54283e..b966fc9 100644 --- a/lib/presentation/common_widget/volume_bar.dart +++ b/lib/presentation/common_widget/volume_bar.dart @@ -43,13 +43,21 @@ class VolumeBarState extends ConsumerState { }); } - void pause() {} + void play() { + ref.read(playControllerProvider).play(); + } + + void pause() { + ref.read(playControllerProvider).pause(); + } @override Widget build(BuildContext context) { final volumeValue = ref.watch(audioStateProvider.select((audio) => audio.volume)); val = volumeValue.toDouble(); + final isPlaying = ref.watch(playStateProvider); + return Column( // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, @@ -166,12 +174,15 @@ class VolumeBarState extends ConsumerState { padding: EdgeInsets.zero, color: AGLDemoColors.periwinkleColor, onPressed: () { - pause(); + if (isPlaying) { + pause(); + } else { + play(); + } }, - icon: const Icon( - Icons.pause, - size: 30, - )), + icon: isPlaying + ? const Icon(Icons.pause, size: 40) + : const Icon(Icons.play_arrow, size: 40)), ), ], ); -- cgit 1.2.3-korg