CupertinoFullscreenDialogTransition constructor

CupertinoFullscreenDialogTransition({
  1. Key? key,
  2. required Animation<double> primaryRouteAnimation,
  3. required Animation<double> secondaryRouteAnimation,
  4. required Widget child,
  5. required bool linearTransition,
})

Creates an iOS-style transition used for summoning fullscreen dialogs.

  • 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 secondary transition linearly. Used to precisely track back gesture drags.

Implementation

CupertinoFullscreenDialogTransition({
  super.key,
  required Animation<double> primaryRouteAnimation,
  required Animation<double> secondaryRouteAnimation,
  required this.child,
  required bool linearTransition,
})  : _positionAnimation = CurvedAnimation(
        parent: primaryRouteAnimation,
        curve: Curves.linearToEaseOut,
        // The curve must be flipped so that the reverse animation doesn't play
        // an ease-in curve, which iOS does not use.
        reverseCurve: Curves.linearToEaseOut.flipped,
      ).drive(_kBottomUpTween),
      _secondaryPositionAnimation = (linearTransition
              ? secondaryRouteAnimation
              : CurvedAnimation(
                  parent: secondaryRouteAnimation,
                  curve: Curves.linearToEaseOut,
                  reverseCurve: Curves.easeInToLinear,
                ))
          .drive(_kMiddleLeftTween);