Skip to content

How to implement Sheet / Dialog route with GoRouter? #385

Answered by ahey
ahey asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, I was able to get this working well – here's what I ended up with:

GoRoute(
  path: '/accounts',
  // ...
  routes: [
    GoRoute(
      path: 'new',
      parentNavigatorKey: _rootNavigatorKey, // display the dialog on top of the FBottomNavigationBar
      pageBuilder: (context, state) {
        return SheetPage<void>(
          side: FLayout.btt,
          builder: (context) => const AccountsNewPage(),
        );
        
        // or for a modal dialog:
        //
        // return DialogPage<void>(
        //   builder: (context) => const AccountsNewPage(),
        // );
      },
    ),
  ],
),
import 'package:flutter/widgets.dart';
import 'package:forui/forui.dart';

class S…

Replies: 1 comment 1 reply

Comment options

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

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