pub fn stack() -> Element<Panel>Expand description
Creates a container whose children overlap.
Every child added to the stack is taken out of the flow and stretched to
the stack’s own bounds, so the children paint on top of each other in the
order they were added and the last one covers the ones below it. Because
the children do not take part in the flow, they do not size the stack: a
stack sizes itself through its own style, such as a fixed
Element::size, or through children that stay in the flow.
use smudge_core::geometry::Color;
use smudge_core::style::px;
use smudge_widgets::stack;
let layered = stack()
.size(smudge_core::geometry::Size {
width: 100.0,
height: 60.0,
})
.child(smudge_core::widget::panel().background(Color::WHITE))
.child(smudge_core::widget::panel().background(Color::BLACK));