paintDottedBorder method
void
paintDottedBorder(
- Canvas canvas,
- Rect rect, {
- BorderSide top = BorderSide.none,
- BorderSide right = BorderSide.none,
- BorderSide bottom = BorderSide.none,
- BorderSide left = BorderSide.none,
Implementation
void paintDottedBorder(Canvas canvas, Rect rect,
{BorderSide top = BorderSide.none,
BorderSide right = BorderSide.none,
BorderSide bottom = BorderSide.none,
BorderSide left = BorderSide.none}) {
final Paint paint = Paint()..strokeWidth = 0.0;
final Path path = Path();
switch (top.style) {
case BorderStyle.solid:
paint.color = top.color;
path.reset();
path.moveTo(rect.left, rect.top + top.width / 2);
path.lineTo(rect.right, rect.top + top.width / 2);
paint.style = PaintingStyle.stroke;
canvas.drawPath(_buildDashPath(path, length, space),
paint..strokeWidth = top.width);
break;
case BorderStyle.none:
break;
}
switch (right.style) {
case BorderStyle.solid:
paint.color = right.color;
path.reset();
path.moveTo(rect.right, rect.top);
path.lineTo(rect.right, rect.bottom);
paint.style = PaintingStyle.stroke;
canvas.drawPath(_buildDashPath(path, length, space),
paint..strokeWidth = right.width);
break;
case BorderStyle.none:
break;
}
switch (bottom.style) {
case BorderStyle.solid:
paint.color = bottom.color;
path.reset();
path.moveTo(rect.right, rect.bottom);
path.lineTo(rect.left, rect.bottom);
paint.style = PaintingStyle.stroke;
canvas.drawPath(_buildDashPath(path, length, space),
paint..strokeWidth = bottom.width);
break;
case BorderStyle.none:
break;
}
switch (left.style) {
case BorderStyle.solid:
paint.color = left.color;
path.reset();
path.moveTo(rect.left + left.width / 2, rect.bottom);
path.lineTo(rect.left + left.width / 2, rect.top);
paint.style = PaintingStyle.stroke;
canvas.drawPath(_buildDashPath(path, length, space),
paint..strokeWidth = left.width);
break;
case BorderStyle.none:
break;
}
}