buildPageTransitions<T> static method
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,
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:
- CupertinoPageTransitionsBuilder, which uses this method to define a PageTransitionsBuilder for the PageTransitionsTheme.
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,
);
}