Skip to main content

ListBody

Struct ListBody 

Source
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.

Implementations§

Source§

impl ListBody

Source

pub fn vertical<Msg>() -> Flex<Msg>

Children stacked downwards — the usual one.

Source

pub fn horizontal<Msg>() -> Flex<Msg>

Children laid out across, in the reading direction.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.