buildAnimatedChild method
Returns the transformed widget for the current animation tick. The
child argument is the unchanged widget.child, ready to be wrapped
in Transform, Opacity, etc.
Implementation
@override
Widget buildAnimatedChild(BuildContext context, Widget child) {
final double t = _progress.value;
final double angle = t * pi / 2;
final double verticalRadius = widget.bottom - widget.top;
final double horizontalDelta = widget.right - widget.left;
final double offsetY = widget.upward
? -verticalRadius.abs() * sin(angle)
: verticalRadius * (1 - cos(angle));
final double offsetX = horizontalDelta * t;
return Transform.translate(
offset: Offset(offsetX, offsetY),
child: child,
);
}