-
Notifications
You must be signed in to change notification settings - Fork 569
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
Make button work with a widget as its child #446
Conversation
Cool! I've been playing with this too.
Another thing I was experimenting with was to make the child widget take a ButtonState struct as its T. The child widget does not really need access to the application data. It needs to be a template that can draw a button, so it needs to know about the button state. That way |
Issue #1 is solved now. |
(The reason you need the Cool, I think this is definitely moving in the right direction. I would like to see if we can really simplify this. As I see it, at its most minimal a button is simply a widget that keeps track of active state, and fires an event when appropriate. Maybe we can just call this a This widget can have any child; and the commonly used children will know to draw themselves differently based on In this world I could imagine a |
One possible idea: we could experiment with this new stuff as new API, not touching button, and then clean it all up at the end? |
Hmmm maybe I'm doing it wrong but it doesn't seem like extracting |
Just a thought related to the click widget; |
Closing this in favor of #672 or something more like that. |
We've been talking about this for a while in zulip, though I'm just now realizing there's no issue for it. This is a first step toward doing some fancy buttons like a control strip and the "button" aspect of a drop-down menu, but also as-is it should be helpful for many scenarios where something needs to be "clickable".
Two issues with my implementation:
is_active
updates from its parent, onlyis_hot
, so I have to do extra event handling. (It's very possible I'm doing a very dumb error but I couldn't find it).T: Data + `static
which I'm guessing is not ideal? It's unclear to me what I'm doing weird here, because WidgetExt is working with other widgetpod-as-child widgets as-is.Also all the names for things are up for debate, but I'm pretty happy with it right now. I guess there's a larger question if this is appropriate for WidgetExt, but it felt right to me.