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
+1 -1
View File
@@ -191,7 +191,7 @@ impl Pane {
let border = &theme.workspace.tab.container.border;
row.add_child(
Expanded::new(
Flexible::new(
1.0,
MouseEventHandler::new::<Tab, _, _, _>(item.id(), cx, |mouse_state, cx| {
let title = item.title(cx);
+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));