copyWith method
ToggleIconStyle
copyWith({
- double? size,
- Color? color,
- double? opacity,
- double? scale,
- Color? backColor,
- double? backOpacity,
- bool? mergeResolved,
- ToggleIconStyle? selectedStyle,
- ToggleIconStyle? disabledStyle,
Creates a copy of this ToggleIconStyle but with the given fields replaced with the new values.
Implementation
ToggleIconStyle copyWith({
double? size,
Color? color,
double? opacity,
double? scale,
Color? backColor,
double? backOpacity,
bool? mergeResolved,
ToggleIconStyle? selectedStyle,
ToggleIconStyle? disabledStyle,
}) {
final style = ToggleIconStyle(
size: size ?? this.size,
color: color ?? this.color,
opacity: opacity ?? this.opacity,
scale: scale ?? this.scale,
backColor: backColor ?? this.backColor,
backOpacity: backOpacity ?? this.backOpacity,
);
final hasEventStyle = [
mergeResolved,
selectedStyle,
disabledStyle,
].any((el) => el != null);
if (hasEventStyle) {
return DrivenToggleIconStyle.from(
style,
selectedStyle: selectedStyle,
disabledStyle: disabledStyle,
mergeResolved: mergeResolved,
);
}
return style;
}