[go_router] Bumps example go_router version and migrate example code (#4469)

unblock any go_router or go_router_builder ci
This commit is contained in:
chunhtai
2023-07-14 11:54:59 -07:00
committed by GitHub
parent 369ee7e1a1
commit c18c646876
6 changed files with 21 additions and 17 deletions

View File

@ -1,3 +1,7 @@
## 2.2.2
* Bumps example go_router version and migrate example code.
## 2.2.1 ## 2.2.1
* Cleans up go_router_builder code. * Cleans up go_router_builder code.

View File

@ -58,7 +58,7 @@ class BigIntRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('BigIntRoute'), title: const Text('BigIntRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -84,7 +84,7 @@ class BoolRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('BoolRoute'), title: const Text('BoolRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -107,7 +107,7 @@ class DateTimeRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('DateTimeRoute'), title: const Text('DateTimeRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -133,7 +133,7 @@ class DoubleRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('DoubleRoute'), title: const Text('DoubleRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -159,7 +159,7 @@ class IntRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('IntRoute'), title: const Text('IntRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -185,7 +185,7 @@ class NumRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('NumRoute'), title: const Text('NumRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -212,7 +212,7 @@ class EnumRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('EnumRoute'), title: const Text('EnumRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -239,7 +239,7 @@ class EnhancedEnumRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('EnhancedEnumRoute'), title: const Text('EnhancedEnumRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -265,7 +265,7 @@ class StringRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('StringRoute'), title: const Text('StringRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -288,7 +288,7 @@ class UriRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('UriRoute'), title: const Text('UriRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -361,7 +361,7 @@ class IterableRoute extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('IterableRoute'), title: const Text('IterableRoute'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -430,7 +430,7 @@ class IterableRouteWithDefaultValues extends GoRouteData {
Widget drawerTile(BuildContext context) => ListTile( Widget drawerTile(BuildContext context) => ListTile(
title: const Text('IterableRouteWithDefaultValues'), title: const Text('IterableRouteWithDefaultValues'),
onTap: () => go(context), onTap: () => go(context),
selected: GoRouter.of(context).location == location, selected: GoRouterState.of(context).location == location,
); );
} }
@ -536,7 +536,7 @@ class BasePage<T> extends StatelessWidget {
Text( Text(
'Query param with default value: $queryParamWithDefaultValue', 'Query param with default value: $queryParamWithDefaultValue',
), ),
SelectableText(GoRouter.of(context).location), SelectableText(GoRouterState.of(context).location),
], ],
), ),
), ),

View File

@ -77,7 +77,7 @@ class MyShellRouteScreen extends StatelessWidget {
final Widget child; final Widget child;
int getCurrentIndex(BuildContext context) { int getCurrentIndex(BuildContext context) {
final String location = GoRouter.of(context).location; final String location = GoRouterState.of(context).location;
if (location == '/bar') { if (location == '/bar') {
return 1; return 1;
} }

View File

@ -57,7 +57,7 @@ class MyShellRouteScreen extends StatelessWidget {
final Widget child; final Widget child;
int getCurrentIndex(BuildContext context) { int getCurrentIndex(BuildContext context) {
final String location = GoRouter.of(context).location; final String location = GoRouterState.of(context).location;
if (location.startsWith('/users')) { if (location.startsWith('/users')) {
return 1; return 1;
} }

View File

@ -8,7 +8,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
go_router: ^7.0.0 go_router: ^9.0.3
provider: 6.0.5 provider: 6.0.5
dev_dependencies: dev_dependencies:

View File

@ -2,7 +2,7 @@ name: go_router_builder
description: >- description: >-
A builder that supports generated strongly-typed route helpers for A builder that supports generated strongly-typed route helpers for
package:go_router package:go_router
version: 2.2.1 version: 2.2.2
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22