Closed tegkev closed 5 years ago
Alternatively, extract the arguments using onGenerateRoute;
Instead of extracting the arguments directly inside the widget, you can also extract the arguments inside an onGenerateRoute() function and pass them to a widget.
onGenerateRoute: (settings) {
switch (settings.name) {
case '/second':
return PageTransition(child: SecondPage(), type: PageTransitionType.scale);
break;
default:
return null;
}
},
The default MaterialPageRoute take settings (RouteSettings) as param, is neccesary to add a route in the Navigator. But we can' t pass the settings as param to the constructor PageTransition