secondaryAnimationFollowsModal static method

bool secondaryAnimationFollowsModal(
  1. ModalRoute route
)

Whether route's secondary animation follows a modal route counted in anyModalDepth, so a sheet moves it, not a page pushed over it (#161).

A page transitions with the route over it when it can: a page in a PageRouteBuilder with any page route, a sheet package's sheet route too, and any page with a route that has a delegated transition, as showCupertinoSheet's has. What covers the page then is the sheet (modalRect), not its route's whole box (movingRouteRect).

Implementation

static bool secondaryAnimationFollowsModal(ModalRoute<dynamic> route) {
  final driver = _driverOf(route.secondaryAnimation);
  if (driver == null) return false;
  for (final modal in _trackedModals) {
    if (modal is TransitionRoute &&
        identical(_driverOf(modal.animation), driver)) {
      return true;
    }
  }
  return false;
}