paint method
Implementation
void paint(ActorStroke stroke, ui.Canvas canvas, ui.Path path) {
if (stroke.width == 0) {
return;
}
if (stroke.isTrimmed) {
if (effectPath == null) {
bool isSequential = stroke.trim == TrimPath.sequential;
double start = stroke.trimStart.clamp(0, 1).toDouble();
double end = stroke.trimEnd.clamp(0, 1).toDouble();
double offset = stroke.trimOffset;
bool inverted = start > end;
if ((start - end).abs() != 1.0) {
start = (start + offset) % 1.0;
end = (end + offset) % 1.0;
if (start < 0) {
start += 1.0;
}
if (end < 0) {
end += 1.0;
}
if (inverted) {
final double swap = end;
end = start;
start = swap;
}
if (end >= start) {
effectPath = trimPath(path, start, end, false, isSequential);
} else {
effectPath = trimPath(path, end, start, true, isSequential);
}
} else {
effectPath = path;
}
}
// ignore: parameter_assignments
path = effectPath!;
}
canvas.drawPath(path, _paint);
}