fixed collection entries when filters include/exclude renamed entry

This commit is contained in:
Thibault Deckers 2021-06-07 14:40:03 +09:00
parent 0982726e4a
commit 56c2070bfa
3 changed files with 6 additions and 3 deletions

View file

@ -153,6 +153,7 @@ abstract class CollectionSource with SourceBase, AlbumMixin, LocationMixin, TagM
await _moveEntry(entry, newFields);
entry.metadataChangeNotifier.notifyListeners();
eventBus.fire(EntryMovedEvent({entry}));
return true;
}
@ -312,7 +313,7 @@ class EntryRemovedEvent {
}
class EntryMovedEvent {
final Iterable<AvesEntry> entries;
final Set<AvesEntry> entries;
const EntryMovedEvent(this.entries);
}

View file

@ -76,6 +76,7 @@ class InteractiveThumbnail extends StatelessWidget {
id: collection.id,
listenToSource: false,
);
assert(viewerCollection.entryCount == collection.entryCount);
return EntryViewerPage(
collection: viewerCollection,
initialEntry: entry,

View file

@ -78,11 +78,12 @@ class _EntryViewerStackState extends State<EntryViewerStack> with SingleTickerPr
@override
void initState() {
super.initState();
final entry = widget.initialEntry;
// make sure initial entry is actually among the filtered collection entries
final entry = entries.contains(widget.initialEntry) ? widget.initialEntry : entries.firstOrNull;
// opening hero, with viewer as target
_heroInfoNotifier.value = HeroInfo(collection?.id, entry);
_entryNotifier.value = entry;
_currentHorizontalPage = max(0, entries.indexOf(entry));
_currentHorizontalPage = max(0, entry != null ? entries.indexOf(entry) : -1);
_currentVerticalPage = ValueNotifier(imagePage);
_horizontalPager = PageController(initialPage: _currentHorizontalPage);
_verticalPager = PageController(initialPage: _currentVerticalPage.value)..addListener(_onVerticalPageControllerChange);