CardTheme class

Defines default property values for descendant Card widgets.

Descendant widgets obtain the current CardTheme object using CardTheme.of(context). Instances of CardTheme can be customized with CardTheme.copyWith.

Typically a CardTheme is specified as part of the overall Theme with ThemeData.cardTheme.

All CardTheme 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.

See also:

  • ThemeData, which describes the overall theme information for the application.
Inheritance
Mixed-in types

Constructors

CardTheme({Key? key, Clip? clipBehavior, Color? color, Color? surfaceTintColor, Color? shadowColor, double? elevation, EdgeInsetsGeometry? margin, ShapeBorder? shape, CardThemeData? data, Widget? child})
Creates a theme that can be used for ThemeData.cardTheme.
const

Properties

child Widget
The widget below this widget in the tree.
finalinherited
clipBehavior Clip?
Overrides the default value for Card.clipBehavior.
no setter
color Color?
Overrides the default value for Card.color.
no setter
data CardThemeData
The properties used for all descendant Card widgets.
no setter
elevation double?
Overrides the default value for Card.elevation.
no setter
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
margin EdgeInsetsGeometry?
Overrides the default value for Card.margin.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadowColor Color?
Overrides the default value for Card.shadowColor.
no setter
shape ShapeBorder?
Overrides the default value for Card.shape.
no setter
surfaceTintColor Color?
Overrides the default value for Card.surfaceTintColor.
no setter

Methods

copyWith({Clip? clipBehavior, Color? color, Color? shadowColor, Color? surfaceTintColor, double? elevation, EdgeInsetsGeometry? margin, ShapeBorder? shape}) CardTheme
Creates a copy of this object with the given fields replaced with the new values.
createElement() InheritedElement
Inflates this configuration to a concrete instance.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
updateShouldNotify(covariant CardTheme oldWidget) bool
Whether the framework should notify widgets that inherit from this widget.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

lerp(CardTheme? a, CardTheme? b, double t) CardTheme
Linearly interpolate between two Card themes.
of(BuildContext context) CardThemeData
The ThemeData.cardTheme property of the ambient Theme.