AnimatedCounter constructor

const AnimatedCounter({
  1. Key? key,
  2. required num value,
  3. Duration duration = const Duration(milliseconds: 1000),
  4. Curve curve = Curves.easeOut,
  5. TextStyle? style,
  6. String format(
    1. num
    )?,
  7. bool autoplay = true,
  8. bool keepAlive = true,
  9. int decimals = 0,
  10. Color? activeColor,
  11. bool scalePulse = false,
})

Creates an AnimatedCounter for the given value.

value — target numeric value to animate toward (required). duration — animation duration from current to target value. curve — easing curve for value interpolation. style — text style for the displayed number. format — optional custom formatter for the displayed string. autoplay — whether animation starts on mount or value change. keepAlive — preserves animation state in scroll-off. decimals — decimal places (0 = integer display). activeColor — optional color lerp target from style color. scalePulse — short scale pulse near animation completion.

Implementation

const AnimatedCounter({
  super.key,
  required this.value,
  this.duration = const Duration(milliseconds: 1000),
  this.curve = Curves.easeOut,
  this.style,
  this.format,
  this.autoplay = true,
  this.keepAlive = true,
  this.decimals = 0,
  this.activeColor,
  this.scalePulse = false,
});