Skip to content

Commit

Permalink
Merge pull request #284 from lanastara/main
Browse files Browse the repository at this point in the history
Shring card body limits by head and foot size
  • Loading branch information
genusistimelord authored Sep 2, 2024
2 parents 0f616fe + 8b5e00a commit 5482588
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 5482588

Please sign in to comment.