canTransitionFrom method
Returns true if previousRoute
should animate when this route
is pushed on top of it or when then this route is popped off of it.
Subclasses can override this method to restrict the set of routes they need to coordinate transitions with.
If true, and previousRoute.canTransitionTo()
is true, then the
previous route's ModalRoute.buildTransitions secondaryAnimation
will
run from 0.0 - 1.0 when this route is pushed on top of
it. Similarly, if this route is popped off of previousRoute
the previous route's secondaryAnimation
will run from 1.0 - 0.0.
If false, then the previous route's ModalRoute.buildTransitions
secondaryAnimation
value will be kAlwaysDismissedAnimation. In
other words previousRoute
will not animate when this route is
pushed on top of it or when then this route is popped off of it.
Returns true by default.
See also:
- canTransitionTo, which must be true for
previousRoute
for its ModalRoute.buildTransitionssecondaryAnimation
to run.
Implementation
@override
bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) =>
canTransitionFromPredicate?.call(previousRoute) ?? false;