Skip to content
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

[Mobile] App Bar Back Arrow button is not displayed in Nested navigation #2088

Open
Vurarddo opened this issue Nov 13, 2024 · 1 comment
Open

Comments

@Vurarddo
Copy link

When user navigate to Test3Route default back arrow is not displayed. What I did wrong?

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'),
        ),
      ),
    );
  }
}
@Vurarddo
Copy link
Author

Do I have to use leading: AutoLeadingButton(), in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant