RenderAnimatedSize constructor

RenderAnimatedSize({@required TickerProvider vsync, @required Duration duration, Duration reverseDuration, Curve curve: Curves.linear, AlignmentGeometry alignment: Alignment.center, TextDirection textDirection, RenderBox child })

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,
  AlignmentGeometry alignment = Alignment.center,
  TextDirection textDirection,
  RenderBox child,
}) : assert(vsync != null),
     assert(duration != null),
     assert(curve != null),
     _vsync = vsync,
     super(child: child, alignment: alignment, textDirection: textDirection) {
  _controller = AnimationController(
    vsync: vsync,
    duration: duration,
    reverseDuration: reverseDuration,
  )..addListener(() {
    if (_controller.value != _lastValue)
      markNeedsLayout();
  });
  _animation = CurvedAnimation(
    parent: _controller,
    curve: curve,
  );
}