maxkeppeler / sheets-compose-dialogs

✨ Enhancing Android UIs: A Jetpack Compose Library supporting a wide range of common use-cases with Material Design 3 Dialogs, Popups, and Bottom Sheets. ✨
https://maxkeppeler.github.io/sheets-compose-dialogs/
Apache License 2.0
807 stars 38 forks source link

[Feature] Add enabled state to dialog buttons #42

Closed Nek-12 closed 1 year ago

Nek-12 commented 1 year ago

We're facing a use-case where we want to show a dialog to the user with a timeout on an OK button to force the user to pay attention. Right now, the InfoDialog has no way of setting a button as "disabled". This could be achieved, in its simplest form, by allowing to configure the color of the button text for SelectionButtons, or as a better solution, by allowing to set a property such as enabled: Boolean on a dialog button to set whether it's clickable or not.

maxkeppeler commented 1 year ago

After realizing that all the Selection classes and remember functions need to be fixed for the buttons to recompose correctly, considering the enabled state inside the selection button overrides the internal button enabled state based on the use-case validity, I decided to pause. I suggest exploring alternative approaches to draw extra attention to the positive button. Have you considered experimenting with button styles? For example, using a text button for the cancel option and a filled button for the positive action.

Nek-12 commented 1 year ago

Alright, I respect your decision here. Yes for now we agreed to use a different UX for this usecase. Dialogs with timeouts aren't a perfect solution for the problem we faced anyway. However, would you be willing to merge a PR that implements the functionality if I come around to implementing it?