Allow flex items to float to the end of the flex axis
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
621e67bca7
commit
0453dd1101
16 changed files with 138 additions and 104 deletions
|
@ -612,7 +612,7 @@ impl Pane {
|
|||
Empty::new()
|
||||
.contained()
|
||||
.with_border(theme.workspace.tab.container.border)
|
||||
.flexible(0., true)
|
||||
.flex(0., true)
|
||||
.named("filler"),
|
||||
);
|
||||
|
||||
|
@ -641,7 +641,7 @@ impl View for Pane {
|
|||
Flex::column()
|
||||
.with_child(self.render_tabs(cx))
|
||||
.with_child(ChildView::new(&self.toolbar).boxed())
|
||||
.with_child(ChildView::new(active_item).flexible(1., true).boxed())
|
||||
.with_child(ChildView::new(active_item).flex(1., true).boxed())
|
||||
.boxed()
|
||||
} else {
|
||||
Empty::new().boxed()
|
||||
|
|
|
@ -248,7 +248,7 @@ impl PaneAxis {
|
|||
member = Container::new(member).with_border(border).boxed();
|
||||
}
|
||||
|
||||
Flexible::new(1.0, true, member).boxed()
|
||||
FlexItem::new(member).flex(1.0, true).boxed()
|
||||
}))
|
||||
.boxed()
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ impl Sidebar {
|
|||
let width = self.width.clone();
|
||||
move |size, _| *width.borrow_mut() = size.x()
|
||||
})
|
||||
.flexible(1., false)
|
||||
.flex(1., false)
|
||||
.boxed(),
|
||||
);
|
||||
if matches!(self.side, Side::Left) {
|
||||
|
|
|
@ -47,12 +47,12 @@ impl View for StatusBar {
|
|||
.with_margin_right(theme.item_spacing)
|
||||
.boxed()
|
||||
}))
|
||||
.with_child(Empty::new().flexible(1., true).boxed())
|
||||
.with_children(self.right_items.iter().map(|i| {
|
||||
ChildView::new(i.as_ref())
|
||||
.aligned()
|
||||
.contained()
|
||||
.with_margin_left(theme.item_spacing)
|
||||
.flex_float()
|
||||
.boxed()
|
||||
}))
|
||||
.contained()
|
||||
|
|
|
@ -46,12 +46,12 @@ impl View for Toolbar {
|
|||
.with_margin_right(theme.item_spacing)
|
||||
.boxed()
|
||||
}))
|
||||
.with_child(Empty::new().flexible(1., true).boxed())
|
||||
.with_children(self.right_items.iter().map(|i| {
|
||||
ChildView::new(i.as_ref())
|
||||
.aligned()
|
||||
.contained()
|
||||
.with_margin_left(theme.item_spacing)
|
||||
.flex_float()
|
||||
.boxed()
|
||||
}))
|
||||
.contained()
|
||||
|
|
|
@ -1946,36 +1946,35 @@ impl View for Workspace {
|
|||
if let Some(element) =
|
||||
self.left_sidebar.render_active_item(&theme, cx)
|
||||
{
|
||||
content.add_child(Flexible::new(0.8, false, element).boxed());
|
||||
content
|
||||
.add_child(FlexItem::new(element).flex(0.8, false).boxed());
|
||||
}
|
||||
content.add_child(
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Flexible::new(
|
||||
1.,
|
||||
true,
|
||||
self.center.render(
|
||||
&theme,
|
||||
&self.follower_states_by_leader,
|
||||
self.project.read(cx).collaborators(),
|
||||
),
|
||||
)
|
||||
FlexItem::new(self.center.render(
|
||||
&theme,
|
||||
&self.follower_states_by_leader,
|
||||
self.project.read(cx).collaborators(),
|
||||
))
|
||||
.flex(1., true)
|
||||
.boxed(),
|
||||
)
|
||||
.with_child(ChildView::new(&self.status_bar).boxed())
|
||||
.flexible(1., true)
|
||||
.flex(1., true)
|
||||
.boxed(),
|
||||
);
|
||||
if let Some(element) =
|
||||
self.right_sidebar.render_active_item(&theme, cx)
|
||||
{
|
||||
content.add_child(Flexible::new(0.8, false, element).boxed());
|
||||
content
|
||||
.add_child(FlexItem::new(element).flex(0.8, false).boxed());
|
||||
}
|
||||
content.add_child(self.right_sidebar.render(&theme, cx));
|
||||
content.boxed()
|
||||
})
|
||||
.with_children(self.modal.as_ref().map(|m| ChildView::new(m).boxed()))
|
||||
.flexible(1.0, true)
|
||||
.flex(1.0, true)
|
||||
.boxed(),
|
||||
)
|
||||
.contained()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue