copyWith method
CheckboxStyle
copyWith({
- double? size,
- BoxShape? shape,
- EdgeInsetsGeometry? margin,
- EdgeInsetsGeometry? padding,
- Color? backgroundColor,
- double? backgroundOpacity,
- int? backgroundAlpha,
- Color? borderColor,
- double? borderOpacity,
- int? borderAlpha,
- double? borderWidth,
- BorderRadius? borderRadius,
- BorderStyle? borderStyle,
- double? checkmarkInset,
- Color? checkmarkColor,
- double? checkmarkOpacity,
- int? checkmarkAlpha,
- double? checkmarkWeight,
- StrokeStyle? checkmarkStyle,
- Color? overlayColor,
- double? overlayOpacity,
- bool? overlayDisabled,
- double? overlayRadius,
- bool? mergeResolved,
- CheckboxStyle? selectedStyle,
- CheckboxStyle? indeterminateStyle,
- CheckboxStyle? focusedStyle,
- CheckboxStyle? hoveredStyle,
- CheckboxStyle? pressedStyle,
- CheckboxStyle? disabledStyle,
Creates a copy of this CheckboxStyle but with the given fields replaced with the new values.
Implementation
CheckboxStyle copyWith({
double? size,
BoxShape? shape,
EdgeInsetsGeometry? margin,
EdgeInsetsGeometry? padding,
Color? backgroundColor,
double? backgroundOpacity,
int? backgroundAlpha,
Color? borderColor,
double? borderOpacity,
int? borderAlpha,
double? borderWidth,
BorderRadius? borderRadius,
BorderStyle? borderStyle,
double? checkmarkInset,
Color? checkmarkColor,
double? checkmarkOpacity,
int? checkmarkAlpha,
double? checkmarkWeight,
StrokeStyle? checkmarkStyle,
Color? overlayColor,
double? overlayOpacity,
bool? overlayDisabled,
double? overlayRadius,
bool? mergeResolved,
CheckboxStyle? selectedStyle,
CheckboxStyle? indeterminateStyle,
CheckboxStyle? focusedStyle,
CheckboxStyle? hoveredStyle,
CheckboxStyle? pressedStyle,
CheckboxStyle? disabledStyle,
}) {
final style = CheckboxStyle(
margin: margin ?? this.margin,
padding: padding ?? this.padding,
backgroundColor: backgroundColor ?? this.backgroundColor,
backgroundOpacity: backgroundOpacity ?? this.backgroundOpacity,
backgroundAlpha: backgroundAlpha ?? this.backgroundAlpha,
shape: shape ?? this.shape,
borderColor: borderColor ?? this.borderColor,
borderOpacity: borderOpacity ?? this.borderOpacity,
borderAlpha: borderAlpha ?? this.borderAlpha,
borderWidth: borderWidth ?? this.borderWidth,
borderRadius: borderRadius ?? this.borderRadius,
borderStyle: borderStyle ?? this.borderStyle,
size: size ?? this.size,
checkmarkInset: checkmarkInset ?? this.checkmarkInset,
checkmarkColor: checkmarkColor ?? this.checkmarkColor,
checkmarkOpacity: checkmarkOpacity ?? this.checkmarkOpacity,
checkmarkAlpha: checkmarkAlpha ?? this.checkmarkAlpha,
checkmarkWeight: checkmarkWeight ?? this.checkmarkWeight,
checkmarkStyle: checkmarkStyle ?? this.checkmarkStyle,
overlayColor: overlayColor ?? this.overlayColor,
overlayOpacity: overlayOpacity ?? this.overlayOpacity,
overlayDisabled: overlayDisabled ?? this.overlayDisabled,
overlayRadius: overlayRadius ?? this.overlayRadius,
);
final hasDrivenStyle = [
mergeResolved,
selectedStyle,
indeterminateStyle,
focusedStyle,
hoveredStyle,
pressedStyle,
disabledStyle,
].any((el) => el != null);
if (hasDrivenStyle) {
return DrivenCheckboxStyle.from(
style,
selectedStyle: selectedStyle,
indeterminateStyle: indeterminateStyle,
focusedStyle: focusedStyle,
hoveredStyle: hoveredStyle,
pressedStyle: pressedStyle,
disabledStyle: disabledStyle,
mergeResolved: mergeResolved,
);
}
return style;
}