raphlinus / crochet

Explorations in reactive UI patterns
Apache License 2.0
367 stars 21 forks source link

Port the Padding widget. #13

Closed luleyleo closed 3 years ago

luleyleo commented 3 years ago

There are two interesting things about this:

First, I had to copy the Padding widget and change its child type to AnyWidget, otherwise I could not call mutate_update. So I don't think we can use any of Druids container widgets that use WidgetPod<dyn Widget<T>> for their child.

Second, I had to find a way to deal with the fact that the Crochet style of writing the UI does not offer a good way to deal with single child containers. For simplicity, I chose to allow multiple children and just warn about it, then only apply events to the first child.