cardTheme static method
An opinionated CardTheme with custom corner radius and elevation.
Corner radius
defaults to kCardRadius
= 12 and elevation
defaults to kCardElevation
= 0.
The corner radius 12 is the new default on Cards in M3: https://m3.material.io/components/cards/specs
Implementation
static CardTheme cardTheme({
/// Corner radius
///
/// Defaults to [kCardRadius] = 12, M3 defaults for Cards.
final double? radius,
/// Card elevation defaults to [kCardElevation] = 0.
final double elevation = kCardElevation,
/// The clipBehaviour of the card theme, defaults to
/// [Clip.antiAlias] for smooth clipping when using rounded corners.
///
/// There is no config property in [FlexSubThemesData] for [clipBehavior],
/// if needed it can be exposed. Feel free to make a PR or submit an issue.
final Clip clipBehavior = Clip.antiAlias,
}) =>
CardTheme(
clipBehavior: clipBehavior,
elevation: elevation,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(radius ?? kCardRadius),
),
),
);