AnimatedCounter class
Animates a numeric value with smooth transitions between changes.
Supports integers and decimals, optional color lerp via activeColor, and a completion pulse animation via scalePulse.
AnimatedCounter(
value: 42,
duration: Duration(seconds: 2),
decimals: 1,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedCounter
Constructors
- AnimatedCounter({Key? key, required num value, Duration duration = const Duration(milliseconds: 1000), Curve curve = Curves.easeOut, TextStyle? style, String format(num)?, bool autoplay = true, bool keepAlive = true, int decimals = 0, Color? activeColor, bool scalePulse = false})
-
Creates an AnimatedCounter for the given
value.const
Properties
- activeColor → Color?
-
When set, the text color interpolates from the style color to this
color over the animation duration.
final
- autoplay → bool
-
Whether the animation starts automatically on mount or value change.
final
- curve → Curve
-
Curve applied to the value interpolation.
final
- decimals → int
-
Number of decimal places to display (0 for integer formatting).
final
- duration → Duration
-
Duration of the animation from current to target value.
final
- format → String Function(num)?
-
Optional custom formatter for the displayed string.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- keepAlive → bool
-
When true (default), animation state survives scroll-off in a lazy list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scalePulse → bool
-
When true, triggers a short scale pulse near animation completion.
final
- style → TextStyle?
-
Text style for the displayed number.
final
- value → num
-
The target numeric value to animate toward.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedCounter> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited