mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-13 09:20:31 -07:00
fix: Shuffle play videos (#345)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
aad081abae
commit
1a8765fbd6
1 changed files with 7 additions and 3 deletions
|
|
@ -574,8 +574,11 @@ class LibrarySearchNotifier extends StateNotifier<LibrarySearchModel> {
|
||||||
|
|
||||||
state = state.copyWith(fetchingItems: false);
|
state = state.copyWith(fetchingItems: false);
|
||||||
|
|
||||||
|
//Only try to load video items
|
||||||
|
itemsToPlay = itemsToPlay.where((element) => FladderItemType.playable.contains(element.type)).toList();
|
||||||
|
|
||||||
if (itemsToPlay.isNotEmpty) {
|
if (itemsToPlay.isNotEmpty) {
|
||||||
await itemsToPlay.playLibraryItems(context, ref);
|
await itemsToPlay.playLibraryItems(context, ref, shuffle: shuffle);
|
||||||
} else {
|
} else {
|
||||||
fladderSnackbar(context, title: context.localized.libraryFetchNoItemsFound);
|
fladderSnackbar(context, title: context.localized.libraryFetchNoItemsFound);
|
||||||
}
|
}
|
||||||
|
|
@ -648,11 +651,12 @@ class LibrarySearchNotifier extends StateNotifier<LibrarySearchModel> {
|
||||||
if (allItems.isNotEmpty) {
|
if (allItems.isNotEmpty) {
|
||||||
if (state.fetchingItems == true) {
|
if (state.fetchingItems == true) {
|
||||||
state = state.copyWith(fetchingItems: false);
|
state = state.copyWith(fetchingItems: false);
|
||||||
|
final newItemList = shuffle ? allItems.shuffled() : allItems;
|
||||||
await Navigator.of(context, rootNavigator: true).push(
|
await Navigator.of(context, rootNavigator: true).push(
|
||||||
PageTransition(
|
PageTransition(
|
||||||
child: PhotoViewerScreen(
|
child: PhotoViewerScreen(
|
||||||
items: allItems,
|
items: newItemList,
|
||||||
indexOfSelected: selected != null ? allItems.indexOf(selected) : 0,
|
indexOfSelected: selected != null ? newItemList.indexOf(selected) : 0,
|
||||||
),
|
),
|
||||||
type: PageTransitionType.fade),
|
type: PageTransitionType.fade),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue