Add a Flexible element that works like in Flutter
This commit is contained in:
@@ -964,13 +964,13 @@ impl View for Workspace {
|
||||
if let Some(element) =
|
||||
self.left_sidebar.render_active_item(&settings, cx)
|
||||
{
|
||||
content.add_child(element);
|
||||
content.add_child(Flexible::new(0.8, element).boxed());
|
||||
}
|
||||
content.add_child(Expanded::new(1.0, self.center.render()).boxed());
|
||||
if let Some(element) =
|
||||
self.right_sidebar.render_active_item(&settings, cx)
|
||||
{
|
||||
content.add_child(element);
|
||||
content.add_child(Flexible::new(0.8, element).boxed());
|
||||
}
|
||||
content.add_child(self.right_sidebar.render(&settings, cx));
|
||||
content.boxed()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user