paintArc static method

void paintArc(
  1. Canvas canvas,
  2. Offset center,
  3. double radius, {
  4. double startAngle = 0.0,
  5. double sweepAngle = 360.0,
  6. Color color = Colors.blue,
  7. double strokeWidth = 1,
})

绘制圆弧
center 圆心坐标
radius 半径
startAngle 开始角度
sweepAngle 间隔角度
color 画笔颜色
strokeWidth 画笔宽度

Implementation

static void paintArc(
  Canvas canvas,
  Offset center,
  double radius, {
  double startAngle = 0.0,
  double sweepAngle = 360.0,
  Color color = Colors.blue,
  double strokeWidth = 1,
}) {
  Rect rect = Rect.fromCircle(center: center, radius: radius);
  canvas.drawArc(
    rect,
    startAngle * rad,
    sweepAngle * rad,
    false,
    Paint()
      ..color = color
      ..strokeCap = StrokeCap.round
      ..strokeWidth = strokeWidth
      ..style = PaintingStyle.stroke,
  );
}