fix(mobile): back gesture in asset selection page from an album (#16449)

* fix(mobile): the page for adding photos to the album cannot be navigated back using gestures #16409

* First-time return gesture adds the feature to cancel all current selections

---------

Co-authored-by: ExceptionsOccur <yuyu.tao@foxmail.com>
This commit is contained in:
ExceptionsOccur 2025-03-13 14:07:05 +08:00 committed by GitHub
parent a1a61f19eb
commit 858d1e9d9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -542,7 +542,24 @@ class ImmichAssetGridViewState extends ConsumerState<ImmichAssetGridView> {
Widget build(BuildContext context) {
return PopScope(
canPop: !(widget.selectionActive && _selectedAssets.isNotEmpty),
onPopInvokedWithResult: (didPop, _) => !didPop ? _deselectAll() : null,
onPopInvokedWithResult: (didPop, _) {
if (didPop) {
return;
} else {
if (widget.preselectedAssets == null) {
Navigator.of(context).canPop() ? Navigator.of(context).pop() : null;
}
if (_selectedAssets.length != widget.preselectedAssets!.length &&
!widget.preselectedAssets!.containsAll(_selectedAssets)) {
{
_deselectAll();
return;
}
} else {
Navigator.of(context).canPop() ? Navigator.of(context).pop() : null;
}
}
},
child: Stack(
children: [
AssetDragRegion(