paint method
Implementation
@override
void paint(Context context, PdfRect box) {
if (colors.isEmpty) {
return;
}
if (colors.length == 1) {
context.canvas
..setFillColor(colors.first)
..fillPath();
}
assert(stops == null || stops!.length == colors.length);
final _focal = focal ?? center;
final _radius = math.min(box.width, box.height);
context.canvas
..saveContext()
..clipPath()
..applyShader(
PdfShading(
context.document,
shadingType: PdfShadingType.radial,
boundingBox: box,
function: PdfBaseFunction.colorsAndStops(
context.document,
colors,
stops,
),
start: _focal.withinRect(box),
end: center.withinRect(box),
radius0: focalRadius * _radius,
radius1: radius * _radius,
extendStart: true,
extendEnd: true,
),
)
..restoreContext();
}