build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Animation<double> primaryAnimation,
  3. Animation<double> secondaryAnimation,
  4. Widget child,
)

Implementation

@override
Widget build(BuildContext context, Animation<double> primaryAnimation,
    Animation<double> secondaryAnimation, Widget child) {
  var exitAnimation = secondaryAnimation as ProxyAnimation;

  if (!exitAnimation.isDismissed) {
    var animation = CurvedAnimation(parent: secondaryAnimation, curve: curve);

    return Container(
        color: backgroundColor,
        child: Opacity(
            opacity: animation.value > 0.5 ? 0 : 1,
            child: Transform(
                alignment: exitPageAlignment,
                transform: Matrix4.identity()
                  ..setEntry(3, 2, 0.002)
                  ..rotateX(math.pi * animation.value * (reverse ? -1 : 1)),
                child: child)));
  } else {
    var animation = CurvedAnimation(parent: primaryAnimation, curve: curve);

    return Opacity(
        opacity: animation.value > 0.5 ? 1 : 0,
        child: Transform(
            alignment: enterPageAlignment,
            transform: Matrix4.identity()
              ..setEntry(3, 2, 0.002)
              ..rotateX(
                  -math.pi * (1 - animation.value) * (reverse ? -1 : 1)),
            child: child));
  }
}