pub struct Container { /* private fields */ }Implementations§
Source§impl Container
impl Container
pub fn new( layout_style: LayoutStyle, children: Vec<Box<dyn LayoutItem>>, ) -> Result<Self, LayoutError>
Sourcepub fn from_slots(
layout_style: LayoutStyle,
slots: Vec<ChildSlot>,
) -> Result<Self, LayoutError>
pub fn from_slots( layout_style: LayoutStyle, slots: Vec<ChildSlot>, ) -> Result<Self, LayoutError>
A container whose children are a mix of static widgets and reactive fragments (ChildSlots). The
fragments reconcile into this container’s own node, so their items are real siblings of the static
children and inherit this container’s flex direction/gap — the transparent for/if path.
Sourcepub fn keeping(self, subscription: Effect) -> Self
pub fn keeping(self, subscription: Effect) -> Self
Give this container ownership of an Effect, so it runs for exactly as long as
the container exists. See StyledContainer::keeping for why that is
the span an effect belonging to a widget wants, and why neither dropping the handle nor parking it
somewhere longer-lived is it.
Sourcepub fn styled_by(self, style: impl Fn() -> LayoutStyle + 'static) -> Self
pub fn styled_by(self, style: impl Fn() -> LayoutStyle + 'static) -> Self
Keeps this container’s layout style in step with the reactive state it was built from — see
StyledContainer::styled_by, which is the same thing on a box that
also paints.
Sourcepub fn on_press(self, f: impl Fn() + 'static) -> Self
pub fn on_press(self, f: impl Fn() + 'static) -> Self
Make the container itself pressable. The callback fires on a tap (release, not press) inside it; a child widget that handles the press wins, and a scroll gesture started on it does not fire it.
Sourcepub fn maybe_on_press(self, f: Option<impl Fn() + 'static>) -> Self
pub fn maybe_on_press(self, f: Option<impl Fn() + 'static>) -> Self
on_press for a handler the caller may not have supplied.
The emitter picks this form for any on_press: whose value is not a closure literal, which is how a
wrapper component forwards an Option — and a Container reached that emitter with no such method,
so a plain container forwarding one did not compile. None leaves the container untouched: a no-op
handler would still report the tap Handled, turning a display-only row into one that swallows it.