fix: only allow selection

This commit is contained in:
Prateek Sunal
2025-05-22 19:04:21 +05:30
parent 5a574c69d3
commit 06d260f40a
3 changed files with 6 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ class CollectionsFlexiGridViewWidget extends StatefulWidget {
final bool shouldShowCreateAlbum;
final SelectedAlbums? selectedAlbums;
final double scrollBottomSafeArea;
final bool onlyAllowSelection;
const CollectionsFlexiGridViewWidget(
this.collections, {
@@ -54,6 +55,7 @@ class CollectionsFlexiGridViewWidget extends StatefulWidget {
this.shouldShowCreateAlbum = false,
this.selectedAlbums,
this.scrollBottomSafeArea = 8,
this.onlyAllowSelection = false,
});
@override
@@ -153,13 +155,13 @@ class _CollectionsFlexiGridViewWidgetState
tag: widget.tag,
selectedAlbums: widget.selectedAlbums,
onTapCallback: (c) {
isAnyAlbumSelected
isAnyAlbumSelected || widget.onlyAllowSelection
? _toggleAlbumSelection(c)
: _navigateToCollectionPage(c);
},
onLongPressCallback: widget.enableSelectionMode
? (c) {
isAnyAlbumSelected
isAnyAlbumSelected || widget.onlyAllowSelection
? _navigateToCollectionPage(c)
: _toggleAlbumSelection(c);
}

View File

@@ -172,6 +172,7 @@ class _AlbumsWidgetSettingsState extends State<AlbumsWidgetSettings> {
selectedAlbums: _selectedAlbums,
shouldShowCreateAlbum: false,
enableSelectionMode: true,
onlyAllowSelection: true,
);
} else if (snapshot.hasError) {
return SliverToBoxAdapter(

View File

@@ -223,7 +223,7 @@ class PersonSearchExample extends StatelessWidget {
final bool isSelected = selectedPeople?.isPersonSelected(id) ?? false;
return GestureDetector(
onTap: isSelected
onTap: selectedPeople != null
? toggleSelection
: () {
RecentSearches().add(searchResult.name());
@@ -236,7 +236,6 @@ class PersonSearchExample extends StatelessWidget {
);
}
},
onLongPress: toggleSelection,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,