Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fenchai23 opened this issue May 4, 2020 · 3 comments

Comments

@fenchai23
Copy link

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

@diegoveloper
Copy link
Owner

diegoveloper commented May 4, 2020 via email

@fenchai23
Copy link
Author

fenchai23 commented May 4, 2020

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.

@diegoveloper
Copy link
Owner

diegoveloper commented May 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants