Skip to main content

CardTheme

Struct CardTheme 

Source
pub struct CardTheme {
    pub key: Option<KeyRef>,
    /* private fields */
}
Expand description

Defines default property values for descendant Card widgets.

Descendant widgets obtain the current CardThemeData object using CardTheme::of. Instances of CardThemeData can be customized with CardThemeData::copy_with.

Typically a CardThemeData is specified as part of the overall Theme with ThemeData::card_theme.

All CardThemeData properties are null by default. When null, the Card will use the values from ThemeData if they exist, otherwise it will provide its own defaults.

Dart’s CardTheme constructor takes either the properties or a data; here the properties are the with_* setters and with_data the other, and each setter that breaks Dart’s constructor assert (a data together with any property) fails in a debug build. The getters are methods, as Dart’s, hence the with_ prefix.

See also:

  • ThemeData, which describes the overall theme information for the application.

Fields§

§key: Option<KeyRef>

Implementations§

Source§

impl CardTheme

Source

pub fn new() -> CardTheme

Creates a theme that can be used for ThemeData::card_theme.

The elevation must be null or non-negative.

Source

pub fn key(self, key: KeyRef) -> CardTheme

Dart CardTheme(key:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> CardTheme

Dart CardTheme(child:); the default is an empty SizedBox.

Source

pub fn with_data(self, data: CardThemeData) -> CardTheme

Dart CardTheme(data:).

Source

pub fn with_clip_behavior(self, clip_behavior: Clip) -> CardTheme

Dart CardTheme(clipBehavior:).

Source

pub fn with_color(self, color: Color) -> CardTheme

Dart CardTheme(color:).

Source

pub fn with_surface_tint_color(self, surface_tint_color: Color) -> CardTheme

Dart CardTheme(surfaceTintColor:).

Source

pub fn with_shadow_color(self, shadow_color: Color) -> CardTheme

Dart CardTheme(shadowColor:).

Source

pub fn with_elevation(self, elevation: f64) -> CardTheme

Dart CardTheme(elevation:).

Source

pub fn with_margin(self, margin: impl Into<EdgeInsetsGeometry>) -> CardTheme

Dart CardTheme(margin:).

Source

pub fn with_shape(self, shape: impl Into<ShapeBorderRef>) -> CardTheme

Dart CardTheme(shape:).

Source

pub fn clip_behavior(&self) -> Option<Clip>

Overrides the default value for Card::clip_behavior.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::clip_behavior property in data instead.

Source

pub fn color(&self) -> Option<Color>

Overrides the default value for Card::color.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::color property in data instead.

Source

pub fn surface_tint_color(&self) -> Option<Color>

Overrides the default value for Card::surface_tint_color.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::surface_tint_color property in data instead.

Source

pub fn shadow_color(&self) -> Option<Color>

Overrides the default value for Card::shadow_color.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::shadow_color property in data instead.

Source

pub fn elevation(&self) -> Option<f64>

Overrides the default value for Card::elevation.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::elevation property in data instead.

Source

pub fn margin(&self) -> Option<EdgeInsetsGeometry>

Overrides the default value for Card::margin.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::margin property in data instead.

Source

pub fn shape(&self) -> Option<&ShapeBorderRef>

Overrides the default value for Card::shape.

This property is obsolete and will be deprecated in a future release: please use the CardThemeData::shape property in data instead.

Source

pub fn data(&self) -> CardThemeData

The properties used for all descendant Card widgets.

Source

pub fn copy_with(&self) -> CardTheme

Creates a copy of this object with the given fields replaced with the new values.

This method is obsolete and will be deprecated in a future release: please use the CardThemeData::copy_with instead.

Dart’s named arguments are the fluent setters on the copy (theme.copy_with().with_elevation(2.0)). As in Dart, the copy carries neither the key nor the child, and holds the properties, never a data.

Source

pub fn of(app: &mut App, context: BuildContext) -> CardThemeData

Returns the configuration data from the closest CardTheme ancestor.

If there is no ancestor, it returns ThemeData::card_theme.

Typical usage is as follows:

let theme = CardTheme::of(app, context);
Source

pub fn lerp(a: Option<&CardTheme>, b: Option<&CardTheme>, t: f64) -> CardTheme

Linearly interpolate between two Card themes.

{@macro dart.ui.shadow.lerp}

This method is obsolete and will be deprecated in a future release: please use the CardThemeData::lerp instead.

Trait Implementations§

Source§

impl Clone for CardTheme

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CardTheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CardTheme

Source§

fn default() -> CardTheme

Returns the “default value” for a type. Read more
Source§

impl InheritedWidget for CardTheme

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn child(&self) -> &WidgetRef

The widget below this widget in the tree.
Source§

fn update_should_notify(&self, old_widget: &CardTheme) -> bool

Whether the framework should notify widgets that inherit from this widget. Read more
Source§

fn debug_check_constructor(&self)

Source§

fn as_inherited_theme(&self) -> Option<&(dyn InheritedTheme + 'static)>

Dart’s this is InheritedTheme: an inherited widget that is an InheritedTheme answers with itself, which is what InheritedTheme::capture collects.

Auto Trait Implementations§

§

impl !RefUnwindSafe for CardTheme

§

impl !Send for CardTheme

§

impl !Sync for CardTheme

§

impl !UnwindSafe for CardTheme

§

impl Forget for CardTheme

§

impl Freeze for CardTheme
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn ShapeBorder> is !null: Freeze, PhantomData<RcInner<dyn ShapeBorder>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl Move for CardTheme

§

impl Unpin for CardTheme
where Rc<dyn Key>: Unpin, Rc<dyn ShapeBorder>: Unpin, Rc<dyn Widget>: Unpin,

§

impl UnsafeUnpin for CardTheme
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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<W> IntoWidget<InheritedKind> for W
where W: InheritedWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>