createPaint static method
Paint
createPaint({
- required Color color,
- PaintingStyle style = PaintingStyle.fill,
- double? strokeWidth,
Creates a paint object with the given color and style.
color is the color of the paint.
style is the painting style. Defaults to PaintingStyle.fill.
strokeWidth is the width of the stroke. Only used when style is PaintingStyle.stroke.
Implementation
static Paint createPaint({
required Color color,
PaintingStyle style = PaintingStyle.fill,
double? strokeWidth,
}) {
final paint = Paint()
..color = color
..style = style;
if (strokeWidth != null && style == PaintingStyle.stroke) {
paint.strokeWidth = strokeWidth;
}
return paint;
}