Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Minor fix

AmanRajSinghMouryae7b8b9f2c836
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index 0ed14382df..778ddcf878 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -57,7 +57,6 @@ class _ItemListViewState extends State<ItemListView> {
List<_ListItem> _sortedItems = [];
int _sortColumnIndex = 1;
bool _sortAscending = false;
- bool isAnyCollectionSelected = false;
@override
void initState() {
@@ -139,13 +138,9 @@ class _ItemListViewState extends State<ItemListView> {
await routeToPage(context, CollectionPage(collection: collection));
}
- Future<void> _toggleCollectionSelection(Collection collection) async {
- await HapticFeedback.lightImpact();
+ void _toggleCollectionSelection(Collection collection) {
+ HapticFeedback.lightImpact();
widget.selectedCollections!.toggleSelection(collection);
- setState(() {
- isAnyCollectionSelected =
- widget.selectedCollections!.collections.isNotEmpty;
- });
}
@override
@@ -172,24 +167,46 @@ class _ItemListViewState extends State<ItemListView> {
itemBuilder: (context, index) {
final item = _sortedItems[index];
final isLastItem = index == _sortedItems.length - 1;
- return ListItemWidget(
- item: item,
- collections: widget.collections,
- fileOverflowActions: widget.fileOverflowActions,
- collectionOverflowActions: widget.collectionOverflowActions,
- isLastItem: isLastItem,
- selectedCollections: widget.selectedCollections,
- onCollectionTap: (c) {
- isAnyCollectionSelected
- ? _toggleCollectionSelection(c)
- : _navigateToCollectionPage(c);
- },
- onCollectionLongPress: (c) {
- isAnyCollectionSelected
- ? _navigateToCollectionPage(c)
- : _toggleCollectionSelection(c);
- },
- );
+
+ if (widget.selectedCollections != null) {
+ return ListenableBuilder(
+ listenable: widget.selectedCollections!,
+ builder: (context, child) {
+ final isAnyCollectionSelected =
+ widget.selectedCollections!.hasSelections;
+
+ return ListItemWidget(
+ item: item,
+ collections: widget.collections,
+ fileOverflowActions: widget.fileOverflowActions,
+ collectionOverflowActions: widget.collectionOverflowActions,
+ isLastItem: isLastItem,
+ selectedCollections: widget.selectedCollections,
+ onCollectionTap: (c) {
+ isAnyCollectionSelected
+ ? _toggleCollectionSelection(c)
+ : _navigateToCollectionPage(c);
+ },
+ onCollectionLongPress: (c) {
+ isAnyCollectionSelected
+ ? _navigateToCollectionPage(c)
+ : _toggleCollectionSelection(c);
+ },
+ );
+ },
+ );
+ } else {
+ return ListItemWidget(
+ item: item,
+ collections: widget.collections,
+ fileOverflowActions: widget.fileOverflowActions,
+ collectionOverflowActions: widget.collectionOverflowActions,
+ isLastItem: isLastItem,
+ selectedCollections: widget.selectedCollections,
+ onCollectionTap: (c) => _navigateToCollectionPage(c),
+ onCollectionLongPress: (c) => _toggleCollectionSelection(c),
+ );
+ }
},
),
],
diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
index 6a24498081..63deb6769a 100644
--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
@@ -539,7 +539,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>
child: InkWell(
onTap: () {
widget.selectedCollections!.clearAll();
- setState(() {});
},
child: Padding(
padding: const EdgeInsets.symmetric(