RenderAnimatedSize constructor

RenderAnimatedSize({
  1. required TickerProvider vsync,
  2. required Duration duration,
  3. Duration? reverseDuration,
  4. Curve curve = Curves.linear,
  5. AlignmentGeometry alignment = Alignment.center,
  6. TextDirection? textDirection,
  7. RenderBox? child,
  8. Clip clipBehavior = Clip.hardEdge,
  9. VoidCallback? onEnd,
})

Creates a render object that animates its size to match its child. The duration and curve arguments define the animation.

The alignment argument is used to align the child when the parent is not (yet) the same size as the child.

The duration is required.

The vsync should specify a TickerProvider for the animation controller.

The arguments duration, curve, alignment, and vsync must not be null.

Implementation

RenderAnimatedSize({
  required TickerProvider vsync,
  required Duration duration,
  Duration? reverseDuration,
  Curve curve = Curves.linear,
  super.alignment,
  super.textDirection,
  super.child,
  Clip clipBehavior = Clip.hardEdge,
  VoidCallback? onEnd,
}) : _vsync = vsync,
     _clipBehavior = clipBehavior {
  _controller = AnimationController(
    vsync: vsync,
    duration: duration,
    reverseDuration: reverseDuration,
  )..addListener(() {
    if (_controller.value != _lastValue) {
      markNeedsLayout();
    }
  });
  _animation = CurvedAnimation(
    parent: _controller,
    curve: curve,
  );
  _onEnd = onEnd;
}