Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shring card body limits by head and foot size #284

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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