copyWith method
CardProps
copyWith({
- Widget? child,
- List<
Widget> ? children, - CardVariant? variant,
- EdgeInsets? padding,
- BorderRadius? borderRadius,
- String? backgroundColor,
- bool? fillWidth,
- void onTap()?,
- String? href,
- bool clearInteraction = false,
- String? target,
- String? rel,
- String? classes,
- Map<
String, String> ? attributes, - String? ariaLabel,
- ArcaneStyleData? styles,
- ArcaneDecoration? decoration,
Implementation
CardProps copyWith({
Widget? child,
List<Widget>? children,
CardVariant? variant,
EdgeInsets? padding,
BorderRadius? borderRadius,
String? backgroundColor,
bool? fillWidth,
void Function()? onTap,
String? href,
bool clearInteraction = false,
String? target,
String? rel,
String? classes,
Map<String, String>? attributes,
String? ariaLabel,
ArcaneStyleData? styles,
ArcaneDecoration? decoration,
}) {
assert(
href == null || onTap == null,
'CardProps.copyWith href and onTap are mutually exclusive',
);
assert(
!clearInteraction || (href == null && onTap == null),
'clearInteraction cannot be combined with href or onTap',
);
// Supplying either interaction mode intentionally replaces the other.
// `clearInteraction` is the explicit nullable sentinel for returning a
// card to its static div form.
final String? nextHref = clearInteraction
? null
: href ?? (onTap == null ? this.href : null);
final void Function()? nextOnTap = clearInteraction || href != null
? null
: onTap ?? this.onTap;
return CardProps(
child: child ?? this.child,
children: children ?? this.children,
variant: variant ?? this.variant,
padding: padding ?? this.padding,
borderRadius: borderRadius ?? this.borderRadius,
backgroundColor: backgroundColor ?? this.backgroundColor,
fillWidth: fillWidth ?? this.fillWidth,
onTap: nextOnTap,
href: nextHref,
target: target ?? this.target,
rel: rel ?? this.rel,
classes: classes ?? this.classes,
attributes: attributes ?? this.attributes,
ariaLabel: ariaLabel ?? this.ariaLabel,
styles: styles ?? this.styles,
decoration: decoration ?? this.decoration,
);
}