go_router 6.5

This commit is contained in:
Shawn 2023-04-11 13:16:40 -06:00
parent 7a64e91d28
commit 3e6df3e8b0
6 changed files with 55 additions and 51 deletions

View File

@ -28,6 +28,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -31,43 +31,47 @@ class ScreenPaths {
/// Routing table, matches string paths to UI Screens, optionally parses params from the paths /// Routing table, matches string paths to UI Screens, optionally parses params from the paths
final appRouter = GoRouter( final appRouter = GoRouter(
redirect: _handleRedirect,
navigatorBuilder: (_, __, child) => WondersAppScaffold(child: child),
routes: [ routes: [
AppRoute(ScreenPaths.splash, (_) => Container(color: $styles.colors.greyStrong)), // This will be hidden ShellRoute(
AppRoute(ScreenPaths.home, (_) => HomeScreen()), builder: (context, router, navigator) {
AppRoute(ScreenPaths.intro, (_) => IntroScreen()), return WondersAppScaffold(child: navigator);
AppRoute('/wonder/:type', (s) { },
int tab = int.tryParse(s.queryParams['t'] ?? '') ?? 0; routes: [
return WonderDetailsScreen( AppRoute(ScreenPaths.splash, (_) => Container(color: $styles.colors.greyStrong)), // This will be hidden
type: _parseWonderType(s.params['type']), AppRoute(ScreenPaths.home, (_) => HomeScreen()),
initialTabIndex: tab, AppRoute(ScreenPaths.intro, (_) => IntroScreen()),
); AppRoute('/wonder/:type', (s) {
}, useFade: true), int tab = int.tryParse(s.queryParams['t'] ?? '') ?? 0;
AppRoute('/timeline', (s) { return WonderDetailsScreen(
return TimelineScreen(type: _tryParseWonderType(s.queryParams['type']!)); type: _parseWonderType(s.params['type']),
}), initialTabIndex: tab,
AppRoute('/video/:id', (s) { );
return FullscreenVideoViewer(id: s.params['id']!); }, useFade: true),
}), AppRoute('/timeline', (s) {
AppRoute('/highlights/:type', (s) { return TimelineScreen(type: _tryParseWonderType(s.queryParams['type']!));
return ArtifactCarouselScreen(type: _parseWonderType(s.params['type'])); }),
}), AppRoute('/video/:id', (s) {
AppRoute('/search/:type', (s) { return FullscreenVideoViewer(id: s.params['id']!);
return ArtifactSearchScreen(type: _parseWonderType(s.params['type'])); }),
}), AppRoute('/highlights/:type', (s) {
AppRoute('/artifact/:id', (s) { return ArtifactCarouselScreen(type: _parseWonderType(s.params['type']));
return ArtifactDetailsScreen(artifactId: s.params['id']!); }),
}), AppRoute('/search/:type', (s) {
AppRoute('/collection', (s) { return ArtifactSearchScreen(type: _parseWonderType(s.params['type']));
return CollectionScreen(fromId: s.queryParams['id'] ?? ''); }),
}), AppRoute('/artifact/:id', (s) {
AppRoute('/maps/:type', (s) { return ArtifactDetailsScreen(artifactId: s.params['id']!);
return FullscreenMapsViewer(type: _parseWonderType(s.params['type'])); }),
}), AppRoute('/collection', (s) {
AppRoute('/wallpaperPhoto/:type', (s) { return CollectionScreen(fromId: s.queryParams['id'] ?? '');
return WallpaperPhotoScreen(type: _parseWonderType(s.params['type'])); }),
}), AppRoute('/maps/:type', (s) {
return FullscreenMapsViewer(type: _parseWonderType(s.params['type']));
}),
AppRoute('/wallpaperPhoto/:type', (s) {
return WallpaperPhotoScreen(type: _parseWonderType(s.params['type']));
}),
]),
], ],
); );

View File

@ -3,8 +3,8 @@ FLUTTER_ROOT=C:\_dev\sdks\flutter
FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app
COCOAPODS_PARALLEL_CODE_SIGN=true COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=2.0.11 FLUTTER_BUILD_NAME=2.0.12
FLUTTER_BUILD_NUMBER=2.0.11 FLUTTER_BUILD_NUMBER=2.0.12
DART_OBFUSCATION=false DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false TREE_SHAKE_ICONS=false

View File

@ -4,8 +4,8 @@ export "FLUTTER_ROOT=C:\_dev\sdks\flutter"
export "FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app" export "FLUTTER_APPLICATION_PATH=C:\_dev\gskinner\flutter_wonders_app"
export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=2.0.11" export "FLUTTER_BUILD_NAME=2.0.12"
export "FLUTTER_BUILD_NUMBER=2.0.11" export "FLUTTER_BUILD_NUMBER=2.0.12"
export "DART_OBFUSCATION=false" export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true" export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false" export "TREE_SHAKE_ICONS=false"

View File

@ -125,10 +125,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.3.0"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -428,10 +428,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: go_router name: go_router
sha256: aec1999abe8b2f131eda46d4c9629048fb1befed2b65e90b73f9193a300ce489 sha256: feab99a20fd248c658c923ba98f4449ca6e575c3dee9fdf07146f4f33482c6bc
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.5.1" version: "6.5.5"
google_maps: google_maps:
dependency: transitive dependency: transitive
description: description:
@ -636,18 +636,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 sha256: "586678f20e112219ed0f73215f01bcdf1d769824ba2ebae45ad918a9bfde9bdb"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "0.3.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.0" version: "1.9.1"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -1270,5 +1270,5 @@ packages:
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
sdks: sdks:
dart: ">=2.19.0 <4.0.0" dart: ">=3.0.0-0 <4.0.0"
flutter: ">=3.7.0-0" flutter: ">=3.7.0-0"

View File

@ -30,7 +30,7 @@ dependencies:
get_it_mixin: ^3.1.4 get_it_mixin: ^3.1.4
google_maps_flutter: ^2.2.3 google_maps_flutter: ^2.2.3
google_maps_flutter_web: ^0.4.0+5 google_maps_flutter_web: ^0.4.0+5
go_router: ^4.2.8 go_router: ^6.5.5
http: ^0.13.5 http: ^0.13.5
image_fade: ^0.6.2 image_fade: ^0.6.2
image_gallery_saver: ^1.7.1 image_gallery_saver: ^1.7.1