ChartAnimationController class

Manages entrance and data-update animations for one chart.

Attach to a StatefulWidget and call forward() in initState. Listen via addListener — it calls the listener on every tick.

late final _anim = ChartAnimationController(vsync: this);

@override
void initState() {
  super.initState();
  _anim.forward();
  _anim.addListener(() => setState(() {}));
}

// In the painter: read _anim.progress to scale bar heights etc.

Constructors

ChartAnimationController({required TickerProvider vsync, ChartAnimationPreset preset = ChartAnimationPreset.grow})

Properties

animation Animation<double>
no setter
controller AnimationController
no setter
hashCode int
The hash code for this object.
no setterinherited
isCompleted bool
no setter
isDisposed bool
Whether this animation controller has been disposed.
no setter
preset ChartAnimationPreset
final
progress double
Current animation progress 0..1.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vsync TickerProvider
final

Methods

addListener(VoidCallback cb) → void
dispose() → void
forward() Future<void>
Play the entrance animation once from the beginning.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(VoidCallback cb) → void
replay({Duration? delay}) Future<void>
Replay the animation (e.g., after data changes).
reset() → void
stop() → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited