kalismeras61 / flutter_page_transition

This is Flutter Page Transition Package
BSD 2-Clause "Simplified" License
475 stars 57 forks source link

Add new params to add RouteSettings to Navigator #9

Closed tegkev closed 5 years ago

tegkev commented 5 years ago

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

kalismeras61 commented 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;
    }
  },