copyWith method
CNButtonData
copyWith({
- String? label,
- CNSymbol? icon,
- IconData? customIcon,
- CNImageAsset? imageAsset,
- VoidCallback? onPressed,
- bool? enabled,
- Color? tint,
- CNButtonDataConfig? config,
Creates a copy of this data with the given fields replaced.
Implementation
CNButtonData copyWith({
String? label,
CNSymbol? icon,
IconData? customIcon,
CNImageAsset? imageAsset,
VoidCallback? onPressed,
bool? enabled,
Color? tint,
CNButtonDataConfig? config,
}) {
if (isIcon) {
return CNButtonData.icon(
icon: icon ?? this.icon,
customIcon: customIcon ?? this.customIcon,
imageAsset: imageAsset ?? this.imageAsset,
onPressed: onPressed ?? this.onPressed,
enabled: enabled ?? this.enabled,
tint: tint ?? this.tint,
config: config ?? this.config,
);
}
return CNButtonData(
label: label ?? this.label!,
icon: icon ?? this.icon,
customIcon: customIcon ?? this.customIcon,
imageAsset: imageAsset ?? this.imageAsset,
onPressed: onPressed ?? this.onPressed,
enabled: enabled ?? this.enabled,
tint: tint ?? this.tint,
config: config ?? this.config,
);
}