Skip to content

Commit

Permalink
fix: shuffle doesn't move active track to top
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Oct 29, 2023
1 parent 58e5698 commit 4956bf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/services/audio_player/mk_state_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ class MkPlayerWithState extends Player {
if (shuffle) {
_tempMedias = _playlist!.medias;
final active = _playlist!.medias[_playlist!.index];
final newMedias = _playlist!.medias.toList()..shuffle();
final newMedias = _playlist!.medias.toList()
..shuffle()
..remove(active)
..insert(0, active);
playlist = _playlist!.copyWith(
medias: newMedias,
index: newMedias.indexOf(active),
Expand Down

0 comments on commit 4956bf3

Please sign in to comment.