diff --git a/README.md b/README.md index 734b83ff..7ec501de 100644 --- a/README.md +++ b/README.md @@ -400,7 +400,6 @@ class DashboardPage extends StatelessWidget { } } ``` - **Note** NavLink is just a button that calls router.push(destination). Now if we navigate to `/dashboard/users`, we will be taken to the `DashboardPage` and the `UsersPage` will be shown inside of it. What if want to show one of the child pages at `/dashboard`? We can simply do that by giving the child routes an empty path `''` to make initial or by setting initial to true. @@ -416,6 +415,36 @@ AutoRoute( ) ``` +#### Creating Empty Shell routes +Empty shell routes build a screen that contain the `AutoRouter` widget, which is used to render nested routes. +So you can build the widget your self like follows: +```dart +@RoutePage() +class MyShellPage extends StatelessWidget { + const MyShellPage({Key? key}) : super(key: key); + @override + Widget build(BuildContext context) { + /// you can wrap the AutoRouter with any widget you want + return AutoRouter(); + } +} +``` +You can shorten the code above a bit by directly extending the `AutoRouter` Widget. +```dart +@RoutePage() +class MyShellPage extends AutoRouter { + const MyShellPage({Key? key}) : super(key: key); +} +``` + +finally you can create a shell route without code generation using the `EmptyShellRoute` helper + + ```dart + final BooksTab = EmptyShellRoute('BooksTab'); + context.push(BooksTab()); + ``` + + or by using a `RedirectRoute` ```dart diff --git a/art/auto_route_logo.png b/art/auto_route_logo.png new file mode 100644 index 00000000..905ef315 Binary files /dev/null and b/art/auto_route_logo.png differ diff --git a/auto_route/CHANGELOG.md b/auto_route/CHANGELOG.md index 64ed3914..a069ac63 100644 --- a/auto_route/CHANGELOG.md +++ b/auto_route/CHANGELOG.md @@ -1,3 +1,23 @@ +## 9.0.0 [Breaking Changes] + +- **BREAKING CHANGE**: No Router class will be generated anymore. Instead, you + extend `RootStackRouter` from the `auto_route` package. +- **BREAKING CHANGE**: Providing return types inside `@RoutePage()` is no longer needed. you + just provide the type as you push the page. +- **BREAKING CHANGE**: Providing a global route is now done by overriding the `guards` property + inside the router. implementing AutoRouteGuard is no longer supported. +- **BREAKING CHANGE**: `AutoRouterConfig.module` is removed as it's no longer needed. `PageRouteInfos` are now self-contained. +- + For more info read the complete migration guide + [Migrating to v9](https://github.com/Milad-Akarie/auto_route_library/blob/master/migrations/migrating_to_v9.md) + +- **FIX**: Fix Aliased types are not generated correctly. +- **FEAT**: You can now create empty shell routes like follows: + ```dart + final BooksTab = EmptyShellRoute('BooksTab'); + context.push(BooksTab()); + ``` + ## 8.3.0 - **FEAT**: add url#fragment support. diff --git a/auto_route/pubspec.yaml b/auto_route/pubspec.yaml index 1c351acd..c5f27cd6 100644 --- a/auto_route/pubspec.yaml +++ b/auto_route/pubspec.yaml @@ -1,7 +1,14 @@ name: auto_route description: AutoRoute is a declarative routing solution, where everything needed for navigation is automatically generated for you. -version: 8.3.0 +version: 9.0.0 homepage: https://github.com/Milad-Akarie/auto_route_library +screenshots: + - description: 'Auto Route Logo' + path: art/auto_route_logo.png +topics: + - Navigation + - Router + - Flutter Routes environment: sdk: ">=3.0.0 <4.0.0" @@ -11,7 +18,7 @@ dependencies: flutter: sdk: flutter path: ^1.9.0 - web: ^0.5.1 + web: ^1.0.0 collection: ^1.18.0 meta: ^1.12.0 @@ -21,7 +28,7 @@ dependencies: dev_dependencies: build_runner: mockito: ^5.4.4 - auto_route_generator: ^8.1.0 + auto_route_generator: ^9.0.0 flutter_test: sdk: flutter flutter_lints: ^4.0.0 diff --git a/auto_route_generator/CHANGELOG.md b/auto_route_generator/CHANGELOG.md index c0856dcd..9d46096c 100644 --- a/auto_route_generator/CHANGELOG.md +++ b/auto_route_generator/CHANGELOG.md @@ -1,3 +1,24 @@ +## 9.0.0 [Breaking Changes] + +- **BREAKING CHANGE**: No Router class will be generated anymore. Instead, you + extend `RootStackRouter` from the `auto_route` package. +- **BREAKING CHANGE**: Providing return types inside `@RoutePage()` is no longer needed. you + just provide the type as you push the page. +- **BREAKING CHANGE**: Providing a global route is now done by overriding the `guards` property + inside the router. implementing AutoRouteGuard is no longer supported. +- **BREAKING CHANGE**: `AutoRouterConfig.module` is removed as it's no longer needed. `PageRouteInfos` are now self-contained. +- +For more info read the complete migration guide +[Migrating to v9](https://github.com/Milad-Akarie/auto_route_library/blob/master/migrations/migrating_to_v9.md) + +- **FIX**: Fix Aliased types are not generated correctly. +- **FEAT**: You can now create empty shell routes like follows: + ```dart + final BooksTab = EmptyShellRoute('BooksTab'); + context.push(BooksTab()); + ``` + + ## 8.1.0 - **FEAT**: add url#fragment support. - **CHORE**: update auto_route_generator dependencies diff --git a/auto_route_generator/pubspec.yaml b/auto_route_generator/pubspec.yaml index 65c92933..61aa4e9e 100644 --- a/auto_route_generator/pubspec.yaml +++ b/auto_route_generator/pubspec.yaml @@ -1,6 +1,6 @@ name: auto_route_generator description: AutoRoute is a declarative routing solution, where everything needed for navigation is automatically generated for you. -version: 8.1.0 +version: 9.0.0 homepage: https://github.com/Milad-Akarie/auto_route_library environment: sdk: ">=3.3.0 <4.0.0" @@ -19,7 +19,7 @@ dependencies: args: ^2.5.0 glob: ^2.1.2 package_config: ^2.1.0 - auto_route: ^8.3.0 + auto_route: ^9.0.0