mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix(player): shuffle button state resets after closing page #1657
This commit is contained in:
parent
9a0421ce38
commit
411115327d
@ -170,27 +170,26 @@ class PlayerControls extends HookConsumerWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
StreamBuilder<bool>(
|
Consumer(builder: (context, ref, _) {
|
||||||
stream: audioPlayer.shuffledStream,
|
final shuffled = ref
|
||||||
builder: (context, snapshot) {
|
.watch(audioPlayerProvider.select((s) => s.shuffled));
|
||||||
final shuffled = snapshot.data ?? false;
|
return IconButton(
|
||||||
return IconButton(
|
tooltip: shuffled
|
||||||
tooltip: shuffled
|
? context.l10n.unshuffle_playlist
|
||||||
? context.l10n.unshuffle_playlist
|
: context.l10n.shuffle_playlist,
|
||||||
: context.l10n.shuffle_playlist,
|
icon: const Icon(SpotubeIcons.shuffle),
|
||||||
icon: const Icon(SpotubeIcons.shuffle),
|
style: shuffled ? activeButtonStyle : buttonStyle,
|
||||||
style: shuffled ? activeButtonStyle : buttonStyle,
|
onPressed: isFetchingActiveTrack
|
||||||
onPressed: isFetchingActiveTrack
|
? null
|
||||||
? null
|
: () {
|
||||||
: () {
|
if (shuffled) {
|
||||||
if (shuffled) {
|
audioPlayer.setShuffle(false);
|
||||||
audioPlayer.setShuffle(false);
|
} else {
|
||||||
} else {
|
audioPlayer.setShuffle(true);
|
||||||
audioPlayer.setShuffle(true);
|
}
|
||||||
}
|
},
|
||||||
},
|
);
|
||||||
);
|
}),
|
||||||
}),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: context.l10n.previous_track,
|
tooltip: context.l10n.previous_track,
|
||||||
icon: const Icon(SpotubeIcons.skipBack),
|
icon: const Icon(SpotubeIcons.skipBack),
|
||||||
|
Loading…
Reference in New Issue
Block a user