How to make scrolling counter in flutter
i use tween animation with animation builder
IntTween(begin: 0, end: starredCount).animate(
CurvedAnimation(parent: animationController, curve: Curves.easeOut)
I wanted to do this in a project, so I create an implicit animation widget, called AnimatedFlipCounter
, that achieves similar effect.
I have published it as a package: https://pub.dev/packages/animated_flip_counter
Usage:
AnimatedFlipCounter(
duration: Duration(milliseconds: 500),
value: _value, /* pass in a number like 2014 */
)
Decimals:
AnimatedFlipCounter(
value: _value,
fractionDigits: 2, // decimal precision
suffix: "%",
textStyle: TextStyle(
fontSize: 40,
color: _value >= 0 ? Colors.green : Colors.red,
),
)