From 3a30f9911baa601d679c8455ff0f4e7c56a743de Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 14 May 2020 14:36:16 +0900 Subject: [PATCH] fixed removing items from source --- lib/model/collection_source.dart | 2 +- lib/widgets/album/app_bar.dart | 2 +- lib/widgets/album/search/search_delegate.dart | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/model/collection_source.dart b/lib/model/collection_source.dart index 9aece290b..72ce9f1c2 100644 --- a/lib/model/collection_source.dart +++ b/lib/model/collection_source.dart @@ -143,7 +143,7 @@ class CollectionSource { } void removeEntries(Iterable entries) async { - _rawEntries.remove(entries); + _rawEntries.removeWhere(entries.contains); eventBus.fire(EntryRemovedEvent(entries)); } diff --git a/lib/widgets/album/app_bar.dart b/lib/widgets/album/app_bar.dart index bc17598cc..4df0e8abf 100644 --- a/lib/widgets/album/app_bar.dart +++ b/lib/widgets/album/app_bar.dart @@ -292,7 +292,7 @@ class _CollectionAppBarState extends State with SingleTickerPr Future _goToSearch() async { final filter = await showSearch( context: context, - delegate: ImageSearchDelegate(collection), + delegate: ImageSearchDelegate(collection.source), ); collection.addFilter(filter); } diff --git a/lib/widgets/album/search/search_delegate.dart b/lib/widgets/album/search/search_delegate.dart index c53d7f4c0..994f5cb22 100644 --- a/lib/widgets/album/search/search_delegate.dart +++ b/lib/widgets/album/search/search_delegate.dart @@ -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 { - final CollectionLens collection; + final CollectionSource source; final ValueNotifier expandedSectionNotifier = ValueNotifier(null); - ImageSearchDelegate(this.collection); + ImageSearchDelegate(this.source); @override ThemeData appBarTheme(BuildContext context) { @@ -52,7 +51,6 @@ class ImageSearchDelegate extends SearchDelegate { @override Widget buildSuggestions(BuildContext context) { - final source = collection.source; final upQuery = query.trim().toUpperCase(); final containQuery = (String s) => s.toUpperCase().contains(upQuery); return SafeArea(