dashPath function
Path
dashPath(
- Path source, {
- required CircularIntervalList<
double> dashArray, - DashOffset? dashOffset,
Implementation
Path dashPath(
Path source, {
required CircularIntervalList<double> dashArray,
DashOffset? dashOffset,
}) {
assert(dashArray != null); // ignore: unnecessary_null_comparison
dashOffset = dashOffset ?? const DashOffset.absolute(0.0);
// TO-DO: Is there some way to determine how much of a path would be visible today?
final Path dest = Path();
for (final PathMetric metric in source.computeMetrics()) {
double distance = dashOffset._calculate(metric.length);
bool draw = true;
while (distance < metric.length) {
final double len = dashArray.next;
if (draw) {
dest.addPath(metric.extractPath(distance, distance + len), Offset.zero);
}
distance += len;
draw = !draw;
}
}
return dest;
}