fixed removing items from source

This commit is contained in:
Thibault Deckers 2020-05-14 14:36:16 +09:00
parent 7a4e5dd85d
commit 3a30f9911b
3 changed files with 4 additions and 6 deletions

View file

@ -143,7 +143,7 @@ class CollectionSource {
}
void removeEntries(Iterable<ImageEntry> entries) async {
_rawEntries.remove(entries);
_rawEntries.removeWhere(entries.contains);
eventBus.fire(EntryRemovedEvent(entries));
}

View file

@ -292,7 +292,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
Future<void> _goToSearch() async {
final filter = await showSearch(
context: context,
delegate: ImageSearchDelegate(collection),
delegate: ImageSearchDelegate(collection.source),
);
collection.addFilter(filter);
}

View file

@ -1,4 +1,3 @@
import 'package:aves/model/collection_lens.dart';
import 'package:aves/model/collection_source.dart';
import 'package:aves/model/filters/album.dart';
import 'package:aves/model/filters/favourite.dart';
@ -13,10 +12,10 @@ import 'package:aves/widgets/common/icons.dart';
import 'package:flutter/material.dart';
class ImageSearchDelegate extends SearchDelegate<CollectionFilter> {
final CollectionLens collection;
final CollectionSource source;
final ValueNotifier<String> expandedSectionNotifier = ValueNotifier(null);
ImageSearchDelegate(this.collection);
ImageSearchDelegate(this.source);
@override
ThemeData appBarTheme(BuildContext context) {
@ -52,7 +51,6 @@ class ImageSearchDelegate extends SearchDelegate<CollectionFilter> {
@override
Widget buildSuggestions(BuildContext context) {
final source = collection.source;
final upQuery = query.trim().toUpperCase();
final containQuery = (String s) => s.toUpperCase().contains(upQuery);
return SafeArea(