pub struct ListItem { /* private fields */ }Expand description
One M3 list item. Strings come from the caller. Give it on_click to make
the whole row a button; without one it is static content.
Implementations§
Source§impl ListItem
impl ListItem
pub fn new(id: impl Into<ElementId>, headline: impl Into<SharedString>) -> Self
Sourcepub fn overline(self, text: impl Into<SharedString>) -> Self
pub fn overline(self, text: impl Into<SharedString>) -> Self
A label-medium line above the headline.
Sourcepub fn supporting(self, text: impl Into<SharedString>) -> Self
pub fn supporting(self, text: impl Into<SharedString>) -> Self
Body-medium text under the headline, on one line (ellipsized).
Sourcepub fn three_line(self, three_line: bool) -> Self
pub fn three_line(self, three_line: bool) -> Self
Let the supporting text wrap to two lines: the three-line item.
Sourcepub fn trailing_text(self, text: impl Into<SharedString>) -> Self
pub fn trailing_text(self, text: impl Into<SharedString>) -> Self
Label-small text before the trailing element (e.g. “100+”).
pub fn leading(self, leading: ListLeading) -> Self
pub fn trailing(self, trailing: ListTrailing) -> Self
Sourcepub fn divider(self, divider: bool) -> Self
pub fn divider(self, divider: bool) -> Self
A full-width outline-variant divider under the item.
Sourcepub fn divider_inset(self, inset: bool) -> Self
pub fn divider_inset(self, inset: bool) -> Self
Inset the divider 16dp from the start edge (the design kit’s
Horizontal/Inset divider) instead of running full width.
pub fn selected(self, selected: bool) -> Self
pub fn disabled(self, disabled: bool) -> Self
Sourcepub fn container(self, role: ColorRole) -> Self
pub fn container(self, role: ColorRole) -> Self
The resting container role (surface by default), e.g. a dialog’s surface-container-high so items sit on it. Selected rows keep the secondary container.
pub fn density(self, density: ListDensity) -> Self
Sourcepub fn segment(self, corners: OuterCorners) -> Self
pub fn segment(self, corners: OuterCorners) -> Self
Round the item as a segment of an Expressive segmented list (top-left, top-right, bottom-right, bottom-left; true = outside).
Sourcepub fn preview_state(self, state: InteractionPreview) -> Self
pub fn preview_state(self, state: InteractionPreview) -> Self
Render a static specimen in one forced interaction state: the state
layer, the inner focus ring or the disabled row. See
InteractionPreview.
Trait Implementations§
Source§impl IntoElement for ListItem
impl IntoElement for ListItem
Source§type Element = ViewElement<ListItem>
type Element = ViewElement<ListItem>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for ListItem
impl !Send for ListItem
impl !Sync for ListItem
impl !UnwindSafe for ListItem
impl Freeze for ListItem
impl Unpin for ListItem
impl UnsafeUnpin for ListItem
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.