UdaraWanasinghe / AwesomePageTransitions

Other
8 stars 1 forks source link

How to use in onGenerateRoute? #1

Open Skquark opened 4 years ago

Skquark commented 4 years ago

I'm liking the look of these transitions, works good with the Navigator.push method, but in my project I have it setup to use page routing within MaterialApp - onGenerateRoute: (RouteSettings settings) area to use named pages. My question is how could I get the exitPage Widget using it there with the normal route transitions? In other transition packages I used, it was with a builder inside a customRoute that extends MaterialPageRoute. Is there a way to get the current screen as the from widget there? I tried to do my research and figure it out, but couldn't crack it. I could just use it like your example where I'm navigating page, but I liked having the named page in the route builder if I could.

UdaraWanasinghe commented 4 years ago

You can pass a GlobalKey when creating the Page and call key.currentWidget to get the widget and use it as exit page. Other option is you can create your own navigator.

iampato commented 4 years ago

an example could be nice