Skip to content

Commit

Permalink
Merge pull request #183 from turai/main
Browse files Browse the repository at this point in the history
Card overlays
  • Loading branch information
Andrew Wheeler(Genusis) authored Sep 11, 2023
2 parents 0457b11 + 907e839 commit 1e0e5da
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/native/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,30 @@ where
&self.style,
);
}

fn overlay<'b>(
&'b mut self,
tree: &'b mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
) -> Option<core::overlay::Element<'b, Message, Renderer>> {
let mut children = vec![&mut self.head, &mut self.body];
if let Some(foot) = &mut self.foot {
children.push(foot);
}
let children = children
.into_iter()
.zip(&mut tree.children)
.zip(layout.children())
.filter_map(|((child, state), layout)| {
layout.children().next().and_then(|child_layout| {
child.as_widget_mut().overlay(state, child_layout, renderer)
})
})
.collect::<Vec<_>>();

(!children.is_empty()).then(|| core::overlay::Group::with_children(children).overlay())
}
}

/// Calculates the layout of the head.
Expand Down

0 comments on commit 1e0e5da

Please sign in to comment.