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, {
  6. ValueGetter<bool> canSwipe = _defaultCanSwipe,
  7. ValueGetter<bool> canOnlySwipeFromEdge = _defaultCanOnlySwipeFromEdge,
  8. ValueGetter<double> backGestureDetectionWidth = _defaultBackGestureDetectionWidth,
  9. ValueGetter<double> backGestureDetectionStartOffset = _defaultBackGestureDetectionStartOffset,
  10. SwipeableTransitionBuilder? transitionBuilder,
})
override

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, {
  ValueGetter<bool> canSwipe = _defaultCanSwipe,
  ValueGetter<bool> canOnlySwipeFromEdge = _defaultCanOnlySwipeFromEdge,
  ValueGetter<double> backGestureDetectionWidth =
      _defaultBackGestureDetectionWidth,
  ValueGetter<double> backGestureDetectionStartOffset =
      _defaultBackGestureDetectionStartOffset,
  SwipeableTransitionBuilder? transitionBuilder,
}) {
  final Widget wrappedChild;
  if (route.fullscreenDialog) {
    wrappedChild = child;
  } else {
    wrappedChild = _FancyBackGestureDetector<T>(
      enabledCallback: () => _isPopGestureEnabled(route, canSwipe()),
      onStartPopGesture: () {
        assert(_isPopGestureEnabled(route, canSwipe()));
        return _startPopGesture(route);
      },
      canOnlySwipeFromEdge: canOnlySwipeFromEdge,
      backGestureDetectionWidth: backGestureDetectionWidth,
      backGestureDetectionStartOffset: backGestureDetectionStartOffset,
      child: child,
    );
  }

  transitionBuilder ??= _defaultTransitionBuilder(route.fullscreenDialog);
  return transitionBuilder(
    context,
    animation,
    secondaryAnimation,
    /* isSwipeGesture: */ route.popGestureInProgress,
    wrappedChild,
  );
}