Open Vurarddo opened 1 day ago
When user navigate to Test3Route default back arrow is not displayed. What I did wrong?
Test3Route
Here my app_router code
@singleton @AutoRouterConfig(replaceInRouteName: 'Page,Route') class AppRouter extends RootStackRouter { AppRouter( this._authGuard, ); final AuthGuard _authGuard; @override RouteType get defaultRouteType => const RouteType.adaptive(); @override late final List<AutoRoute> routes = [ AutoRoute( page: DashboardWrapperRoute.page, path: '/', guards: [_authGuard], children: [ AutoRoute( page: Test1Route.page, path: 'test1', ), AutoRoute( page: Test2Route.page, path: 'test2', ), AutoRoute( page: TestWrapperRoute.page, path: 'test', children: [ AutoRoute(page: Test3Route.page, path: 'test3'), AutoRoute(page: Test4Route.page, path: 'test4'), ], ), ], ), ]; }
Here is my Pages code
@RoutePage() class Test1Page extends StatelessWidget { const Test1Page({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Test1 Page'), ), body: Center( child: FilledButton.tonal( onPressed: () { context.router.push(Test2Route()); }, child: Text('Test 2'), ), ), ); } } @RoutePage() class Test2Page extends StatelessWidget { const Test2Page({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Test2 Page'), ), body: Center( child: FilledButton.tonal( onPressed: () { context.router.push(Test3Route()); }, child: Text('Test 3'), ), ), ); } } @RoutePage() class TestWrapperPage extends StatelessWidget { const TestWrapperPage({super.key}); @override Widget build(BuildContext context) { return Provider<String>( create: (context) => 'test', child: const AutoRouter(), ); } } @RoutePage() class Test3Page extends StatelessWidget { const Test3Page({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Test3 Page ${context.read<String>()}'), ), body: Center( child: FilledButton.tonal( onPressed: () {}, child: Text('Test 4'), ), ), ); } } @RoutePage() class Test4Page extends StatelessWidget { const Test4Page({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Test4 Page'), ), body: Center( child: FilledButton.tonal( onPressed: () {}, child: Text('Home'), ), ), ); } }
Do I have to use leading: AutoLeadingButton(), in this case?
leading: AutoLeadingButton(),
When user navigate to
Test3Route
default back arrow is not displayed. What I did wrong?Here my app_router code
Here is my Pages code