buildPageTransitions<T> static method

Widget buildPageTransitions<T>(
  1. PageRoute<T> route,
  2. BuildContext context,
  3. Animation<double> animation,
  4. Animation<double> secondaryAnimation,
  5. 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,
) {
  // Check if the route has an animation that's currently participating
  // in a back swipe gesture.
  //
  // In the middle of a back gesture drag, let the transition be linear to
  // match finger motions.
  final bool linearTransition = route.popGestureInProgress;
  if (route.fullscreenDialog) {
    return CupertinoFullscreenDialogTransition(
      primaryRouteAnimation: animation,
      secondaryRouteAnimation: secondaryAnimation,
      linearTransition: linearTransition,
      child: child,
    );
  } else {
    return CupertinoPageTransition(
      primaryRouteAnimation: animation,
      secondaryRouteAnimation: secondaryAnimation,
      linearTransition: linearTransition,
      child: _CupertinoBackGestureDetector<T>(
        enabledCallback: () => route.popGestureEnabled,
        onStartPopGesture: () => _startPopGesture<T>(route),
        child: child,
      ),
    );
  }
}