From 3e6df3e8b064045ec0e5ee58803e97fb302eedc9 Mon Sep 17 00:00:00 2001 From: Shawn Date: Tue, 11 Apr 2023 13:16:40 -0600 Subject: [PATCH] go_router 6.5 --- android/build.gradle | 2 +- lib/router.dart | 76 ++++++++++--------- .../ephemeral/Flutter-Generated.xcconfig | 4 +- .../ephemeral/flutter_export_environment.sh | 4 +- pubspec.lock | 18 ++--- pubspec.yaml | 2 +- 6 files changed, 55 insertions(+), 51 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index c574bb32..189049a7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -28,6 +28,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/router.dart b/lib/router.dart index 5c550fd8..ca4c7e6f 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -31,43 +31,47 @@ class ScreenPaths { /// Routing table, matches string paths to UI Screens, optionally parses params from the paths final appRouter = GoRouter( - redirect: _handleRedirect, - navigatorBuilder: (_, __, child) => WondersAppScaffold(child: child), routes: [ - AppRoute(ScreenPaths.splash, (_) => Container(color: $styles.colors.greyStrong)), // This will be hidden - AppRoute(ScreenPaths.home, (_) => HomeScreen()), - AppRoute(ScreenPaths.intro, (_) => IntroScreen()), - AppRoute('/wonder/:type', (s) { - int tab = int.tryParse(s.queryParams['t'] ?? '') ?? 0; - return WonderDetailsScreen( - type: _parseWonderType(s.params['type']), - initialTabIndex: tab, - ); - }, useFade: true), - AppRoute('/timeline', (s) { - return TimelineScreen(type: _tryParseWonderType(s.queryParams['type']!)); - }), - AppRoute('/video/:id', (s) { - return FullscreenVideoViewer(id: s.params['id']!); - }), - AppRoute('/highlights/:type', (s) { - return ArtifactCarouselScreen(type: _parseWonderType(s.params['type'])); - }), - AppRoute('/search/:type', (s) { - return ArtifactSearchScreen(type: _parseWonderType(s.params['type'])); - }), - AppRoute('/artifact/:id', (s) { - return ArtifactDetailsScreen(artifactId: s.params['id']!); - }), - AppRoute('/collection', (s) { - return CollectionScreen(fromId: s.queryParams['id'] ?? ''); - }), - AppRoute('/maps/:type', (s) { - return FullscreenMapsViewer(type: _parseWonderType(s.params['type'])); - }), - AppRoute('/wallpaperPhoto/:type', (s) { - return WallpaperPhotoScreen(type: _parseWonderType(s.params['type'])); - }), + ShellRoute( + builder: (context, router, navigator) { + return WondersAppScaffold(child: navigator); + }, + routes: [ + AppRoute(ScreenPaths.splash, (_) => Container(color: $styles.colors.greyStrong)), // This will be hidden + AppRoute(ScreenPaths.home, (_) => HomeScreen()), + AppRoute(ScreenPaths.intro, (_) => IntroScreen()), + AppRoute('/wonder/:type', (s) { + int tab = int.tryParse(s.queryParams['t'] ?? '') ?? 0; + return WonderDetailsScreen( + type: _parseWonderType(s.params['type']), + initialTabIndex: tab, + ); + }, useFade: true), + AppRoute('/timeline', (s) { + return TimelineScreen(type: _tryParseWonderType(s.queryParams['type']!)); + }), + AppRoute('/video/:id', (s) { + return FullscreenVideoViewer(id: s.params['id']!); + }), + AppRoute('/highlights/:type', (s) { + return ArtifactCarouselScreen(type: _parseWonderType(s.params['type'])); + }), + AppRoute('/search/:type', (s) { + return ArtifactSearchScreen(type: _parseWonderType(s.params['type'])); + }), + AppRoute('/artifact/:id', (s) { + return ArtifactDetailsScreen(artifactId: s.params['id']!); + }), + AppRoute('/collection', (s) { + return CollectionScreen(fromId: s.queryParams['id'] ?? ''); + }), + AppRoute('/maps/:type', (s) { + return FullscreenMapsViewer(type: _parseWonderType(s.params['type'])); + }), + AppRoute('/wallpaperPhoto/:type', (s) { + return WallpaperPhotoScreen(type: _parseWonderType(s.params['type'])); + }), + ]), ], ); diff --git a/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/macos/Flutter/ephemeral/Flutter-Generated.xcconfig index 135411ed..95878a0e 100644 --- a/macos/Flutter/ephemeral/Flutter-Generated.xcconfig +++ b/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -3,8 +3,8 @@ FLUTTER_ROOT=C:\_dev\sdks\flutter FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app COCOAPODS_PARALLEL_CODE_SIGN=true FLUTTER_BUILD_DIR=build -FLUTTER_BUILD_NAME=2.0.11 -FLUTTER_BUILD_NUMBER=2.0.11 +FLUTTER_BUILD_NAME=2.0.12 +FLUTTER_BUILD_NUMBER=2.0.12 DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false diff --git a/macos/Flutter/ephemeral/flutter_export_environment.sh b/macos/Flutter/ephemeral/flutter_export_environment.sh index 17ac7245..a3c5b91d 100755 --- a/macos/Flutter/ephemeral/flutter_export_environment.sh +++ b/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -4,8 +4,8 @@ export "FLUTTER_ROOT=C:\_dev\sdks\flutter" export "FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app" export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_BUILD_DIR=build" -export "FLUTTER_BUILD_NAME=2.0.11" -export "FLUTTER_BUILD_NUMBER=2.0.11" +export "FLUTTER_BUILD_NAME=2.0.12" +export "FLUTTER_BUILD_NUMBER=2.0.12" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" diff --git a/pubspec.lock b/pubspec.lock index b1c95e09..873d33a5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -428,10 +428,10 @@ packages: dependency: "direct main" description: name: go_router - sha256: aec1999abe8b2f131eda46d4c9629048fb1befed2b65e90b73f9193a300ce489 + sha256: feab99a20fd248c658c923ba98f4449ca6e575c3dee9fdf07146f4f33482c6bc url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "6.5.5" google_maps: dependency: transitive description: @@ -636,18 +636,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "586678f20e112219ed0f73215f01bcdf1d769824ba2ebae45ad918a9bfde9bdb" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.3.0" meta: dependency: transitive description: name: meta - sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" mime: dependency: transitive description: @@ -1270,5 +1270,5 @@ packages: source: hosted version: "2.0.2" sdks: - dart: ">=2.19.0 <4.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=3.7.0-0" diff --git a/pubspec.yaml b/pubspec.yaml index 16c5c210..829cee16 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: get_it_mixin: ^3.1.4 google_maps_flutter: ^2.2.3 google_maps_flutter_web: ^0.4.0+5 - go_router: ^4.2.8 + go_router: ^6.5.5 http: ^0.13.5 image_fade: ^0.6.2 image_gallery_saver: ^1.7.1