fix(mobile): use zoomedpagetransition for galleryvieweroute (#5495)

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2023-12-05 15:45:04 +00:00 committed by GitHub
parent 7702560b12
commit d5f6584e1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 8 deletions

View file

@ -795,6 +795,7 @@ class GalleryViewerPage extends HookConsumerWidget {
tag: isFromDto
? '${a.remoteId}-$heroOffset'
: a.id + heroOffset,
transitionOnUserGestures: true,
),
filterQuality: FilterQuality.high,
tightMode: true,

View file

@ -6,7 +6,7 @@ part of 'person.service.dart';
// RiverpodGenerator
// **************************************************************************
String _$personServiceHash() => r'3fc3dcf4603c7b55c0deae65f39f6c212eea492b';
String _$personServiceHash() => r'cde0a9c029d16ddde2adcd58ae8c863bf8cc1fed';
/// See also [personService].
@ProviderFor(personService)

View file

@ -7,7 +7,7 @@ part of 'app_settings.provider.dart';
// **************************************************************************
String _$appSettingsServiceHash() =>
r'957a65af6967701112f3076b507f9738fec4b7be';
r'45ea609a91d250290431a7a08a14d16b37c7515d';
/// See also [appSettingsService].
@ProviderFor(appSettingsService)

View file

@ -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<double> animation,
Animation<double> 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,
);
}
}

View file

@ -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(

View file

@ -63,7 +63,7 @@ class _$AppRouter extends RootStackRouter {
},
GalleryViewerRoute.name: (routeData) {
final args = routeData.argsAs<GalleryViewerRouteArgs>();
return MaterialPageX<dynamic>(
return CustomPage<dynamic>(
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) {

View file

@ -6,7 +6,7 @@ part of 'api.provider.dart';
// RiverpodGenerator
// **************************************************************************
String _$apiServiceHash() => r'03cbd33147a7058d56175e532ac47e1aa4858c6d';
String _$apiServiceHash() => r'5b8beddb448316bdae5e3963ff77601653715729';
/// See also [apiService].
@ProviderFor(apiService)

View file

@ -20,7 +20,7 @@ final immichThemeProvider = StateProvider<ThemeMode>((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,