File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ class _UserSongsPageState extends State<UserSongsPage> {
189189 runSpacing: 8 ,
190190 children: [
191191 if (songsLength > 0 ) _buildPlayButton (primaryColor, title),
192+ if (songsLength > 0 ) _buildShufflePlayButton (primaryColor),
192193 if (isRecentlyPlayed && songsLength > 0 )
193194 _buildClearRecentsButton (primaryColor),
194195 ],
@@ -276,6 +277,29 @@ class _UserSongsPageState extends State<UserSongsPage> {
276277 );
277278 }
278279
280+ Widget _buildShufflePlayButton (Color primaryColor) {
281+ return IconButton .filledTonal (
282+ icon: Icon (FluentIcons .arrow_shuffle_24_filled, color: primaryColor),
283+ iconSize: 24 ,
284+ tooltip: 'Shuffle play' ,
285+ onPressed: () async {
286+ final songsList = getSongsList (widget.page);
287+ if (songsList.isEmpty) return ;
288+
289+ final shuffledSongs = List <Map >.from (songsList.whereType <Map >());
290+ if (shuffledSongs.isEmpty) return ;
291+
292+ shuffledSongs.shuffle ();
293+
294+ await audioHandler.addPlaylistToQueue (
295+ shuffledSongs,
296+ replace: true ,
297+ startIndex: 0 ,
298+ );
299+ },
300+ );
301+ }
302+
279303 Widget _buildClearRecentsButton (Color primaryColor) {
280304 return IconButton .filledTonal (
281305 icon: Icon (FluentIcons .delete_24_regular, color: primaryColor),
You can’t perform that action at this time.
0 commit comments