flutter_percent_indicator icon indicating copy to clipboard operation
flutter_percent_indicator copied to clipboard

Feature Request: Have the animations go in reverse instead of clockwise

Open fenchai23 opened this issue 5 years ago • 3 comments

if percent is 0.4 then animate from 1.0 to 0.4 instead of 0.0 to 0.4. is this possible?

fenchai23 avatar May 04 '20 06:05 fenchai23

Show us a small code to reproduce that issue.

On Mon, May 4, 2020, 1:50 AM fenchai [email protected] wrote:

if percent is 0.4 then animate from 1.0 to 0.4 instead of 0.0 to 0.4. is this possible?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/diegoveloper/flutter_percent_indicator/issues/55, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFL3UDNDXJD5BL55LV4LC3RPZQTNANCNFSM4MYP55GA .

diegoveloper avatar May 04 '20 12:05 diegoveloper

this is just a simple linear progress widget:

LinearPercentIndicator​(
              width​:​ ​MediaQuery​.​of​(context).size.width ​*​ ​0.6​,
              animation​:​ ​true​,
              lineHeight​:​ ​20.0​,
              animationDuration​:​ ​2500​,
              percent​:​ _percent ​/​ ​100​,
              center​:​ ​AutoSizeText​(
                item.daysLeft ​+​ ​' d'​,
                style​:​ ​TextStyle​(
                    color​:​
                        ​Theme​.​of​(context).colorScheme.onPrimary.​withAlpha​(​220​)),
                maxLines​:​ ​1​,
              ),
              linearStrokeCap​:​ ​LinearStrokeCap​.roundAll,
              progressColor​:​ _percent ​>​ ​50​
                  ​?​ ​Colors​.green
                  ​:​ _percent ​>​ ​30​
                      ​?​ ​Colors​.yellow[​800​]
                      ​:​ _percent ​>​ ​0​ ​?​ ​Colors​.red ​:​ ​Colors​.white,
              backgroundColor​:​ ​Theme​.​of​(context).scaffoldBackgroundColor,
            )

I think there is a boolean for animate from last percentage, this one can actually do a reverse animation, and I think I can do it by setting the percentages to 1.0 then just lower them to their actual percentage. But this seems more like a hack to me.

I would just like the animation going counter clockwise instead of clockwise.

Like say an HP bar, if it is at 20% I would like it go from 100% to 20% instead of 0% to 20% as it makes no sense.

fenchai23 avatar May 04 '20 16:05 fenchai23

Yes you can use animateFromLastPercentage , in other case pull requests are open

On Mon, May 4, 2020 at 11:01 AM fenchai [email protected] wrote:

this is just a simple linear progress widget:

LinearPercentIndicator​( width​:​ ​MediaQuery​.​of​(context).size.width ​*​ ​0.6​, animation​:​ ​true​, lineHeight​:​ ​20.0​, animationDuration​:​ ​2500​, percent​:​ _percent ​/​ ​100​, center​:​ ​AutoSizeText​( item.daysLeft ​+​ ​' d'​, style​:​ ​TextStyle​( color​:​ ​Theme​.​of​(context).colorScheme.onPrimary.​withAlpha​(​220​)), maxLines​:​ ​1​, ), linearStrokeCap​:​ ​LinearStrokeCap​.roundAll, progressColor​:​ _percent ​>​ ​50​ ​?​ ​Colors​.green ​:​ _percent ​>​ ​30​ ​?​ ​Colors​.yellow[​800​] ​:​ _percent ​>​ ​0​ ​?​ ​Colors​.red ​:​ ​Colors​.white,

I think there is a boolean for animate from last percentage, this one can actually do a reverse animation, and I think I can do it by setting the percentages to 1.0 then just lower them to their actual percentage. But this seems more like a hack to me.

I would just like the animation going counter clockwise instead of clockwise.

Like say an HP bar, if it is at 20% I would like it go from 100% to 20% instead of 0% to 20% as it makes no sense.

          backgroundColor​:​ ​Theme​.​of​(context).scaffoldBackgroundColor,
        ),

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/diegoveloper/flutter_percent_indicator/issues/55#issuecomment-623551969, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFL3UAZLOFHGDEKJ4DZAP3RP3REBANCNFSM4MYP55GA .

diegoveloper avatar May 04 '20 16:05 diegoveloper