Open Piotr12 opened 7 months ago
Hi @Piotr12,
There are two options you can use to currently style the OK/Close buttons.
You wrap it with a theme where the type of Text/Elevated/Outlined button you decide to use for "OK" has a more prominent style, and you can of course set labels to whatever you like.
This can look like this:
https://github.com/rydmike/flex_color_picker/assets/39990307/d08a8ddc-3848-4bb1-94f3-5a3ccb7bbd57
The above is a modified version of the default example in the repo
Custom OK 1 | Custom OK 2 |
---|---|
You can make your own dialog wrapper of the ColorPicker
and not use the built-in one at all. Doing so you can make any style dialog buttons you want. The built in was is based on AlertDialog, so it limits things a bit.
I kind of prefer the compact options where you just have close and select in the header.
Upon reading your proposal closer, I'm beginning to suspect that you would like to see a feature flag that if set makes the dialog "OK" button color follow the currently selected color?
Then you can set its label to PICK, SELECT, CHOOSE, USE or whatever. Agreed then it also needs to adjust text contrast color while it does that. This would be like what the optional color value input/indicator does below:
https://github.com/rydmike/flex_color_picker/assets/39990307/d71456ad-2049-459c-b531-e8d20578568d
And check marks also do that when you select colors.
Yes this is doable, not that tricky even. It would however only work well visually when the OK button style is set to use ElevatedButton
(like I did on above example). The default TextButton
does not have a background color, nor does OutlinedButton
. It would also work with the FilledButton
, but there is no support for it in current version, I should of course add it as well.
Is this what you had in mind? Feel free to elaborate on the feature request.
I can certainly add this as a feature to next minor feature release.
What should we call the property? okButtonUseSelectedColor
? 😄
thanks for detailed answer.
Upon reading your proposal closer, I'm beginning to suspect that you would like to see a feature flag that if set makes the dialog "OK" button color follow the currently selected color?
this is exactly what I look for and okButtonUseSelectedColor
looks like a good name. But ... after thinking a bit more and taking into account your comment it will work only for elevatedButton it may make more sense to introduce new value for ColorPickerActionButtonType
enum (no clue on good name for it :)) that will take care of that feature so its not a logical AND of 1) "new flag enabled" and 2) "right button style selected" to enable it. hope that makes sense, if not ... a bool flag will for sure do.
Sorry to say, but this colored "OK" button cannot be done within the currently used AlertDialog
. simply because the OK and Cancel buttons are in the AlertDialog
widget and not in ColorPicker
widget. So I have no access to adjusting them after the Dialog has been created, so I cannot make OK button follow follow the selected color like the color indicator/entry field.
Best I can do in next release (v.3.4.0) is recommend using the "filled" button for OK as prominent one if so needed, and not having any cancel button (also new in 3.4.0 to not have a bottom cancel button when bottom dialog buttons are used), only close in upper corner and tapping outside dialog as close:
It is possible to build this, but then I need to add own bottom OK / Cancel buttons in the Dialog and having them as an option that are used if you opt for the selected color following OK button. Doable, I might return to this in version 4.0.0. When I am doing a lot of other planned changes.
Keeping this feature request issue open as reminder.
I have noticed some of my app users have difficulty noticing they need to confirm color selection by clicking the OK button. Seriously, some close the dialog and are surprised the color was not changed.
Question: Would it be ok to add a bool parameter in the ColorPickerActionButtons (updateOKButtonLikeCrazyToShowUsersWhatITDoes is the working title) that would modify the background color of the OK Button so it makes folks notice "here is what to click next" ?
If yes, I would be happy to make a PR with that, but before I start googling how to 1) modify, 2)test flutter packages locally I decided to ask not to get a "it is not welcome" response later.
PS. Font Color for the OK button shall be changed as well based on the grayscale representation of the color currently picked to avoid white font on almost-white background scenario. (https://support.ptc.com/help/mathcad/r9.0/en/index.html#page/PTC_Mathcad_Help/example_grayscale_and_color_in_images.html)