Flutter Change ModalRoute duration with setState

36 Views Asked by At

Is it possible to change the properties of ModalRoute after the route has been created.

In this case I want to change the reverseTransitionDuration based on which method the user used to pop the page. I cannot see how to set these properties unless this can be done with the setState function but I don't see a copyWith function either meaning an entirely new route would have to replace the current route. That seems unnecessarily expensive for such a simple change.

I'm after something like:

    ModalRoute.of(context).setState((){ 
      ModalRoute.of(context) =      
        ModalRoute.of(context).copyWith(reverseTransitionDuration: Duration(milliseconds: 500); 
    });

Am I missing something?

0

There are 0 best solutions below