AnimationBuilder<T> class
Animates toward value whenever it changes across a rebuild, rebuilding builder with the current interpolated value each frame. Owns its Animation internally — nothing to dispose.
By default the value moves with a spring (Spring.smooth), which keeps its momentum when value changes again mid-flight. Pass spring to pick another spring, or curve (with an optional duration) for fixed-length easing instead.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- AnimationBuilder
- Available extensions
Constructors
-
AnimationBuilder(T value, {required Widget builder(BuildContext context, T value, Widget? child), Spring? spring, Curve? curve, Duration? duration, AnimationType<
T> ? type, Widget? child, VoidCallback? onEnd, String? debugLabel, Key? key}) -
const
Properties
- builder → Widget Function(BuildContext context, T value, Widget? child)
-
Receives the current interpolated value and the unchanged child each
frame.
final
- child → Widget?
-
A subtree that does not depend on the animated value. It is passed back
to builder unchanged so callers can avoid rebuilding static content on
every animation frame.
final
- curve → Curve?
-
Easing for a fixed-length animation instead of a spring, lasting
duration (250 ms when that is null). Setting both this and spring
throws.
final
- debugLabel → String?
-
A label included in diagnostics for the internally-owned Animation.
final
- duration → Duration?
-
How long a curve animation lasts; null means 250 ms. Only valid with
curve: setting it without one throws, because a spring's timing comes
from the Spring itself.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
finalinherited
- onEnd → VoidCallback?
-
Called when the latest target change reaches its destination naturally.
Superseded animations and disposal do not call this callback.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spring → Spring?
-
Spring to use when value changes. When both this and curve are null,
the spring is Spring.smooth. Setting both this and curve throws.
final
-
type
→ AnimationType<
T> ? -
Required only for non-built-in
T(built-ins: double, int, RgbColor, CellOffset).final - value → T
-
The target. The first build snaps here; later changes animate.
final
Methods
-
animate(
{Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate -
Available on Widget, provided by the AnimateExtension extension
Starts an Animate chain over this widget.duration/curveapply to the whole chain. With notriggerit plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes. -
createElement(
) → StatefulElement -
Creates the Element that will mount this widget into the tree.
inherited
-
createState(
) → State< AnimationBuilder< T> > -
Creates the mutable state for this widget at the current location in
the tree. Called exactly once per StatefulElement instance.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited