diff --git a/app/lib/core/routing/routes.bookmarks.dart b/app/lib/core/routing/routes.bookmarks.dart index 5e70dd6c..3466a0d8 100644 --- a/app/lib/core/routing/routes.bookmarks.dart +++ b/app/lib/core/routing/routes.bookmarks.dart @@ -19,10 +19,39 @@ */ part of 'routes.dart'; -@TypedGoRoute( - name: 'BookmarkListRoute', - path: '/bookmarks/:entryGuid', +@TypedGoRoute( + name: 'BookmarksRoute', + path: '/bookmarks', + routes: [ + TypedGoRoute( + name: 'BookmarkListRoute', + path: 'list/:entryGuid', + ), + TypedGoRoute( + name: 'BookmarkFolderAddRoute', + path: 'createFolder', + ), + TypedGoRoute( + name: 'BookmarkFolderEditRoute', + path: 'editFolder', + ), + TypedGoRoute( + name: 'BookmarkEntryAddRoute', + path: 'createEntry', + ), + TypedGoRoute( + name: 'BookmarkEntryEditRoute', + path: 'editEntry', + ), + ], ) +class BookmarksRoute extends GoRouteData with $BookmarksRoute { + @override + Widget build(BuildContext context, GoRouterState state) { + return const SizedBox.shrink(); + } +} + class BookmarkListRoute extends GoRouteData with $BookmarkListRoute { final String entryGuid; @@ -34,10 +63,6 @@ class BookmarkListRoute extends GoRouteData with $BookmarkListRoute { } } -@TypedGoRoute( - name: 'BookmarkFolderAddRoute', - path: '/bookmarks/createFolder', -) class BookmarkFolderAddRoute extends GoRouteData with $BookmarkFolderAddRoute { final String? parentGuid; @@ -49,10 +74,6 @@ class BookmarkFolderAddRoute extends GoRouteData with $BookmarkFolderAddRoute { } } -@TypedGoRoute( - name: 'BookmarkFolderEditRoute', - path: '/bookmarks/editFolder', -) class BookmarkFolderEditRoute extends GoRouteData with $BookmarkFolderEditRoute { final String folder; @@ -69,10 +90,6 @@ class BookmarkFolderEditRoute extends GoRouteData } } -@TypedGoRoute( - name: 'BookmarkEntryAddRoute', - path: '/bookmarks/createEntry', -) class BookmarkEntryAddRoute extends GoRouteData with $BookmarkEntryAddRoute { final String bookmarkInfo; @@ -87,10 +104,6 @@ class BookmarkEntryAddRoute extends GoRouteData with $BookmarkEntryAddRoute { } } -@TypedGoRoute( - name: 'BookmarkEntryEditRoute', - path: '/bookmarks/editEntry', -) class BookmarkEntryEditRoute extends GoRouteData with $BookmarkEntryEditRoute { final String bookmarkEntry; diff --git a/app/lib/core/routing/routes.g.dart b/app/lib/core/routing/routes.g.dart index 014ed1e2..54037de7 100644 --- a/app/lib/core/routing/routes.g.dart +++ b/app/lib/core/routing/routes.g.dart @@ -10,11 +10,7 @@ List get $appRoutes => [ $aboutRoute, $onboardingRoute, $bangMenuRoute, - $bookmarkListRoute, - $bookmarkFolderAddRoute, - $bookmarkFolderEditRoute, - $bookmarkEntryAddRoute, - $bookmarkEntryEditRoute, + $bookmarksRoute, $browserRoute, $feedListRoute, $historyRoute, @@ -321,22 +317,44 @@ mixin $BangSubCategoryRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $bookmarkListRoute => GoRouteData.$route( - path: '/bookmarks/:entryGuid', - name: 'BookmarkListRoute', - factory: $BookmarkListRoute._fromState, +RouteBase get $bookmarksRoute => GoRouteData.$route( + path: '/bookmarks', + name: 'BookmarksRoute', + factory: $BookmarksRoute._fromState, + routes: [ + GoRouteData.$route( + path: 'list/:entryGuid', + name: 'BookmarkListRoute', + factory: $BookmarkListRoute._fromState, + ), + GoRouteData.$route( + path: 'createFolder', + name: 'BookmarkFolderAddRoute', + factory: $BookmarkFolderAddRoute._fromState, + ), + GoRouteData.$route( + path: 'editFolder', + name: 'BookmarkFolderEditRoute', + factory: $BookmarkFolderEditRoute._fromState, + ), + GoRouteData.$route( + path: 'createEntry', + name: 'BookmarkEntryAddRoute', + factory: $BookmarkEntryAddRoute._fromState, + ), + GoRouteData.$route( + path: 'editEntry', + name: 'BookmarkEntryEditRoute', + factory: $BookmarkEntryEditRoute._fromState, + ), + ], ); -mixin $BookmarkListRoute on GoRouteData { - static BookmarkListRoute _fromState(GoRouterState state) => - BookmarkListRoute(entryGuid: state.pathParameters['entryGuid']!); - - BookmarkListRoute get _self => this as BookmarkListRoute; +mixin $BookmarksRoute on GoRouteData { + static BookmarksRoute _fromState(GoRouterState state) => BookmarksRoute(); @override - String get location => GoRouteData.$location( - '/bookmarks/${Uri.encodeComponent(_self.entryGuid)}', - ); + String get location => GoRouteData.$location('/bookmarks'); @override void go(BuildContext context) => context.go(location); @@ -352,11 +370,30 @@ mixin $BookmarkListRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $bookmarkFolderAddRoute => GoRouteData.$route( - path: '/bookmarks/createFolder', - name: 'BookmarkFolderAddRoute', - factory: $BookmarkFolderAddRoute._fromState, -); +mixin $BookmarkListRoute on GoRouteData { + static BookmarkListRoute _fromState(GoRouterState state) => + BookmarkListRoute(entryGuid: state.pathParameters['entryGuid']!); + + BookmarkListRoute get _self => this as BookmarkListRoute; + + @override + String get location => GoRouteData.$location( + '/bookmarks/list/${Uri.encodeComponent(_self.entryGuid)}', + ); + + @override + void go(BuildContext context) => context.go(location); + + @override + Future push(BuildContext context) => context.push(location); + + @override + void pushReplacement(BuildContext context) => + context.pushReplacement(location); + + @override + void replace(BuildContext context) => context.replace(location); +} mixin $BookmarkFolderAddRoute on GoRouteData { static BookmarkFolderAddRoute _fromState(GoRouterState state) => @@ -388,12 +425,6 @@ mixin $BookmarkFolderAddRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $bookmarkFolderEditRoute => GoRouteData.$route( - path: '/bookmarks/editFolder', - name: 'BookmarkFolderEditRoute', - factory: $BookmarkFolderEditRoute._fromState, -); - mixin $BookmarkFolderEditRoute on GoRouteData { static BookmarkFolderEditRoute _fromState(GoRouterState state) => BookmarkFolderEditRoute(folder: state.uri.queryParameters['folder']!); @@ -420,12 +451,6 @@ mixin $BookmarkFolderEditRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $bookmarkEntryAddRoute => GoRouteData.$route( - path: '/bookmarks/createEntry', - name: 'BookmarkEntryAddRoute', - factory: $BookmarkEntryAddRoute._fromState, -); - mixin $BookmarkEntryAddRoute on GoRouteData { static BookmarkEntryAddRoute _fromState(GoRouterState state) => BookmarkEntryAddRoute( @@ -454,12 +479,6 @@ mixin $BookmarkEntryAddRoute on GoRouteData { void replace(BuildContext context) => context.replace(location); } -RouteBase get $bookmarkEntryEditRoute => GoRouteData.$route( - path: '/bookmarks/editEntry', - name: 'BookmarkEntryEditRoute', - factory: $BookmarkEntryEditRoute._fromState, -); - mixin $BookmarkEntryEditRoute on GoRouteData { static BookmarkEntryEditRoute _fromState(GoRouterState state) => BookmarkEntryEditRoute(