mchome / flutter_colorpicker

HSV(HSB)/HSL/RGB/Material color picker inspired by all the good design for your amazing flutter apps.
https://pub.dev/packages/flutter_colorpicker
MIT License
350 stars 203 forks source link

Jerky/jittery behavior when not inside an AlertDialog #80

Open QuinnFreedman opened 2 years ago

QuinnFreedman commented 2 years ago

When I place any of the color picker widgets inside an AlertDialog, they work great. But, when I put them directly in the widget tree, they don't work well. The behavior of dragging around the color cursor becomes very jittery and will sometimes jump around.

The issue is that I am updating my state in the onColorChanged callback, which in turn causes the pickerColor to change. Many colors can be represented by a number of different picker states (for example, black could be any hue) so when the pickerColor is changed, the ColorPicker jumps to an arbitrary state that could produce that color.

How do I prevent this? Why doesn't this behavior occur inside an AlertDialog? Is there a different way I am supposed to handle state? or is this a bug?