From d5f6584e1d9fc9920ae0b7f3741c1a3de13be314 Mon Sep 17 00:00:00 2001 From: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:45:04 +0000 Subject: [PATCH] fix(mobile): use zoomedpagetransition for galleryvieweroute (#5495) Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> --- .../asset_viewer/views/gallery_viewer.dart | 1 + .../search/services/person.service.g.dart | Bin 907 -> 907 bytes .../providers/app_settings.provider.g.dart | Bin 946 -> 946 bytes .../routing/custom_transition_builders.dart | 31 ++++++++++++++++++ mobile/lib/routing/router.dart | 4 ++- mobile/lib/routing/router.gr.dart | 5 ++- .../lib/shared/providers/api.provider.g.dart | Bin 847 -> 847 bytes mobile/lib/utils/immich_app_theme.dart | 6 ++-- 8 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 mobile/lib/routing/custom_transition_builders.dart diff --git a/mobile/lib/modules/asset_viewer/views/gallery_viewer.dart b/mobile/lib/modules/asset_viewer/views/gallery_viewer.dart index 9948ab4cc9..558a350c1f 100644 --- a/mobile/lib/modules/asset_viewer/views/gallery_viewer.dart +++ b/mobile/lib/modules/asset_viewer/views/gallery_viewer.dart @@ -795,6 +795,7 @@ class GalleryViewerPage extends HookConsumerWidget { tag: isFromDto ? '${a.remoteId}-$heroOffset' : a.id + heroOffset, + transitionOnUserGestures: true, ), filterQuality: FilterQuality.high, tightMode: true, diff --git a/mobile/lib/modules/search/services/person.service.g.dart b/mobile/lib/modules/search/services/person.service.g.dart index e66c6c2aa654ee61efffd2d4574ccaa8ef3dce35..b80b439d1d3b9132c2c98f30fe2d4e0ef150377d 100644 GIT binary patch delta 53 zcmeBX?`Gd1&!~}{l4_7>nQUNWnPO;`l9G~Yl$es7Vrr3?YLRSVW}K8}k(_LpmYTBJ IozaB}0Ir%40RR91 delta 53 zcmeBX?`Gd1&!}OXmTa7ooMvKXV4Q58WNMmhkdm61YG#^dY?)@3Y-DJZnwn^0X_U0t IozaB}0Gr$o3;+NC diff --git a/mobile/lib/modules/settings/providers/app_settings.provider.g.dart b/mobile/lib/modules/settings/providers/app_settings.provider.g.dart index 692dcf7c055cb8adb9275c86115f3d664000fd7a..a9954382a7dfe12cee680c71b14642a820577b1f 100644 GIT binary patch delta 53 zcmdnQzKMNmR0E3qf0RR91 delta 53 zcmdnQzKMNmR0D@KyS^xk5 diff --git a/mobile/lib/routing/custom_transition_builders.dart b/mobile/lib/routing/custom_transition_builders.dart new file mode 100644 index 0000000000..610edd8185 --- /dev/null +++ b/mobile/lib/routing/custom_transition_builders.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +class CustomTransitionsBuilders { + const CustomTransitionsBuilders._(); + + static const ZoomPageTransitionsBuilder zoomPageTransitionsBuilder = + ZoomPageTransitionsBuilder(); + + static const RouteTransitionsBuilder zoomedPage = _zoomedPage; + + static Widget _zoomedPage( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + return zoomPageTransitionsBuilder.buildTransitions( + // Empty PageRoute<> object, only used to pass allowSnapshotting to ZoomPageTransitionsBuilder + PageRouteBuilder( + allowSnapshotting: true, + fullscreenDialog: false, + pageBuilder: (context, animation, secondaryAnimation) => + const SizedBox.shrink(), + ), + context, + animation, + secondaryAnimation, + child, + ); + } +} diff --git a/mobile/lib/routing/router.dart b/mobile/lib/routing/router.dart index dfb87a4ae5..67407b7e26 100644 --- a/mobile/lib/routing/router.dart +++ b/mobile/lib/routing/router.dart @@ -43,6 +43,7 @@ import 'package:immich_mobile/modules/search/views/search_page.dart'; import 'package:immich_mobile/modules/search/views/search_result_page.dart'; import 'package:immich_mobile/modules/settings/views/settings_page.dart'; import 'package:immich_mobile/routing/auth_guard.dart'; +import 'package:immich_mobile/routing/custom_transition_builders.dart'; import 'package:immich_mobile/routing/duplicate_guard.dart'; import 'package:immich_mobile/routing/backup_permission_guard.dart'; import 'package:immich_mobile/shared/models/asset.dart'; @@ -86,9 +87,10 @@ part 'router.gr.dart'; ], transitionsBuilder: TransitionsBuilders.fadeIn, ), - AutoRoute( + CustomRoute( page: GalleryViewerPage, guards: [AuthGuard, DuplicateGuard], + transitionsBuilder: CustomTransitionsBuilders.zoomedPage, ), AutoRoute(page: VideoViewerPage, guards: [AuthGuard, DuplicateGuard]), AutoRoute( diff --git a/mobile/lib/routing/router.gr.dart b/mobile/lib/routing/router.gr.dart index 583aa11251..d54f8aeda1 100644 --- a/mobile/lib/routing/router.gr.dart +++ b/mobile/lib/routing/router.gr.dart @@ -63,7 +63,7 @@ class _$AppRouter extends RootStackRouter { }, GalleryViewerRoute.name: (routeData) { final args = routeData.argsAs(); - return MaterialPageX( + return CustomPage( routeData: routeData, child: GalleryViewerPage( key: args.key, @@ -75,6 +75,9 @@ class _$AppRouter extends RootStackRouter { isOwner: args.isOwner, sharedAlbumId: args.sharedAlbumId, ), + transitionsBuilder: CustomTransitionsBuilders.zoomedPage, + opaque: true, + barrierDismissible: false, ); }, VideoViewerRoute.name: (routeData) { diff --git a/mobile/lib/shared/providers/api.provider.g.dart b/mobile/lib/shared/providers/api.provider.g.dart index 4bc7e93d1c1c8f1387cee3e07aeac2561a75e84d..421d554314a98c2c88b8101223bca0ec48bc27c5 100644 GIT binary patch delta 53 zcmX@lcAjm66r+Y|l0{N#N=lN6iG{JDSyD=3s%fgRrI~SBnz^}|fuWhHvALnCxsl~& ICq`Z-0IEO^MgRZ+ delta 53 zcmX@lcAjm66r+ZLadJ|Mv9Y0vd7`<2sYQyZnW4F9s;RM2VzP;Os$pWHiG`^}vRTSz ICq`Z-0Fh=6E&u=k diff --git a/mobile/lib/utils/immich_app_theme.dart b/mobile/lib/utils/immich_app_theme.dart index 4313da60f9..e2ed6cd56c 100644 --- a/mobile/lib/utils/immich_app_theme.dart +++ b/mobile/lib/utils/immich_app_theme.dart @@ -20,7 +20,7 @@ final immichThemeProvider = StateProvider((ref) { } }); -ThemeData base = ThemeData( +final ThemeData base = ThemeData( chipTheme: const ChipThemeData( side: BorderSide.none, ), @@ -30,7 +30,7 @@ ThemeData base = ThemeData( ), ); -ThemeData immichLightTheme = ThemeData( +final ThemeData immichLightTheme = ThemeData( useMaterial3: true, brightness: Brightness.light, primarySwatch: Colors.indigo, @@ -153,7 +153,7 @@ ThemeData immichLightTheme = ThemeData( ), ); -ThemeData immichDarkTheme = ThemeData( +final ThemeData immichDarkTheme = ThemeData( useMaterial3: true, brightness: Brightness.dark, primarySwatch: Colors.indigo,