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

Suggestion: Linear indicator should display only part of linear gradient #31

Closed
shaxxx opened this issue Jun 23, 2019 · 6 comments
Closed

Comments

@shaxxx
Copy link
Contributor

shaxxx commented Jun 23, 2019

I believe current implementation of linear gradient does not fit well with linear percent indicator use case. IMHO indicator should shade only part of linear gradient (according to progress value), not entire gradient.
For example bellow I specified linear gradient with 4 colors (red, orange, yellow, green) to create 'VU effect'. Upper progress bar is the way I believe indicator should render gradient, lower one is current behavior. No matter what progress value is set entire gradient is visible.

gradient

It's just a matter of changing shader offset values in 2 places (original code below)

_paintLine.shader = linearGradient.createShader(Rect.fromPoints(
Offset(size.width, size.height), Offset(xProgress, size.height)));

_paintLine.shader = linearGradient.createShader(
Rect.fromPoints(Offset.zero, Offset(xProgress, size.height)));

I can make a PR but I feel this needs some feedback from you.
Can this functionality at least be available as an option?
Thanks for the great widget!

@diegoveloper
Copy link
Owner

diegoveloper commented Jun 23, 2019 via email

@shaxxx
Copy link
Contributor Author

shaxxx commented Jun 23, 2019

Should both circular and linear indicators have same option?

@diegoveloper
Copy link
Owner

diegoveloper commented Jun 23, 2019 via email

@diegoveloper
Copy link
Owner

done! and published :)

@MobileMon
Copy link

Yeah I really need this functionality for the Circular. Any clue how to implement?

@shaxxx
Copy link
Contributor Author

shaxxx commented Jun 26, 2020

I had to make kinda 'hackish' solution for myself.
You can see it in action HERE or in VIDEO.
Source code HERE

Also since then, some new packages became available.
Check out THIS one.
You can see it in action HERE
I've never tried it though.

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

3 participants