From 34b881978b0d05bb0a2bd1dae30954b9ddfc7124 Mon Sep 17 00:00:00 2001 From: Alex Garneau Date: Wed, 2 Apr 2025 11:27:23 -0600 Subject: [PATCH] Disabled Cupertino page translations when animations disabled in Router. Also cleaned it a bit. --- lib/router.dart | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/router.dart b/lib/router.dart index 2573b547..368647a1 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -42,24 +42,20 @@ class ScreenPaths { // Routes that are used multiple times AppRoute get _artifactRoute => AppRoute( - 'artifact/:artifactId', - (s) => ArtifactDetailsScreen(artifactId: s.pathParameters['artifactId']!), - ); + 'artifact/:artifactId', + (s) => ArtifactDetailsScreen(artifactId: s.pathParameters['artifactId']!), +); -AppRoute get _timelineRoute { - return AppRoute( - 'timeline', - (s) => TimelineScreen(type: _tryParseWonderType(s.uri.queryParameters['type']!)), - ); -} +AppRoute get _timelineRoute => AppRoute( + 'timeline', + (s) => TimelineScreen(type: _tryParseWonderType(s.uri.queryParameters['type']!)), +); -AppRoute get _collectionRoute { - return AppRoute( - 'collection', - (s) => CollectionScreen(fromId: s.uri.queryParameters['id'] ?? ''), - routes: [_artifactRoute], - ); -} +AppRoute get _collectionRoute => AppRoute( + 'collection', + (s) => CollectionScreen(fromId: s.uri.queryParameters['id'] ?? ''), + routes: [_artifactRoute], +); /// Routing table, matches string paths to UI Screens, optionally parses params from the paths final appRouter = GoRouter( @@ -132,7 +128,7 @@ class AppRoute extends GoRoute { body: builder(state), resizeToAvoidBottomInset: false, ); - if (useFade) { + if (useFade || $styles.disableAnimations) { return CustomTransitionPage( key: state.pageKey, child: pageContent,