Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ArcPainter extends CustomPainter {
- // ...
- @override
- void paint(Canvas canvas, Size size) {
- if (backgroundColor != null) {
- final Paint backgroundPaint = Paint()
- ..color = backgroundColor
- ..strokeWidth = strokeWidth
- ..style = PaintingStyle.stroke;
- canvas.drawArc(
- Offset(-strokeWidth / 2, -strokeWidth / 2) &
- Size(size.width + strokeWidth, size.height + strokeWidth),
- 0,
- _completeCircumference,
- false,
- backgroundPaint);
- }
- final Paint paint = Paint()
- ..color = color
- ..strokeWidth = strokeWidth
- ..style = PaintingStyle.stroke
- ..strokeCap = StrokeCap.square;
- canvas.drawArc(
- Offset(-strokeWidth / 2, -strokeWidth / 2) &
- Size(size.width + strokeWidth, size.height + strokeWidth),
- arcStart,
- arcSweep,
- false,
- paint);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement