Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

How to use go_router and Drawer #316

Answered by esDotDev
morhi asked this question in Q&A
Discussion options

You must be logged in to vote

Since your AppDrawer is actually above the Navigator here, I think you probably need to wrap an outer navigator to handle it:

navigatorBuilder: (_, child) => Navigator( onGenerateRoute: (_) {
    return PageRouteBuilder(
      transitionDuration: Duration.zero,
      pageBuilder: (_, __, ___){
          return Scaffold(
            drawer: AppDrawer(),
            body: child, // <- this is actually the navigator the router controls
          ));
      },
    );
  })

This root navigator can handle dialogs, sheets, overlays as well.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@morhi
Comment options

Answer selected by morhi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants