AnimatedValueBuilder<T>.raw constructor
const
AnimatedValueBuilder<T>.raw ({})
Creates an AnimatedValueBuilder with raw interpolation control.
This constructor provides maximum control over the animation by exposing the old value, new value, and current interpolation progress. This is useful for custom transition effects or when you need to implement complex interpolation logic.
Parameters:
initialValue
(T?, optional): Starting value for animation.value
(T, required): Target value to animate to.duration
(Duration, required): Animation duration.builder
(AnimatedChildValueBuilderonEnd
(Function?, optional): Called when animation completes.curve
(Curve, default: Curves.linear): Animation timing curve.child
(Widget?, optional): Optional child passed to builder.lerp
(Function?, optional): Custom interpolation function.
Example:
AnimatedValueBuilder<Offset>.raw(
value: Offset(100, 100),
duration: Duration(milliseconds: 300),
builder: (context, oldPos, newPos, progress, child) {
return Transform.translate(
offset: Offset.lerp(oldPos, newPos, progress)!,
child: child,
);
},
child: Icon(Icons.star),
);
Implementation
const AnimatedValueBuilder.raw({
super.key,
this.initialValue,
required this.value,
required this.duration,
required AnimatedChildValueBuilder<T> builder,
this.onEnd,
this.curve = Curves.linear,
this.child,
this.lerp,
}) : animationBuilder = null,
rawBuilder = builder,
builder = null;