ShadCard class
The ShadCard widget provides a container with a title, description, main content, and optional footer, styled with a background, border, and shadows. It integrates with ShadTheme for consistent styling and supports leading and trailing widgets for additional layout flexibility.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShadCard
- Available extensions
Constructors
-
ShadCard({Key? key, Widget? title, Widget? description, Widget? child, EdgeInsetsGeometry? padding, Color? backgroundColor, BorderRadius? radius, ShadBorder? border, List<
BoxShadow> ? shadows, double? width, double? height, Widget? leading, Widget? trailing, MainAxisAlignment? rowMainAxisAlignment, CrossAxisAlignment? rowCrossAxisAlignment, MainAxisAlignment? columnMainAxisAlignment, CrossAxisAlignment? columnCrossAxisAlignment, MainAxisSize? rowMainAxisSize, MainAxisSize? columnMainAxisSize, Clip? clipBehavior, TextStyle? titleStyle, TextStyle? descriptionStyle, double? gap, Widget? action}) -
Creates a card widget with optional content and styling.
const
Properties
- action → Widget?
-
A widget pinned to the end of the header row, shadcn/ui's
CardAction— typically a dismiss or overflow button.final - backgroundColor → Color?
-
The background color of the card.
Defaults to the theme’s card color if not specified.
final
- border → ShadBorder?
-
The border surrounding the card.
Defaults to a border with the theme’s border color if not specified.
final
- child → Widget?
-
The main content widget of the card, displayed below the description.
Expands flexibly within the card’s column layout.
final
- clipBehavior → Clip?
-
The clip behavior of the card, controlling how content is clipped.
Defaults to Clip.antiAlias if not specified.
final
- columnCrossAxisAlignment → CrossAxisAlignment?
-
The cross axis alignment of the card’s column (horizontal).
Defaults to CrossAxisAlignment.start if not specified.
final
- columnMainAxisAlignment → MainAxisAlignment?
-
The main axis alignment of the card’s column (vertical).
Defaults to MainAxisAlignment.start if not specified.
final
- columnMainAxisSize → MainAxisSize?
-
The main axis size of the card’s column.
Defaults to MainAxisSize.min if not specified.
final
- description → Widget?
-
The description widget displayed below the title.
Typically a Text widget, styled with the theme’s muted style.
final
- descriptionStyle → TextStyle?
-
The text style of description.
final
-
The footer widget displayed at the bottom of the card.
Useful for actions or additional information.
final
- gap → double?
-
The vertical space between the title, description, content and footer.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
The explicit height of the card.
If null, the card sizes to its content or constraints.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
The widget displayed at the start of the card’s row.
Typically an icon or small graphic, positioned before the main content.
final
- padding → EdgeInsetsGeometry?
-
The padding inside the card, surrounding all content.
Defaults to EdgeInsets.all(24) if not specified.
final
- radius → BorderRadius?
-
The border radius of the card’s corners.
Defaults to the theme’s radius if not specified.
final
- rowCrossAxisAlignment → CrossAxisAlignment?
-
The cross axis alignment of the card’s row (vertical).
Defaults to CrossAxisAlignment.start if not specified.
final
- rowMainAxisAlignment → MainAxisAlignment?
-
The main axis alignment of the card’s row (horizontal).
Defaults to MainAxisAlignment.spaceBetween if not specified.
final
- rowMainAxisSize → MainAxisSize?
-
The main axis size of the card’s row.
Defaults to MainAxisSize.min if not specified.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shadows
→ List<
BoxShadow> ? -
The list of box shadows applied to the card for elevation.
Defaults to the theme’s card shadows if not specified.
final
- title → Widget?
-
The title widget displayed at the top of the card.
Typically a Text widget, styled with the theme’s h3 style.
final
- titleStyle → TextStyle?
-
The text style of title.
final
- trailing → Widget?
-
The widget displayed at the end of the card’s row.
Typically an icon or small graphic, positioned after the main content.
final
- width → double?
-
The explicit width of the card.
If null, the card sizes to its content or constraints.
final
Methods
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
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.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
positionedWith(
ShadPosition position) → Widget -
Available on Widget, provided by the PositionedExt extension
-
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 short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited