-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typed Go_Router? #48
Comments
@JohnGalt1717 Just create a custom page extends SwipeablePage and throws it on GoRouter page builder like this class SwipeablePageCustom extends SwipeablePage<void> {
SwipeablePageCustom({
required LocalKey key,
required Widget child,
}) : super(
key: key,
canOnlySwipeFromEdge: true,
transitionDuration: const Duration(milliseconds: 350),
reverseTransitionDuration: const Duration(milliseconds: 350),
builder: (BuildContext context) => MaxWidthBox(
maxWidth: 1200,
background: Container(color: Theme.of(context).colorScheme.surface),
child: child,
),
);
}
GoRoute(
name: childrendashboard,
path: 'dashboard',
pageBuilder:
(BuildContext context, GoRouterState state) {
return SwipeablePageCustom(
key: UniqueKey(),
child: DashboardScreen(
room: state.extra as RoomModel?),
);
},` |
Sorry for the delay! I added a go_router_builder version in the example: 6fca6b8 (based on https://pub.dev/documentation/go_router_builder/latest/#transition-override). Unfortunately, I get a failed assertion when dragging a page away (not when using the back button), which doesn't happen with the normal go_router:
I haven't been able to pinpoint where the difference lies between the two, and won't have time to debug it in more detail until at least the week after next. Feel free to give it a try, maybe you have an idea to fix the bug – I'm using go_router_builder for the first time today |
@JonasWanke I'm also faced that after upgrade version flutter higher than 3.16.9, looks like the new flutter makes some changes about that, you can downgrade flutter and retry, hope it helps. |
@Tuandiep98 Did you have that error with go_router_builder or even without it? Unfortunately, with Flutter's breaking change (see #52), the new version of this package only supports Flutter 3.22 and newer, so the workaround (older Flutter version) only works with older versions of this package |
@JonasWanke I'm just using page builder like code attached above. |
I can't figure out from the documentation how to update this typed Go_Router route:
@immutable
class DiscoverRoute extends GoRouteData {
@OverRide
Widget build(BuildContext context, GoRouterState state) {
return DiscoverPage();
}
}
Using SwipablePageRoute doesn't return a widget, so I'm trying to figure out what I need to do here. It would be really helpful if the documentation covered this case.
Thanks!
The text was updated successfully, but these errors were encountered: