copyWith method
CNButtonData
copyWith({
- String? label,
- CNIcon? icon,
- VoidCallback? onPressed,
- bool? enabled,
- CNButtonTheme? theme,
- CNButtonDataConfig? config,
Creates a copy of this data with the given fields replaced.
Implementation
CNButtonData copyWith({
String? label,
CNIcon? icon,
VoidCallback? onPressed,
bool? enabled,
CNButtonTheme? theme,
CNButtonDataConfig? config,
}) {
if (isIcon) {
return CNButtonData.icon(
icon: icon ?? this.icon,
onPressed: onPressed ?? this.onPressed,
enabled: enabled ?? this.enabled,
theme: theme ?? this.theme,
config: config ?? this.config,
);
}
return CNButtonData(
label: label ?? this.label!,
icon: icon ?? this.icon,
onPressed: onPressed ?? this.onPressed,
enabled: enabled ?? this.enabled,
theme: theme ?? this.theme,
config: config ?? this.config,
);
}