-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: sort tracks in playlist, album and local tracks
- Loading branch information
Showing
7 changed files
with
171 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:spotube/components/Library/UserLocalTracks.dart'; | ||
|
||
class SortTracksDropdown extends StatelessWidget { | ||
final SortBy? value; | ||
final void Function(SortBy)? onChanged; | ||
const SortTracksDropdown({ | ||
this.onChanged, | ||
this.value, | ||
Key? key, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return PopupMenuButton<SortBy>( | ||
itemBuilder: (context) { | ||
return [ | ||
PopupMenuItem( | ||
value: SortBy.none, | ||
enabled: value != SortBy.none, | ||
child: const Text("None"), | ||
), | ||
PopupMenuItem( | ||
value: SortBy.ascending, | ||
enabled: value != SortBy.ascending, | ||
child: const Text("Sort by A-Z"), | ||
), | ||
PopupMenuItem( | ||
value: SortBy.descending, | ||
enabled: value != SortBy.descending, | ||
child: const Text("Sort by Z-A"), | ||
), | ||
PopupMenuItem( | ||
value: SortBy.dateAdded, | ||
enabled: value != SortBy.dateAdded, | ||
child: const Text("Sort by Date"), | ||
), | ||
PopupMenuItem( | ||
value: SortBy.artist, | ||
enabled: value != SortBy.artist, | ||
child: const Text("Sort by Artist"), | ||
), | ||
PopupMenuItem( | ||
value: SortBy.album, | ||
enabled: value != SortBy.album, | ||
child: const Text("Sort by Album"), | ||
), | ||
]; | ||
}, | ||
onSelected: onChanged, | ||
icon: const Icon(Icons.sort_rounded), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.