Skip to content

Commit

Permalink
fix(play_overlay): show progress indicator on song loading
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Mar 7, 2023
1 parent 42b3e11 commit 7803a48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
8 changes: 0 additions & 8 deletions lib/collections/intents.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ class PlayPauseAction extends Action<PlayPauseIntent> {
if (playlist == null) {
return null;
} else if (!PlaylistQueueNotifier.isPlaying) {
// if (playlist.activeTrack is SpotubeTrack &&
// (playlist.activeTrack as SpotubeTrack).ytUri.startsWith("http")) {
// final track =
// Track.fromJson((playlist.activeTrack as SpotubeTrack).toJson());

// await playlistNotifier.play(track);
// } else {
// }
await playlistNotifier.play();
} else {
await playlistNotifier.pause();
Expand Down
19 changes: 13 additions & 6 deletions lib/components/player/player_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PlayerOverlay extends HookConsumerWidget {
PlaylistQueueNotifier.provider.select((s) => s != null),
);
final playlistNotifier = ref.watch(PlaylistQueueNotifier.notifier);
final playlist = ref.watch(PlaylistQueueNotifier.provider);
final playing = useStream(PlaylistQueueNotifier.playing).data ??
PlaylistQueueNotifier.isPlaying;

Expand Down Expand Up @@ -87,12 +88,18 @@ class PlayerOverlay extends HookConsumerWidget {
Consumer(
builder: (context, ref, _) {
return IconButton(
icon: Icon(
playing
? SpotubeIcons.pause
: SpotubeIcons.play,
color: paletteColor.bodyTextColor,
),
icon: playlist?.isLoading == true
? const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator(),
)
: Icon(
playing
? SpotubeIcons.pause
: SpotubeIcons.play,
color: paletteColor.bodyTextColor,
),
onPressed: Actions.handler<PlayPauseIntent>(
context,
PlayPauseIntent(ref),
Expand Down

0 comments on commit 7803a48

Please sign in to comment.