pub struct ListBody;Expand description
A named entry point for the body of a scrollable: the reference’s ListBody.
Children one after another along an axis, each at its natural extent on that axis and stretched across the other, starting at the beginning and never squashed. Its box grows to hold them all, which is why it belongs inside something that scrolls — a body taller than its parent with nowhere to go is an overflow, and says so.
It returns a Flex, because in this framework that is already what a list body is:
the flex defaults here are flex_shrink: 0, align: Stretch and justify: Start — a
column that squashes nothing, stretches everything across, and packs from the top. What
the name adds is the statement: this column is the content of a viewport, not a
layout with opinions, and nothing in it is meant to flex. Every one of Flex’s
settings is still there, gap and padding included.
Scroll::new().child(
ListBody::vertical()
.gap(8.0)
.child(header())
.child(body()),
)ListBody::vertical is the reference’s default. Its reverse is
Flex::reverse, which lays the children out from the far end — the shape a chat
transcript wants, together with a scroll region that starts at the bottom.