-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Implement Toggler
widget for iced_native
#535
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
Conversation
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.
This seems like a great start!
What I would like to see:
- More flexibility when it comes to the label. Right now, we've got a String on the left side of the toggler. I'd like to see a generic
impl Into<Element<'a, Message>>
as the label, with the option of placing it on the right or left side. - Maybe instead of the previous, we simply add a
with_toggler
helper method that joins the elements to a toggler, and the toggler itself becomes a standalone widget without the label. - Either an example program showing off the toggler, or an update to the
tour
example with toggler in there
Thank you very much for reviewing my PR.
|
You might want a small SVG image to be the label instead of a String of text. If you want to bold a portion of the label, you'll need more than one Text joined with a container. I think it's more useful, like you say, to avoid the label altogether, or use |
Let's keep things simple! I think it's fine to satisfy only a subset of potential use cases. I prefer to tackle a small amount of specific use cases directly instead of a flexible API that can be used wrong. That said, I believe removing the label would simplify the widget considerably. We should probably come up with a |
I've now made the label optional and added a function to specify the alignment of the label. Specifying the alignment of the label can be usefull when using a 'right to left' language instead of a 'left to right' language. In addition, I've also added the Currently the default width of the widget is |
I've now added the Toggler widget to iced_web as well. However, I'm unhappy about the css styling. Maybe someone with more experience in web developement could take a look into it. |
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.
I have rebased on top of master
and made a couple of small changes.
I think we can finally merge this! Thank you @Kaiden42! 🎉
This PR implements the Toggler widget mentioned in #528 . The Toggler widget works similar to the Checkbox widget.
I am open to suggestions for improvement. Currently iced_web is not supported, but maybe I can check it out in the near future.
Closes #528.