RepeatedAnimationBuilder<T> constructor
const
RepeatedAnimationBuilder<T> ({
- Key? key,
- required T start,
- required T end,
- required Duration duration,
- Curve curve = Curves.linear,
- Curve? reverseCurve,
- RepeatMode mode = RepeatMode.repeat,
- required Widget builder(
- BuildContext context,
- T value,
- Widget? child
- Widget? child,
- T lerp(
- T a,
- T b,
- double t
- bool play = true,
- Duration? reverseDuration,
Creates a RepeatedAnimationBuilder with value-based animation.
This constructor provides a simple builder that receives the current animated
value. The animation repeats continuously according to the specified mode
and can be paused/resumed with the play
parameter.
Parameters:
start
(T, required): Starting value of the animation range.end
(T, required): Ending value of the animation range.duration
(Duration, required): Duration for primary animation direction.curve
(Curve, default: Curves.linear): Easing curve for animation.reverseCurve
(Curve?, optional): Curve for reverse direction in ping-pong modes.mode
(RepeatMode, default: RepeatMode.repeat): Animation repeat behavior.builder
(Function, required): Builds widget from animated value.child
(Widget?, optional): Optional child passed to builder.lerp
(Function?, optional): Custom interpolation for complex types.play
(bool, default: true): Whether animation should be playing.reverseDuration
(Duration?, optional): Duration for reverse direction.
Example:
RepeatedAnimationBuilder<double>(
start: 0.5,
end: 1.5,
duration: Duration(seconds: 1),
mode: RepeatMode.pingPong,
curve: Curves.easeInOut,
builder: (context, scale, child) => Transform.scale(
scale: scale,
child: Icon(Icons.heart, color: Colors.red),
),
);
Implementation
const RepeatedAnimationBuilder({
super.key,
required this.start,
required this.end,
required this.duration,
this.curve = Curves.linear,
this.reverseCurve,
this.mode = RepeatMode.repeat,
required this.builder,
this.child,
this.lerp,
this.play = true,
this.reverseDuration,
}) : animationBuilder = null;