fix(ui-gpui): layout flex-1 + min-width for side-by-side grid

This commit is contained in:
Hibryda 2026-03-20 00:45:54 +01:00
parent c61262c604
commit 14a3dbd096

View file

@ -224,12 +224,14 @@ impl Element for ProjectBoxFullElement {
std::mem::swap(&mut content, &mut self.content); std::mem::swap(&mut content, &mut self.content);
let child_id = content.request_layout(window, cx); let child_id = content.request_layout(window, cx);
// Root style: fill parent, flex-col (chrome occupies fixed top portion via paint). // Root style: flex-1 with min constraints (allows 2 boxes side-by-side in flex-wrap grid).
let style = Style { let style = Style {
size: size(relative(1.0).into(), relative(1.0).into()), flex_grow: 1.0,
flex_shrink: 0.0, flex_shrink: 0.0,
min_size: size(px(400.0).into(), px(300.0).into()),
display: Display::Flex, display: Display::Flex,
flex_direction: FlexDirection::Column, flex_direction: FlexDirection::Column,
overflow: Point { x: Overflow::Hidden, y: Overflow::Hidden },
..Style::default() ..Style::default()
}; };
(window.request_layout(style, [child_id], cx), content) (window.request_layout(style, [child_id], cx), content)
@ -259,6 +261,15 @@ impl Element for ProjectBoxFullElement {
window: &mut Window, window: &mut Window,
cx: &mut App, cx: &mut App,
) { ) {
// 0. Card background + border (rounded rect)
window.paint_quad(PaintQuad {
bounds,
corner_radii: Corners::all(px(8.0)),
background: theme::BASE.into(),
border_widths: Edges::all(px(1.0)),
border_color: theme::SURFACE0.into(),
border_style: BorderStyle::default(),
});
// 1. Paint header + tabs directly. // 1. Paint header + tabs directly.
paint_chrome(bounds, &self.name, &self.cwd, self.accent, self.status, paint_chrome(bounds, &self.name, &self.cwd, self.accent, self.status,
&self.blink_visible, self.active_tab, window, cx); &self.blink_visible, self.active_tab, window, cx);