Open simvux opened 5 years ago
Good idea.
I wonder if this could be generalized to support loops, but I guess this is where it becomes more complicated and might require a virtual "DOM" which does not seem to be the case for a match
.
Ah okay, wasn't sure if this was something that was implemented or not. If anyone's looking to do what the title of this issue describes, check out the "widget-list.rs" example and observe how you can dynamically switch widgets in your update function using the .add_widget and .remove_widget methods.
Let's say I have this view
And i want to append a GTK object based on what it's in my model, how would i do it? I'd like to do something similar to this.
where model.active_box is of type gtk::Box that gets swapped at runtime
or something like
where model.active_box is an enum. Coming from Elm, this would feels like the natural way to do things in declerative style.