Hello,
I think I've encountered a bug with ShellRoute. Considering the following router setup, I'm not able to navigate to /shell/child when entering url in navigator (chrome):
final GoRouter _router = GoRouter(
routes: [
StackedRoute(
path: '/',
builder: (context) => const DummyPage(),
),
ShellRoute(
path: '/shell',
builder: (context, child) => Scaffold(
body: child,
appBar: AppBar(title: const Text('Shell')),
),
routes: [
StackedRoute(
path: 'child',
builder: (context) => const DummyPage(),
),
],
),
StackedRoute(
path: '/other',
builder: (context) => const DummyPage(),
),
],
);
I'm able to navigate to /, /shell, and /other, but when I'm entering /shell/child in the url I'm redirected to /.
The problem disappears if I set the ShellRoute path to / instead of /shell.
Here is a minimal reproducible example.
import 'package:flutter/material.dart';
import 'package:go_router_prototype/go_router_prototype.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(App());
}
class App extends StatelessWidget {
App({
super.key,
});
final GoRouter _router = GoRouter(
routes: [
StackedRoute(
path: '/',
builder: (context) => const DummyPage(),
),
ShellRoute(
path: '/shell',
builder: (context, child) => Scaffold(
body: child,
appBar: AppBar(title: const Text('Shell')),
),
routes: [
StackedRoute(
path: 'child',
builder: (context) => const DummyPage(),
),
],
),
StackedRoute(
path: '/other',
builder: (context) => const DummyPage(),
),
],
);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routeInformationParser: _router.parser,
routerDelegate: _router.delegate,
);
}
}
class DummyPage extends StatelessWidget {
const DummyPage({
super.key,
});
@override
Widget build(BuildContext context) {
return Center(
child: Text(RouteState.of(context).route.path),
);
}
}
I hope I'm not disrupting this project by opening this issue since it's only a prototype.
Thanks.
Hello,
I think I've encountered a bug with
ShellRoute. Considering the following router setup, I'm not able to navigate to/shell/childwhen entering url in navigator (chrome):I'm able to navigate to
/,/shell, and/other, but when I'm entering/shell/childin the url I'm redirected to/.The problem disappears if I set the
ShellRoutepath to/instead of/shell.Here is a minimal reproducible example.
I hope I'm not disrupting this project by opening this issue since it's only a prototype.
Thanks.