Skip to content

Commit

Permalink
Shring card body limits by head and foot size
Browse files Browse the repository at this point in the history
  • Loading branch information
lanastara committed Sep 2, 2024
1 parent 0f616fe commit 8b5e00a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/widget/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ where
tree,
);

let limits = limits.shrink(Size::new(0.0, head_node.size().height));

let mut foot_node = self.foot.as_ref().map_or_else(Node::default, |foot| {
foot_node(renderer, &limits, foot, self.padding_foot, self.width, tree)
});
let limits = limits.shrink(Size::new(0.0, foot_node.size().height));
let mut body_node = body_node(
renderer,
&limits,
Expand All @@ -276,17 +282,12 @@ where
self.width,
tree,
);

let body_bounds = body_node.bounds();
body_node = body_node.move_to(Point::new(
body_bounds.x,
body_bounds.y + head_node.bounds().height,
));

let mut foot_node = self.foot.as_ref().map_or_else(Node::default, |foot| {
foot_node(renderer, &limits, foot, self.padding_foot, self.width, tree)
});

let foot_bounds = foot_node.bounds();

foot_node = foot_node.move_to(Point::new(
Expand Down

0 comments on commit 8b5e00a

Please sign in to comment.