pub struct MaterialCard2<'a> { /* private fields */ }Expand description
Enhanced Material Design card component.
This is an enhanced version of the card component with additional features like media support, action areas, and improved layout options.
// Enhanced card with media and actions
ui.add(MaterialCard2::elevated()
.header("Card Title", Some("Subtitle"))
.media_area(|ui| {
ui.label("Media content goes here");
})
.content(|ui| {
ui.label("Main card content");
})
.actions(|ui| {
if ui.button("Action 1").clicked() {
println!("Action 1 clicked!");
}
}));Implementations§
Source§impl<'a> MaterialCard2<'a>
impl<'a> MaterialCard2<'a>
Sourcepub fn header(
self,
title: impl Into<String>,
subtitle: Option<impl Into<String>>,
) -> Self
pub fn header( self, title: impl Into<String>, subtitle: Option<impl Into<String>>, ) -> Self
Set card header with title and optional subtitle.
Sourcepub fn media_area<F>(self, content: F) -> Self
pub fn media_area<F>(self, content: F) -> Self
Set media area content.
Sourcepub fn media_height(self, height: f32) -> Self
pub fn media_height(self, height: f32) -> Self
Set media area height.
Sourcepub fn corner_radius(self, corner_radius: impl Into<CornerRadius>) -> Self
pub fn corner_radius(self, corner_radius: impl Into<CornerRadius>) -> Self
Set the corner radius of the card.
Sourcepub fn elevation(self, elevation: f32) -> Self
pub fn elevation(self, elevation: f32) -> Self
Set the elevation of the card. For Material 3: Elevated = 1.0, Filled = 0.0, Outlined = 0.0
Sourcepub fn surface_tint_color(self, color: Color32) -> Self
pub fn surface_tint_color(self, color: Color32) -> Self
Set the surface tint color for elevation overlay. In Material 3, this color is overlaid on the surface to indicate elevation.
Sourcepub fn shadow_color(self, color: Color32) -> Self
pub fn shadow_color(self, color: Color32) -> Self
Set the shadow color.
Sourcepub fn clip_behavior(self, clip: bool) -> Self
pub fn clip_behavior(self, clip: bool) -> Self
Set whether to clip the card content.
Sourcepub fn border_on_foreground(self, on_foreground: bool) -> Self
pub fn border_on_foreground(self, on_foreground: bool) -> Self
Set whether the border should be painted on foreground.
Trait Implementations§
Source§impl<'a> Default for MaterialCard2<'a>
impl<'a> Default for MaterialCard2<'a>
Auto Trait Implementations§
impl<'a> Freeze for MaterialCard2<'a>
impl<'a> !RefUnwindSafe for MaterialCard2<'a>
impl<'a> !Send for MaterialCard2<'a>
impl<'a> !Sync for MaterialCard2<'a>
impl<'a> Unpin for MaterialCard2<'a>
impl<'a> UnsafeUnpin for MaterialCard2<'a>
impl<'a> !UnwindSafe for MaterialCard2<'a>
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<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.