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

Add disabled state to toggler widget #2478

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

sundaram123krishnan
Copy link
Contributor

@sundaram123krishnan sundaram123krishnan commented Jun 24, 2024

Requirement

In our pigg app, we encountered a scenario where it was necessary to disable the toggler based on user interactions. This functionality was crucial to ensure better control and flexibility within the app's user interface.
pigg

Implementation

To address this need, I implemented the disable feature for the Toggler widget in Iced. When disabled, the toggler prevents any interaction, thereby enhancing the overall user experience by providing more control over the UI components.

I have also incorporated this feature into the Tour example of Iced to showcase its functionality and usage.
tour

Your feedback and suggestions for further improvements are highly appreciated!

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Instead of a disabled method, I have introduced on_toggle and on_toggle_maybe which makes the widget work like button and text_input; for consistency.

Additionally, I have created a label method as well. This removes the awkward Some in the toggler helper.

@hecrj hecrj changed the title Add Disable Feature to Toggler Widget Add disabled state to toggler widget Sep 10, 2024
@hecrj hecrj merged commit 07c9a2a into iced-rs:master Sep 10, 2024
12 checks passed
@sundaram123krishnan
Copy link
Contributor Author

Thanks @hecrj
Would love to contribute more to this repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants