pub struct Stack { /* private fields */ }Expand description
Draws its children on top of each other in one cell, each stretched to the size of the largest. Later children are on top.
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn children_keyed<T, K, W>(
self,
items: impl FnMut() -> Vec<T> + 'static,
key: impl FnMut(&T) -> K + 'static,
view: impl FnMut(&Cx, Memo<T>) -> W + 'static,
) -> Self
pub fn children_keyed<T, K, W>( self, items: impl FnMut() -> Vec<T> + 'static, key: impl FnMut(&T) -> K + 'static, view: impl FnMut(&Cx, Memo<T>) -> W + 'static, ) -> Self
Adds one child per item, after the children added so far.
items runs in an effect, so the list updates when a signal it
read changes. key names each item. view builds the child for
a key the first time it appears, and that child is kept while
its key stays in the list, even if it moves. view receives the
item’s Cx and a Memo that updates when that item’s value
changes. When a key leaves the list, its child and everything
created in view are freed, at once or after an
exit. If two items share a key, only the first is
shown and the duplicate is logged.
Sourcepub fn exit(self, exit: impl IntoProp<Duration>) -> Self
pub fn exit(self, exit: impl IntoProp<Duration>) -> Self
Lets the children of the last children_keyed
list added leave over exit instead of at once. A child whose key
leaves stays mounted and painted right after the child that was
before it, and its context’s leaving turns true,
so its own cx.animate can fade or shrink it out. After exit it
is freed. If its key comes back first, the same child, with its
state, takes the key’s new place. A closure is read as each key
leaves, and an exit of 0 removes at once. Leaving children still
take pointer and keyboard input; a handler can check
cx.leaving() to ignore clicks during the exit.
Sourcepub fn displaced(self, transition: impl IntoProp<Transition>) -> Self
pub fn displaced(self, transition: impl IntoProp<Transition>) -> Self
Slides the children that a change of the last
children_keyed list moves, instead of
jumping: when its keys are added, leave (once their
exit ends) or move, each child of this container
whose place changes goes from where it was drawn to its new place
over transition. It moves where it is drawn and hit, as
Style::translate does, so a slide never
lays the window out again. A child moved again mid-slide starts from
where it is drawn. Other layout changes, such as a resize or text
growing, still move children at once, and a new child shows in its
place. A closure is read at each change of the list, and a
transition of 0 jumps.
Sourcepub fn visible(self, visible: impl IntoProp<bool>) -> Self
pub fn visible(self, visible: impl IntoProp<bool>) -> Self
Shows or hides the widget. Hidden, it is taken out of the layout, so its space goes to the others, and it isn’t drawn, hit or reached by Tab; it drops the keyboard focus and the pointer. Its bindings and state stay, so it shows again as it was. Shown by default.
Sourcepub fn geometry(self, geometry: Signal<Rect>) -> Self
pub fn geometry(self, geometry: Signal<Rect>) -> Self
Shares where the widget is: after each layout that moves or
resizes it, its laid-out rectangle in the window’s logical
pixels, scrolled with any scroll view around it but not moved by
a style’s translate, scale or rotate, is written to geometry. A
hidden widget writes nothing. An effect that reads it may change
the layout: the window is laid out again at once, until nothing
moves.