From 7b4383f2b0b5d60c322a180b20df281c6a6fa5b7 Mon Sep 17 00:00:00 2001 From: Chaphasilor Date: Wed, 18 Oct 2023 23:43:12 +0200 Subject: [PATCH] fix #61 on artist page --- .../ArtistScreen/artist_shuffle_button.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/components/ArtistScreen/artist_shuffle_button.dart b/lib/components/ArtistScreen/artist_shuffle_button.dart index da86da726..95af6d867 100644 --- a/lib/components/ArtistScreen/artist_shuffle_button.dart +++ b/lib/components/ArtistScreen/artist_shuffle_button.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:hive/hive.dart'; @@ -61,10 +63,10 @@ class _ArtistShuffleButtonState extends State { ); } 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?>( @@ -76,7 +78,7 @@ class _ArtistShuffleButtonState extends State { 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), ); @@ -89,4 +91,4 @@ class _ArtistShuffleButtonState extends State { }, ); } -} \ No newline at end of file +}