buildPageTransitions<T> method

Widget buildPageTransitions <T>(PageRoute<T> route, BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child)

Returns a CupertinoFullscreenDialogTransition if route is a full screen dialog, otherwise a CupertinoPageTransition is returned.

Used by CupertinoPageRoute.buildTransitions.

This method can be applied to any PageRoute, not just CupertinoPageRoute. It's typically used to provide a Cupertino style horizontal transition for material widgets when the target platform is TargetPlatform.iOS.

See also:

Implementation

static Widget buildPageTransitions<T>(
  PageRoute<T> route,
  BuildContext context,
  Animation<double> animation,
  Animation<double> secondaryAnimation,
  Widget child,
) {
  if (route.fullscreenDialog) {
    return CupertinoFullscreenDialogTransition(
      animation: animation,
      child: child,
    );
  } else {
    return CupertinoPageTransition(
      primaryRouteAnimation: animation,
      secondaryRouteAnimation: secondaryAnimation,
      // In the middle of a back gesture drag, let the transition be linear to
      // match finger motions.
      linearTransition: _popGestureInProgress.contains(route),
      child: _CupertinoBackGestureDetector<T>(
        enabledCallback: () => _isPopGestureEnabled<T>(route),
        onStartPopGesture: () => _startPopGesture<T>(route),
        child: child,
      ),
    );
  }
}