Add a Flexible element that works like in Flutter

This commit is contained in:
Antonio Scandurra
2021-09-03 11:40:18 +02:00
parent ec36d818c0
commit a0dd41cdf6
4 changed files with 143 additions and 35 deletions
+7 -3
View File
@@ -113,9 +113,13 @@ impl Sidebar {
container.add_child(self.render_resize_handle(settings, cx));
}
container.add_child(
ConstrainedBox::new(ChildView::new(active_item.id()).boxed())
.with_width(*self.width.borrow())
.boxed(),
Flexible::new(
1.,
ConstrainedBox::new(ChildView::new(active_item.id()).boxed())
.with_max_width(*self.width.borrow())
.boxed(),
)
.boxed(),
);
if matches!(self.side, Side::Left) {
container.add_child(self.render_resize_handle(settings, cx));