SimpleCupertinoPageTransition constructor

SimpleCupertinoPageTransition({
  1. Key? key,
  2. required Animation<double> primaryRouteAnimation,
  3. required Animation<double> secondaryRouteAnimation,
  4. required Widget child,
  5. Curve routeCurve = Curves.linearToEaseOut,
  6. Curve reverseRouteCurve = Curves.easeInToLinear,
  7. DecorationTween? decoration,
})

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 the transitions linearly. Used to precisely track back gesture drags.

Implementation

SimpleCupertinoPageTransition({
  Key? key,
  required Animation<double> primaryRouteAnimation,
  required Animation<double> secondaryRouteAnimation,
  required this.child,
  Curve routeCurve = Curves.linearToEaseOut,
  Curve reverseRouteCurve = Curves.easeInToLinear,
  DecorationTween? decoration,
})  : _primaryPositionAnimation = CurvedAnimation(
        parent: primaryRouteAnimation,
        curve: routeCurve,
        reverseCurve: reverseRouteCurve,
      ).drive(_kRightMiddleTween),
      _secondaryPositionAnimation = CurvedAnimation(
        parent: secondaryRouteAnimation,
        curve: routeCurve,
        reverseCurve: reverseRouteCurve,
      ).drive(_kMiddleLeftTween),
      _userGesturePrimaryPositionAnimation = CurvedAnimation(
        parent: primaryRouteAnimation,
        curve: Curves.linear,
        reverseCurve: Curves.linear,
      ).drive(_kRightMiddleTween),
      _userGestureSecondaryPositionAnimation = CurvedAnimation(
        parent: secondaryRouteAnimation,
        curve: Curves.linear,
        reverseCurve: Curves.linear,
      ).drive(_kMiddleLeftTween),
      _primaryShadowAnimation = decoration != null
          ? CurvedAnimation(
              parent: primaryRouteAnimation,
              curve: routeCurve,
            ).drive(decoration)
          : null,
      super(key: key);