我试图在颤振中实现 ARC,但其中有“洞”。
我有什么: 屏幕图像
我想要的: 获取图像
我的代码:
class ProgressArc extends CustomPainter {
bool isBackground;
Color progressColor;
double arcLength;
ProgressArc({
Key? key,
required this.isBackground,
required this.progressColor,
required this.arcLength,
});
@override
void paint(Canvas canvas, Size size) {
final rect = Rect.fromLTRB(0, 0, 300, 300);
final startAngle = -math.pi;
final sweepAngle = arcLength;
final useCenter = false;
final paint = Paint()
..strokeCap = StrokeCap.round
..color = progressColor
..style = PaintingStyle.stroke
..strokeWidth = 20;
var arc = canvas.drawArc(
rect,
startAngle,
sweepAngle,
useCenter,
paint,
);
return arc;
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
// TODO: implement shouldRepaint
throw UnimplementedError();
}
}
你们知道我该怎么办吗?我正在尝试使用 CustomPaint,但接受其他方法我需要这个图表,图表库不支持我需要的这个图表。