bugfix: deleting an entry removed it from source, but sorted entries were not updated

This commit is contained in:
Thibault Deckers 2020-03-31 11:53:39 +09:00
parent dad5f080c2
commit 437417eb4e

View file

@ -70,7 +70,7 @@ class CollectionLens with ChangeNotifier {
List<ImageEntry> get sortedEntries { List<ImageEntry> get sortedEntries {
if (_sortedEntries == null) { if (_sortedEntries == null) {
_sortedEntries = List.unmodifiable(sections.entries.expand((e) => e.value)); _sortedEntries = List.of(sections.entries.expand((e) => e.value));
} }
return _sortedEntries; return _sortedEntries;
} }
@ -186,6 +186,7 @@ class CollectionLens with ChangeNotifier {
void onEntryRemoved(ImageEntry entry) { void onEntryRemoved(ImageEntry entry) {
// do not apply sort/group as section order change would surprise the user while browsing // do not apply sort/group as section order change would surprise the user while browsing
_filteredEntries.remove(entry); _filteredEntries.remove(entry);
_sortedEntries?.remove(entry);
sections.forEach((key, entries) => entries.remove(entry)); sections.forEach((key, entries) => entries.remove(entry));
notifyListeners(); notifyListeners();
} }