copyWith method

BoxDecoration copyWith({
  1. Color? color,
  2. Border? border,
  3. BorderRadiusGeometry? borderRadius,
  4. List<BoxShadow>? boxShadow,
  5. Gradient? gradient,
  6. BoxShape? shape,
})

Internal copyWith for BoxDecoration

Implementation

BoxDecoration copyWith({
  Color? color,
  Border? border,
  BorderRadiusGeometry? borderRadius,
  List<BoxShadow>? boxShadow,
  Gradient? gradient,
  BoxShape? shape,
}) {
  return BoxDecoration(
    color: color ?? this.color,
    border: border ?? this.border,
    borderRadius:
        shape == BoxShape.circle ? null : borderRadius ?? this.borderRadius,
    boxShadow: boxShadow ?? this.boxShadow,
    gradient: gradient ?? this.gradient,
    shape: shape ?? this.shape,
  );
}