fix(playlist_queue): load method not preserving the active track before filtering blacklisted tracks

This commit is contained in:
Kingkor Roy Tirtho 2023-03-07 11:10:16 +06:00
parent 6bc1d32a88
commit 42b3e111f8

View File

@ -412,10 +412,14 @@ class PlaylistQueueNotifier extends PersistedStateNotifier<PlaylistQueue?> {
} }
void load(Iterable<Track> tracks, {int active = 0}) { void load(Iterable<Track> tracks, {int active = 0}) {
final activeTrack = tracks.elementAt(active);
final filtered = Set.from(blacklist.filter(tracks));
state = PlaylistQueue( state = PlaylistQueue(
Set.from(blacklist.filter(tracks)), Set.from(blacklist.filter(tracks)),
tempTracks: {}, tempTracks: {},
active: active, active: filtered
.toList()
.indexWhere((element) => element.id == activeTrack.id),
); );
} }