copyWith method

  1. @override
OutlinedBorder copyWith({
  1. BorderSide? side,
  2. OutlinedBorder? child,
  3. List<BoxShadow>? shadow,
  4. List<BoxShadow>? innerShadow,
  5. Gradient? backgroundGradient,
  6. GradientBorderSide? borderGradient,
})
override

Returns a copy of this OutlinedBorder that draws its outline with the specified side, if side is non-null.

Implementation

@override
OutlinedBorder copyWith({
  BorderSide? side,
  OutlinedBorder? child,
  List<BoxShadow>? shadow,
  List<BoxShadow>? innerShadow,
  Gradient? backgroundGradient,
  GradientBorderSide? borderGradient,
}) {
  var resolvedChild = child ?? this.child;
  if (side != null) {
    resolvedChild = (side != BorderSide.none)
        ? resolvedChild.copyWith(
            side: BorderSide(width: side.width, color: Colors.transparent),
          )
        : resolvedChild;
  }

  return DecoratedOutlinedBorder(
    child: resolvedChild,
    shadow: shadow ?? this.shadow,
    innerShadow: innerShadow ?? this.innerShadow,
    backgroundGradient: backgroundGradient ?? this.backgroundGradient,
    borderGradient: borderGradient ?? this.borderGradient,
  );
}