h65wang/flutter-animated-counter

prepending zero

Closed this issue · 2 comments

ench0 commented

I am trying to use this widget for a simple 2-digit countdown and also for a clock. I need 2-digits shown at any time (ie 11, 10, 09, 08, 07...). I can prepend '0' for values that are <10 but I will lose the animation for that zero that's added. Any way to have this feature?

My current workaround:

AnimatedFlipCounter(
  value: time.toDouble(),
  prefix: time<10 ? '0' : '',
),

Good idea. This has been added in 0.2.0 with a new property called wholeDigits. For example, wholeDigits: 4 means it will pad 48 into 0048. Please help test this new feature and let me know how it goes. Thanks!

ench0 commented

Thanks for the quick fix, this seems to work great so far!