pub struct CardView<State: 'static> { /* private fields */ }Expand description
A declarative M3 card wrapping a single child. See the module docs.
Implementations§
Source§impl<State: 'static> CardView<State>
impl<State: 'static> CardView<State>
Sourcepub fn on_press<F: Fn(&mut State) + 'static>(self, on_press: F) -> Self
pub fn on_press<F: Fn(&mut State) + 'static>(self, on_press: F) -> Self
Make the whole card surface interactive, firing on_press on release
inside its bounds (see the module docs’ Interactivity section).
Sourcepub fn enabled(self, enabled: bool) -> Self
pub fn enabled(self, enabled: bool) -> Self
Gate the interactive treatment (hover elevation lift, state-layer
hover/press tint, and firing CardView::on_press/
CardView::haptic at all) without dropping back to a
non-interactive, transparently-forwarding card. Defaults to true.
Only meaningful once CardView::on_press is chained — a no-op on a
plain wrapper card. See the module docs’ Disabled state
section for the full behavior and how it differs from the reference.
Sourcepub fn haptic(self, haptic: HapticSignal) -> Self
pub fn haptic(self, haptic: HapticSignal) -> Self
Set the haptic fired immediately before CardView::on_press on a
successful release (M3ECard.haptic). Defaults to
HapticSignal::None (no feedback). A no-op on a non-interactive or
disabled card.
Trait Implementations§
Source§impl<State: 'static> View<State> for CardView<State>
impl<State: 'static> View<State> for CardView<State>
Source§type Element = CardWidget
type Element = CardWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> CardWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> CardWidget
Source§fn rebuild(
&self,
prev: &Self,
element: &mut CardWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &Self, element: &mut CardWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for CardView<State>
impl<State> !Send for CardView<State>
impl<State> !Sync for CardView<State>
impl<State> !UnwindSafe for CardView<State>
impl<State> Freeze for CardView<State>
impl<State> Unpin for CardView<State>
impl<State> UnsafeUnpin for CardView<State>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.