diff --git a/lib/ui/viewer/gallery/component/group/lazy_group_gallery.dart b/lib/ui/viewer/gallery/component/group/lazy_group_gallery.dart index 23d5df9d0..1b70f5aae 100644 --- a/lib/ui/viewer/gallery/component/group/lazy_group_gallery.dart +++ b/lib/ui/viewer/gallery/component/group/lazy_group_gallery.dart @@ -57,6 +57,7 @@ class _LazyGroupGalleryState extends State { late Logger _logger; late List _files; + late Set _filesAsSet; late StreamSubscription? _reloadEventSubscription; late StreamSubscription _currentIndexSubscription; bool? _shouldRender; @@ -75,6 +76,7 @@ class _LazyGroupGalleryState extends State { _logger = Logger("LazyLoading_${widget.logTag}"); _shouldRender = true; _files = widget.files; + _filesAsSet = _files.toSet(); _reloadEventSubscription = widget.reloadEvent?.listen((e) => _onReload(e)); _currentIndexSubscription = @@ -204,7 +206,7 @@ class _LazyGroupGalleryState extends State { ), onTap: () { widget.selectedFiles?.toggleGroupSelection( - _files.toSet(), + _filesAsSet, ); }, ); @@ -234,7 +236,7 @@ class _LazyGroupGalleryState extends State { void _selectedFilesListener() { if (widget.selectedFiles == null) return; _areAllFromGroupSelectedNotifer.value = - widget.selectedFiles!.files.containsAll(widget.files.toSet()); + widget.selectedFiles!.files.containsAll(_filesAsSet); //Can remove this if we decide to show select all by default for all galleries if (widget.selectedFiles!.files.isEmpty && !widget.showSelectAllByDefault) {