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

Color of thumb circle not equals underlying color #4

Closed
S-Man42 opened this issue Apr 9, 2020 · 4 comments
Closed

Color of thumb circle not equals underlying color #4

S-Man42 opened this issue Apr 9, 2020 · 4 comments

Comments

@S-Man42
Copy link

S-Man42 commented Apr 9, 2020

colorpicker
colorpicker2

As you can see at these screenshots, and even in your demo videos, in the range of light green and red, the thumb has not the same color as the underlying color of the circle (it is turqoise and pink instead). Maybe there's a slight shift of the hue values?

@mavanpee
Copy link

mavanpee commented May 17, 2020

I resolved this on my own download. It's because the underlying gradient isn't drawn correctly, as you can see the red section is much larger than the blue, but they should be equal in length. It's a lot more noticeable if you increase the stroke width to something like 20+.

Luckily it's fixed with one line change.

In the _CirclePickerPainter class in flutter_circle_color_picker.dart, the class responsible for drawing the circle and it's gradient, change the createShader lines as follows (commented our old line in favour of the new one). Note that to avoid conflicts, I had to rename the "center" variable in this class to be called "circleCenter" instead. Here's the change:

        final sweepShader = sweepGradient.createShader(
            // Rect.fromLTWH(0, 0, radio, radio),                  // --> OLD line
            Rect.fromCircle(center: circleCenter, radius: radio),  // New Line; changed "centre" to "circleCenter"
        );

@itome
Copy link
Owner

itome commented May 18, 2020

@mavanpee Thank you! Would you make PR to fix this?

@mavanpee
Copy link

Hehe.. I'll be completely honest with you, one of the reasons I was being so descriptive in my post is because I have absolutely no idea how to do a PR myself. I've never really used github before.

@itome
Copy link
Owner

itome commented Jun 1, 2020

Thanks, I created PR and merged.
#10

@itome itome closed this as completed Jun 1, 2020
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