Closed jpainam closed 4 years ago
Hi, The argument passed to
Navigator.of(context) .pushNamed(SecondScreen.routeName, arguments: AnObject)
is always null whenSecondScreen
route is registered asonGenerateRoute: (settings){ switch(settings.name){ case SecondScreen.routeName: return PageTransition(child: SecondScreen(), type: PageTransitionType.downToUp); break; default: return null; }
AnObject
is always null inSecondScreen
. But when the route is registered asroutes: { '/': (context) => HomeScreen(), SecondScreen.routeName: (context) => SecondScreen(), },
the argument is retrieved. How to use PageTransition plugin with namedroute and arguments?
Thank,
Sorry for delay. did you read readme.md file? I think it is very well explained how to use arguments.
First you need to upgrade your package with latest package. Than Usage predefined routes with RouteSettings First, define the onGenerateRoute property in the MaterialApp widget like below and in switch cases you can transition to your new routes:
onGenerateRoute: (settings) {
switch (settings.name) {
case '/second':
return PageTransition(
child: SecondPage(),
type: PageTransitionType.scale,
settings: settings,
);
break;
default:
return null;
}
},
After that you can use your new route like this:
Navigator.pushNamed(context, '/second', arguments: "arguments data");
Due inactivity i will go close this. If you have any issue please reopen again.
Hi, The argument passed to
Navigator.of(context) .pushNamed(SecondScreen.routeName, arguments: AnObject)
is always null whenSecondScreen
route is registered asAnObject
is always null inSecondScreen
. But when the route is registered asthe argument is retrieved. How to use PageTransition plugin with namedroute and arguments?
Thank,