didChangeTop method
override
The top most route has changed.
The topRoute
is the new top most route. This can be a new route pushed
on top of the screen, or an existing route that becomes the new top-most
route because the previous top-most route has been popped.
The previousTopRoute
was the top most route before the change. This can
be a route that was popped off the screen, or a route that will be covered
by the topRoute
. This can also be null if this is the first build.
Implementation
@override
void didChangeTop(Route<dynamic> topRoute, Route<dynamic>? previousTopRoute) {
assert(topRoute.isCurrent);
assert(navigator != null);
if (previousTopRoute == null) {
return;
}
// Don't trigger another flight when a pop is committed as a user gesture
// back swipe is snapped.
if (!navigator!.userGestureInProgress) {
_maybeStartHeroTransition(
fromRoute: previousTopRoute,
toRoute: topRoute,
isUserGestureTransition: false,
);
}
}