createPaint function

Paint createPaint(
  1. BlobStyles? styles
)

Implementation

Paint createPaint(BlobStyles? styles) {
  Map<BlobFillType, PaintingStyle> fillType = {
    BlobFillType.fill: PaintingStyle.fill,
    BlobFillType.stroke: PaintingStyle.stroke
  };
  if (styles == null) styles = BlobStyles();

  var paint = Paint();
  paint.color = styles.color ?? BlobConfig.color;
  paint.shader = styles.gradient;
  paint.strokeWidth = (styles.strokeWidth ?? BlobConfig.strokeWidth).toDouble();
  paint.style = fillType[styles.fillType ?? BlobConfig.fillType]!;

  return paint;
}