buildPageTransitions<T> static method
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,
) {
// 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,
),
);
}
}