-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add functionality to make TextInput
disabled
#1744
Conversation
I would rather this be like the button. Have the text input by default be disabled like a button, but have an |
But that requires changing the API, which might break back-compatibility. It's not a problem to rewrite it, but I would like to know if it is okay to actually implement breaking changes at this point |
.disabled()
option for TextInput
TextInput
disabled
I changed API, now it works like a button. It is not enabled if there is no callback for I also change the example, I added an async 3 seconds timer to test an edge-case when the field is focused and gets disabled, suggested in discord by nicoburns#9458. Finally, I updated all examples for the new API |
1741f96
to
ce4c4fe
Compare
ce4c4fe
to
9ffd65b
Compare
9ffd65b
to
7e69cb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank your taking a shot at this! 🙇
I have made some important changes:
- Renamed
on_change
toon_input
in e6a93e9. I believe it conveys more intent. - Added some diffing logic to unfocus the input if it suddenly becomes disabled in 7e69cb4.
- Fine-tuned the disabled styling a bit in 1de794a.
- Changed the
mouse_interaction
to display a newNotAllowed
mouse icon when hovering a disabled input in 7e7e665.
And that's it! Let's merge!
People have been asking to add disabled state for several widgets in #1066. The most liked comment was about adding the state to the
TextEdit
widget. Indeed, it's quite useful to have functionalty to prevent user from changing the content of the text edit fields.I added new logic and a theme for the widget to implement the functionality.
Now text edit can be enabled/disabled like this: