createBasePaint method

  1. @override
Paint? createBasePaint(
  1. Path path,
  2. ImageConfiguration configuration
)
override

Creates a configured paint for the base fill, or null if there is none.

Implementation

@override
Paint? createBasePaint(Path path, ImageConfiguration configuration) {
  if (!hasBaseFill) return null;

  final paint = Paint()..isAntiAlias = isAntiAlias;

  if (blendMode != null) {
    paint.blendMode = blendMode!;
  }

  if (gradient != null) {
    paint.shader = gradient!.createShader(
      path.getBounds(),
      textDirection: configuration.textDirection,
    );
  } else if (color != null) {
    paint.color = color!;
  }

  return paint;
}