merge method

SvgBrush merge(
  1. SvgBrush? other
)

Implementation

SvgBrush merge(SvgBrush? other) {
  if (other == null) {
    return this;
  }

  var _fill = other.fill ?? fill;

  if (_fill?.inherit ?? false) {
    _fill = fill!.merge(other.fill!);
  }

  var _stroke = other.stroke ?? stroke;

  if (_stroke?.inherit ?? false) {
    _stroke = stroke!.merge(other.stroke!);
  }

  return SvgBrush(
    opacity: other.opacity ?? 1.0,
    blendMode: other.blendMode,
    fillOpacity: other.fillOpacity ?? fillOpacity,
    strokeOpacity: other.strokeOpacity ?? strokeOpacity,
    fill: _fill,
    fillEvenOdd: other.fillEvenOdd ?? fillEvenOdd,
    stroke: _stroke,
    strokeWidth: other.strokeWidth ?? strokeWidth,
    strokeDashArray: other.strokeDashArray ?? strokeDashArray,
    strokeDashOffset: other.strokeDashOffset ?? strokeDashOffset,
    fontSize: other.fontSize ?? fontSize,
    fontFamily: other.fontFamily ?? fontFamily,
    fontStyle: other.fontStyle ?? fontStyle,
    fontWeight: other.fontWeight ?? fontWeight,
    textAnchor: other.textAnchor ?? textAnchor,
    strokeLineCap: other.strokeLineCap ?? strokeLineCap,
    strokeLineJoin: other.strokeLineJoin ?? strokeLineJoin,
    strokeMiterLimit: other.strokeMiterLimit ?? strokeMiterLimit,
    mask: other.mask,
  );
}