diegoveloper / flutter_percent_indicator

Flutter percent indicator library
BSD 2-Clause "Simplified" License
677 stars 206 forks source link

Add an 'initialPercent' field to control the initial animation. #209

Closed Erfa closed 3 months ago

diegoveloper commented 3 months ago

Isn't the same to use just 'percent' ?

Erfa commented 3 months ago

As far as I can tell, the animation always starts at zero currently. This allows customizing that. If there are other ways to achieve that I'm open to it.

diegoveloper commented 3 months ago

Oh, so you don't want just the initial animation, right? Or you want to disable the entire animation of the widget.

Erfa commented 3 months ago

Yes, I just want to disable the initial animation. I.e. if I set it to 50% it should start there, without animation. If I later set it to 100% it should animate up there.

I think animating up from zero is a nice default, but in my use case it made the UI a bit confusing.

diegoveloper commented 3 months ago

hmm I don't want to mess people with the values, so maybe you could create a bool flag like this :

https://github.com/diegoveloper/flutter_percent_indicator/blob/9ce1946f1daa2fd5212712d36964b82b673315bd/lib/linear_percent_indicator.dart#L68 .

final bool animateFromInitialValue;

and mark true by default

Erfa commented 3 months ago

I think animate to initial percent makes a bit more sense in that case, since you're toggling the animation to the initially supplied percent value. Updated with that, seems to work well!