AnimatedValueBuilder<T> constructor
const
AnimatedValueBuilder<T> ({})
Creates an AnimatedValueBuilder with value-based animation.
This is the standard constructor that animates between values using a simple builder callback. The builder receives the current interpolated value and can construct the appropriate widget tree.
Parameters:
initialValue
(T?, optional): Starting value for animation. If null, no initial animation occurs.value
(T, required): Target value to animate to.duration
(Duration, required): Animation duration.builder
(AnimatedChildBuilderonEnd
(Function?, optional): Called when animation completes.curve
(Curve, default: Curves.linear): Animation timing curve.lerp
(Function?, optional): Custom interpolation for complex types.child
(Widget?, optional): Optional child passed to builder.
Example:
AnimatedValueBuilder<double>(
initialValue: 0.0,
value: 1.0,
duration: Duration(milliseconds: 500),
curve: Curves.easeInOut,
builder: (context, opacity, child) => Opacity(
opacity: opacity,
child: Text('Hello World'),
),
);
Implementation
const AnimatedValueBuilder({
super.key,
this.initialValue,
required this.value,
required this.duration,
required AnimatedChildBuilder<T> this.builder,
this.onEnd,
this.curve = Curves.linear,
this.lerp,
this.child,
}) : animationBuilder = null,
rawBuilder = null;