RenderAnimatedSize constructor
- required TickerProvider vsync,
- required Duration duration,
- Duration? reverseDuration,
- Curve curve = Curves.linear,
- AlignmentGeometry alignment = Alignment.center,
- TextDirection? textDirection,
- RenderBox? child,
- Clip clipBehavior = Clip.hardEdge,
- 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;
}