paintSurface method

void paintSurface(
  1. Canvas canvas, {
  2. Path? path,
})

Implementation

void paintSurface(Canvas canvas, {Path? path}) {
  if (path != null) {
    borderPath = path;
  } else {
    borderPath = _calculateBorderPath(outerPath, innerPath);
  }

  if (borderBlur > 0) {
    borderPaintObject.maskFilter =
        MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(borderBlur));
  }
  if (gradient != null) {
    if (path != null) {
      paintObject.shader = gradient?.createShader(path.getBounds());
    } else {
      paintObject.shader = gradient?.createShader(innerPath.getBounds());
    }
  } else if (color != null) {
    if (blur > 0) {
      paintObject.maskFilter =
          MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(blur));
    }
    paintObject.color = color!;
  }
  if (borderGradient != null) {
    borderPaintObject.shader =
        borderGradient?.createShader(outerPath.getBounds());
    canvas.drawPath(borderPath!, borderPaintObject);
  }
  if (path != null) {
    canvas.drawPath(path, paintObject);
  } else {
    canvas.drawPath(innerPath, paintObject);
  }
}