-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
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(),
),
],
),
],
);
iapicca, mono0926, janknips, passsy, 0x3dev and 39 morerazikallayirazikallayirazikallayi
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: go_routerThe go_router packageThe go_router packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team