Open
Description
Use case
For custom transitions there's already the possibility to declare a GoRoute with a pageBuilder. In cases where the same custom transition is needed for every page in the app, this method becomes repetitive and redundant.
GoRouter(
routes: [
GoRoute(
path: '/',
pageBuilder: (context, state) => MyCustomTransitionPage(
child: RootPage(),
),
routes: [
GoRoute(
path: 'page2',
pageBuilder: (context, state) => MyCustomTransitionPage(
child: Page2(),
),
),
GoRoute(
path: 'page3',
pageBuilder: (context, state) => MyCustomTransitionPage(
child: Page3(),
),
),
GoRoute(
path: 'page4',
pageBuilder: (context, state) => MyCustomTransitionPage(
child: Page4(),
),
),
],
),
],
);
Proposal
To solve this issue it would be really great to add a custom pageBuilder
to GoRouter
constructor and use it (if present) as the default pageBuilder
for every GoRoute
that only declares a builder
GoRouter(
pageBuilder: (context, state, child) => MyCustomTransitionPage(
child: child,
),
routes: [
GoRoute(
path: '/',
builder: (context, state) => RootPage(),
routes: [
GoRoute(
path: 'page2',
builder: (context, state) => Page2(),
),
GoRoute(
path: 'page3',
builder: (context, state) => Page3(),
),
GoRoute(
path: 'page4',
builder: (context, state) => Page4(),
),
],
),
],
);