popGestureEnabled property
override
Whether a pop gesture can be started by the user for this route.
Returns true if the user can edge-swipe to a previous route.
This should only be used between frames, not during build.
Implementation
@override
bool get popGestureEnabled {
// If there's nothing to go back to, then obviously we don't support
// the back gesture.
if (isFirst) {
return false;
}
// If the route wouldn't actually pop if we popped it, then the gesture
// would be really confusing (or would skip internal routes), so disallow it.
if (willHandlePopInternally) {
return false;
}
// If attempts to dismiss this route might be vetoed such as in a page
// with forms, then do not allow the user to dismiss the route with a swipe.
if (hasScopedWillPopCallback || popDisposition == RoutePopDisposition.doNotPop) {
return false;
}
// If we're in an animation already, we cannot be manually swiped.
if (!animation!.isCompleted) {
return false;
}
// If we're being popped into, we also cannot be swiped until the pop above
// it completes. This translates to our secondary animation being
// dismissed.
if (!secondaryAnimation!.isDismissed) {
return false;
}
// If we're in a gesture already, we cannot start another.
if (popGestureInProgress) {
return false;
}
// Looks like a back gesture would be welcome!
return true;
}