Skip to content

Commit

Permalink
fix jmshrv#61 on artist page
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Oct 18, 2023
1 parent 56942bc commit 7b4383f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/components/ArtistScreen/artist_shuffle_button.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
Expand Down Expand Up @@ -61,10 +63,10 @@ class _ArtistShuffleButtonState extends State<ArtistShuffleButton> {
);
} else {
artistShuffleButtonFuture ??= _jellyfinApiHelper.getItems(
parentItem: widget.artist,
includeItemTypes: "Audio",
sortBy: 'PremiereDate,Album,SortName',
isGenres: false,
parentItem: widget.artist,
includeItemTypes: "Audio",
sortBy: 'PremiereDate,Album,SortName',
isGenres: false,
);

return FutureBuilder<List<BaseItemDto>?>(
Expand All @@ -76,7 +78,7 @@ class _ArtistShuffleButtonState extends State<ArtistShuffleButton> {
return IconButton(
onPressed: () async {
await _audioServiceHelper
.replaceQueueWithItem(itemList: items, shuffle: true);
.replaceQueueWithItem(itemList: items, shuffle: true, initialIndex: Random().nextInt(items.length));
},
icon: const Icon(Icons.shuffle),
);
Expand All @@ -89,4 +91,4 @@ class _ArtistShuffleButtonState extends State<ArtistShuffleButton> {
},
);
}
}
}

0 comments on commit 7b4383f

Please sign in to comment.