forked from Cutlery/immich
chore: rename popRoute to now refactored maybePop
This commit is contained in:
parent
2a8e3e4925
commit
85b72d1d74
@ -275,7 +275,7 @@ class AlbumViewerAppbar extends HookConsumerWidget
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
onPressed: () async => await context.popRoute(),
|
onPressed: () async => await context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
splashRadius: 25,
|
splashRadius: 25,
|
||||||
);
|
);
|
||||||
|
@ -184,7 +184,7 @@ class AlbumOptionsPage extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
||||||
onPressed: () => context.popRoute(null),
|
onPressed: () => context.maybePop(null),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text("translated_text_options".tr()),
|
title: Text("translated_text_options".tr()),
|
||||||
|
@ -216,7 +216,7 @@ class CreateAlbumPage extends HookConsumerWidget {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
selectedAssets.value = {};
|
selectedAssets.value = {};
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.close_rounded),
|
icon: const Icon(Icons.close_rounded),
|
||||||
),
|
),
|
||||||
|
@ -23,7 +23,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
final sharedUsersList = useState<Set<User>>({});
|
final sharedUsersList = useState<Set<User>>({});
|
||||||
|
|
||||||
addNewUsersHandler() {
|
addNewUsersHandler() {
|
||||||
context.popRoute(sharedUsersList.value.map((e) => e.id).toList());
|
context.maybePop(sharedUsersList.value.map((e) => e.id).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTileIcon(User user) {
|
buildTileIcon(User user) {
|
||||||
@ -124,7 +124,7 @@ class SelectAdditionalUserForSharingPage extends HookConsumerWidget {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.close_rounded),
|
icon: const Icon(Icons.close_rounded),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.popRoute(null);
|
context.maybePop(null);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -36,7 +36,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
await ref.watch(sharedAlbumProvider.notifier).getAllSharedAlbums();
|
await ref.watch(sharedAlbumProvider.notifier).getAllSharedAlbums();
|
||||||
// ref.watch(assetSelectionProvider.notifier).removeAll();
|
// ref.watch(assetSelectionProvider.notifier).removeAll();
|
||||||
ref.watch(albumTitleProvider.notifier).clearAlbumTitle();
|
ref.watch(albumTitleProvider.notifier).clearAlbumTitle();
|
||||||
context.popRoute(true);
|
context.maybePop(true);
|
||||||
context
|
context
|
||||||
.navigateTo(const TabControllerRoute(children: [SharingRoute()]));
|
.navigateTo(const TabControllerRoute(children: [SharingRoute()]));
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.close_rounded),
|
icon: const Icon(Icons.close_rounded),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -17,7 +17,7 @@ class ArchivePage extends HookConsumerWidget {
|
|||||||
final count = archivedAssets.value?.totalAssets.toString() ?? "?";
|
final count = archivedAssets.value?.totalAssets.toString() ?? "?";
|
||||||
return AppBar(
|
return AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
@ -120,7 +120,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
|||||||
if (isDeleted && isParent) {
|
if (isDeleted && isParent) {
|
||||||
if (totalAssets == 1) {
|
if (totalAssets == 1) {
|
||||||
// Handle only one asset
|
// Handle only one asset
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
} else {
|
} else {
|
||||||
// Go to next page otherwise
|
// Go to next page otherwise
|
||||||
controller.nextPage(
|
controller.nextPage(
|
||||||
@ -191,7 +191,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
|||||||
stackElements.elementAt(stackIndex),
|
stackElements.elementAt(stackIndex),
|
||||||
);
|
);
|
||||||
ctx.pop();
|
ctx.pop();
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"viewer_stack_use_as_main_asset",
|
"viewer_stack_use_as_main_asset",
|
||||||
@ -218,7 +218,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
|||||||
childrenToRemove: [asset],
|
childrenToRemove: [asset],
|
||||||
);
|
);
|
||||||
ctx.pop();
|
ctx.pop();
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
} else {
|
} else {
|
||||||
await ref.read(assetStackServiceProvider).updateStack(
|
await ref.read(assetStackServiceProvider).updateStack(
|
||||||
asset,
|
asset,
|
||||||
@ -246,7 +246,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
|||||||
childrenToRemove: stack,
|
childrenToRemove: stack,
|
||||||
);
|
);
|
||||||
ctx.pop();
|
ctx.pop();
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
title: const Text(
|
title: const Text(
|
||||||
"viewer_unstack",
|
"viewer_unstack",
|
||||||
@ -277,7 +277,7 @@ class BottomGalleryBar extends ConsumerWidget {
|
|||||||
handleArchive() {
|
handleArchive() {
|
||||||
ref.read(assetProvider.notifier).toggleArchive([asset]);
|
ref.read(assetProvider.notifier).toggleArchive([asset]);
|
||||||
if (isParent) {
|
if (isParent) {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeAssetFromStack();
|
removeAssetFromStack();
|
||||||
|
@ -147,7 +147,7 @@ class TopControlAppBar extends HookConsumerWidget {
|
|||||||
Widget buildBackButton() {
|
Widget buildBackButton() {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.arrow_back_ios_new_rounded,
|
Icons.arrow_back_ios_new_rounded,
|
||||||
|
@ -173,7 +173,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
final ratio = d.dy / max(d.dx.abs(), 1);
|
final ratio = d.dy / max(d.dx.abs(), 1);
|
||||||
if (d.dy > sensitivity && ratio > ratioThreshold) {
|
if (d.dy > sensitivity && ratio > ratioThreshold) {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
} else if (d.dy < -sensitivity && ratio < -ratioThreshold) {
|
} else if (d.dy < -sensitivity && ratio < -ratioThreshold) {
|
||||||
showInfo();
|
showInfo();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class AlbumPreviewPage extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
icon: const Icon(Icons.arrow_back_ios_new_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -191,7 +191,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
title: const Text(
|
title: const Text(
|
||||||
|
@ -260,7 +260,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
ref.watch(websocketProvider.notifier).listenUploadEvent();
|
ref.watch(websocketProvider.notifier).listenUploadEvent();
|
||||||
context.popRoute(true);
|
context.maybePop(true);
|
||||||
},
|
},
|
||||||
splashRadius: 24,
|
splashRadius: 24,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
|
@ -13,7 +13,7 @@ class BackupOptionsPage extends StatelessWidget {
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
title: const Text("backup_options_page_title").tr(),
|
title: const Text("backup_options_page_title").tr(),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(true),
|
onPressed: () => context.maybePop(true),
|
||||||
splashRadius: 24,
|
splashRadius: 24,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.arrow_back_ios_rounded,
|
Icons.arrow_back_ios_rounded,
|
||||||
|
@ -23,7 +23,7 @@ class FailedBackupStatusPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.popRoute(true);
|
context.maybePop(true);
|
||||||
},
|
},
|
||||||
splashRadius: 24,
|
splashRadius: 24,
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
|
@ -15,7 +15,7 @@ class FavoritesPage extends HookConsumerWidget {
|
|||||||
AppBar buildAppBar() {
|
AppBar buildAppBar() {
|
||||||
return AppBar(
|
return AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
@ -41,7 +41,7 @@ class MapLocationPickerPage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onClose([LatLng? selected]) {
|
void onClose([LatLng? selected]) {
|
||||||
context.popRoute(selected);
|
context.maybePop(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getCurrentLocation() async {
|
Future<void> getCurrentLocation() async {
|
||||||
|
@ -50,7 +50,7 @@ class _NonSelectionRow extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: const CircleBorder(),
|
shape: const CircleBorder(),
|
||||||
),
|
),
|
||||||
|
@ -152,7 +152,7 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
final offset = notification.metrics.pixels;
|
final offset = notification.metrics.pixels;
|
||||||
if (isEpiloguePage &&
|
if (isEpiloguePage &&
|
||||||
(offset > notification.metrics.maxScrollExtent + 150)) {
|
(offset > notification.metrics.maxScrollExtent + 150)) {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ class MemoryPage extends HookConsumerWidget {
|
|||||||
// auto_route doesn't invoke pop scope, so
|
// auto_route doesn't invoke pop scope, so
|
||||||
// turn off full screen mode here
|
// turn off full screen mode here
|
||||||
// https://github.com/Milad-Akarie/auto_route_library/issues/1799
|
// https://github.com/Milad-Akarie/auto_route_library/issues/1799
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
SystemChrome.setEnabledSystemUIMode(
|
SystemChrome.setEnabledSystemUIMode(
|
||||||
SystemUiMode.edgeToEdge,
|
SystemUiMode.edgeToEdge,
|
||||||
);
|
);
|
||||||
|
@ -176,7 +176,7 @@ class PermissionOnboardingPage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('permission_onboarding_back').tr(),
|
child: const Text('permission_onboarding_back').tr(),
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -18,7 +18,7 @@ class AllMotionPhotosPage extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('motion_photos_page_title').tr(),
|
title: const Text('motion_photos_page_title').tr(),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -15,7 +15,7 @@ class AllVideosPage extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('all_videos_page_title').tr(),
|
title: const Text('all_videos_page_title').tr(),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -23,7 +23,7 @@ class CuratedLocationPage extends HookConsumerWidget {
|
|||||||
'curated_location_page_title',
|
'curated_location_page_title',
|
||||||
).tr(),
|
).tr(),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -102,7 +102,7 @@ class PersonResultPage extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(name.value),
|
title: Text(name.value),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -18,7 +18,7 @@ class RecentlyAddedPage extends HookConsumerWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('recently_added_page_title').tr(),
|
title: const Text('recently_added_page_title').tr(),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () => context.popRoute(),
|
onPressed: () => context.maybePop(),
|
||||||
icon: const Icon(Icons.arrow_back_ios_rounded),
|
icon: const Icon(Icons.arrow_back_ios_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -319,7 +319,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
|||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"share_done",
|
"share_done",
|
||||||
@ -422,7 +422,7 @@ class SharedLinkEditPage extends HookConsumerWidget {
|
|||||||
changeExpiry: changeExpiry,
|
changeExpiry: changeExpiry,
|
||||||
);
|
);
|
||||||
ref.invalidate(sharedLinksStateProvider);
|
ref.invalidate(sharedLinksStateProvider);
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -143,7 +143,7 @@ class TrashPage extends HookConsumerWidget {
|
|||||||
return AppBar(
|
return AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: !selectionEnabledHook.value
|
onPressed: !selectionEnabledHook.value
|
||||||
? () => context.popRoute()
|
? () => context.maybePop()
|
||||||
: () {
|
: () {
|
||||||
selectionEnabledHook.value = false;
|
selectionEnabledHook.value = false;
|
||||||
selection.value = {};
|
selection.value = {};
|
||||||
|
@ -20,7 +20,6 @@ import 'package:immich_mobile/modules/album/views/select_user_for_sharing_page.d
|
|||||||
import 'package:immich_mobile/modules/album/views/sharing_page.dart';
|
import 'package:immich_mobile/modules/album/views/sharing_page.dart';
|
||||||
import 'package:immich_mobile/modules/archive/views/archive_page.dart';
|
import 'package:immich_mobile/modules/archive/views/archive_page.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/views/gallery_viewer.dart';
|
import 'package:immich_mobile/modules/asset_viewer/views/gallery_viewer.dart';
|
||||||
import 'package:immich_mobile/modules/asset_viewer/views/video_viewer_page.dart';
|
|
||||||
import 'package:immich_mobile/modules/backup/views/album_preview_page.dart';
|
import 'package:immich_mobile/modules/backup/views/album_preview_page.dart';
|
||||||
import 'package:immich_mobile/modules/backup/views/backup_album_selection_page.dart';
|
import 'package:immich_mobile/modules/backup/views/backup_album_selection_page.dart';
|
||||||
import 'package:immich_mobile/modules/backup/views/backup_controller_page.dart';
|
import 'package:immich_mobile/modules/backup/views/backup_controller_page.dart';
|
||||||
|
@ -79,7 +79,7 @@ class _LocationPicker extends HookWidget {
|
|||||||
).tr(),
|
).tr(),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => context.popRoute(latlng),
|
onPressed: () => context.maybePop(latlng),
|
||||||
child: Text(
|
child: Text(
|
||||||
"action_common_update",
|
"action_common_update",
|
||||||
style: context.textTheme.bodyMedium?.copyWith(
|
style: context.textTheme.bodyMedium?.copyWith(
|
||||||
|
@ -105,7 +105,7 @@ class AppLogPage extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.popRoute();
|
context.maybePop();
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.arrow_back_ios_new_rounded,
|
Icons.arrow_back_ios_new_rounded,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user