Make Shrink have priority over Fill in layout
This commit is contained in:
parent
68c0484b5c
commit
0655a20ad1
46 changed files with 264 additions and 273 deletions
|
|
@ -165,7 +165,7 @@ where
|
|||
|
||||
let title_bar_size = title_bar_layout.size();
|
||||
|
||||
let mut body_layout = self.body.as_widget().layout(
|
||||
let body_layout = self.body.as_widget().layout(
|
||||
&mut tree.children[0],
|
||||
renderer,
|
||||
&layout::Limits::new(
|
||||
|
|
@ -177,11 +177,12 @@ where
|
|||
),
|
||||
);
|
||||
|
||||
body_layout.move_to(Point::new(0.0, title_bar_size.height));
|
||||
|
||||
layout::Node::with_children(
|
||||
max_size,
|
||||
vec![title_bar_layout, body_layout],
|
||||
vec![
|
||||
title_bar_layout,
|
||||
body_layout.move_to(Point::new(0.0, title_bar_size.height)),
|
||||
],
|
||||
)
|
||||
} else {
|
||||
self.body.as_widget().layout(
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ where
|
|||
renderer: &Renderer,
|
||||
limits: &layout::Limits,
|
||||
) -> layout::Node {
|
||||
let limits = limits.pad(self.padding);
|
||||
let limits = limits.shrink(self.padding);
|
||||
let max_size = limits.max();
|
||||
|
||||
let title_layout = self.content.as_widget().layout(
|
||||
|
|
@ -228,8 +228,8 @@ where
|
|||
|
||||
let title_size = title_layout.size();
|
||||
|
||||
let mut node = if let Some(controls) = &self.controls {
|
||||
let mut controls_layout = controls.as_widget().layout(
|
||||
let node = if let Some(controls) = &self.controls {
|
||||
let controls_layout = controls.as_widget().layout(
|
||||
&mut tree.children[1],
|
||||
renderer,
|
||||
&layout::Limits::new(Size::ZERO, max_size),
|
||||
|
|
@ -240,11 +240,13 @@ where
|
|||
|
||||
let height = title_size.height.max(controls_size.height);
|
||||
|
||||
controls_layout.move_to(Point::new(space_before_controls, 0.0));
|
||||
|
||||
layout::Node::with_children(
|
||||
Size::new(max_size.width, height),
|
||||
vec![title_layout, controls_layout],
|
||||
vec![
|
||||
title_layout,
|
||||
controls_layout
|
||||
.move_to(Point::new(space_before_controls, 0.0)),
|
||||
],
|
||||
)
|
||||
} else {
|
||||
layout::Node::with_children(
|
||||
|
|
@ -253,9 +255,7 @@ where
|
|||
)
|
||||
};
|
||||
|
||||
node.move_to(Point::new(self.padding.left, self.padding.top));
|
||||
|
||||
layout::Node::with_children(node.size().pad(self.padding), vec![node])
|
||||
layout::Node::container(node, self.padding)
|
||||
}
|
||||
|
||||
pub(crate) fn operate(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue