pub struct Lists;Expand description
Lists usage
use ListItem must have HeadlineText, other like SupportingText,
Leading, and Trailing are optional.
§Example
§single headline text
// only single headline text
fn_widget! {
@Lists {
@ListItem {
@{ HeadlineText(Label::new("One line list item")) }
}
}
};§headline text and supporting text
// single headline text and supporting text
fn_widget! {
@Lists {
@ListItem {
@ { HeadlineText(Label::new("headline text")) }
@ { SupportingText(Label::new("supporting text")) }
}
}
};§use leading
fn_widget! {
@Lists {
// use leading icon
@ListItem {
@Leading { @{ svgs::CHECK_BOX_OUTLINE_BLANK } }
@HeadlineText(Label::new("headline text"))
}
// use leading label
@ListItem {
@Leading { @{ Label::new("A") } }
@HeadlineText(Label::new("headline text"))
}
// use leading custom widget
@ListItem {
@Leading {
@CustomEdgeWidget(
@Container {
size: Size::splat(40.),
background: Color::YELLOW,
}.build(ctx!())
)
}
}
}
};§use trailing
fn_widget! {
@Lists {
// use trailing icon
@ListItem {
@HeadlineText(Label::new("headline text"))
@Trailing { @{ svgs::CHECK_BOX_OUTLINE_BLANK } }
}
// use trailing label
@ListItem {
@HeadlineText(Label::new("headline text"))
@Trailing { @{ Label::new("A") } }
}
// use trailing custom widget
@ListItem {
@HeadlineText(Label::new("headline text"))
@Trailing {
@CustomEdgeWidget(
@Container {
size: Size::splat(40.),
background: Color::YELLOW,
}.build(ctx!())
)
}
}
}
};§use Divider split list item
fn_widget! {
@Lists {
@ListItem {
@ { HeadlineText(Label::new("One line list item")) }
}
@Divider {}
@ListItem {
@ { HeadlineText(Label::new("One line list item")) }
}
}
};Trait Implementations§
Source§impl ComposeChild for Lists
impl ComposeChild for Lists
type Child = BoxPipe<Vec<Widget>>
fn compose_child( _: impl StateWriter<Value = Self>, child: Self::Child, ) -> impl WidgetBuilder
Auto Trait Implementations§
impl Freeze for Lists
impl RefUnwindSafe for Lists
impl Send for Lists
impl Sync for Lists
impl Unpin for Lists
impl UnwindSafe for Lists
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<M, T, C> ComposeWithChild<C, [M; 0]> for T
impl<M, T, C> ComposeWithChild<C, [M; 0]> for T
type Target = <State<T> as ComposeWithChild<C, M>>::Target
fn with_child( self, child: C, ctx: &BuildCtx<'_>, ) -> <T as ComposeWithChild<C, [M; 0]>>::Target
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.