CupertinoPageTransition constructor

CupertinoPageTransition({Key key, @required Animation<double> primaryRouteAnimation, @required Animation<double> secondaryRouteAnimation, @required Widget child, @required bool linearTransition })

Creates an iOS-style page transition.

  • primaryRouteAnimation is a linear route animation from 0.0 to 1.0 when this screen is being pushed.
  • secondaryRouteAnimation is a linear route animation from 0.0 to 1.0 when another screen is being pushed on top of this one.
  • linearTransition is whether to perform primary transition linearly. Used to precisely track back gesture drags.

Implementation

CupertinoPageTransition({
  Key key,
  @required Animation<double> primaryRouteAnimation,
  @required Animation<double> secondaryRouteAnimation,
  @required this.child,
  @required bool linearTransition,
}) : assert(linearTransition != null),
     _primaryPositionAnimation = (linearTransition ? primaryRouteAnimation :
       CurvedAnimation(
         parent: primaryRouteAnimation,
         curve: Curves.easeOut,
         reverseCurve: Curves.easeIn,
       )
     ).drive(_kRightMiddleTween),
     _secondaryPositionAnimation = CurvedAnimation(
       parent: secondaryRouteAnimation,
       curve: Curves.easeOut,
       reverseCurve: Curves.easeIn,
     ).drive(_kMiddleLeftTween),
     _primaryShadowAnimation = CurvedAnimation(
       parent: primaryRouteAnimation,
       curve: Curves.easeOut,
     ).drive(_kGradientShadowTween),
     super(key: key);