Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. class ArcPainter extends CustomPainter {
  2. // ...
  3.  
  4. @override
  5. void paint(Canvas canvas, Size size) {
  6. if (backgroundColor != null) {
  7. final Paint backgroundPaint = Paint()
  8. ..color = backgroundColor
  9. ..strokeWidth = strokeWidth
  10. ..style = PaintingStyle.stroke;
  11. canvas.drawArc(
  12. Offset(-strokeWidth / 2, -strokeWidth / 2) &
  13. Size(size.width + strokeWidth, size.height + strokeWidth),
  14. 0,
  15. _completeCircumference,
  16. false,
  17. backgroundPaint);
  18. }
  19.  
  20. final Paint paint = Paint()
  21. ..color = color
  22. ..strokeWidth = strokeWidth
  23. ..style = PaintingStyle.stroke
  24. ..strokeCap = StrokeCap.square;
  25.  
  26. canvas.drawArc(
  27. Offset(-strokeWidth / 2, -strokeWidth / 2) &
  28. Size(size.width + strokeWidth, size.height + strokeWidth),
  29. arcStart,
  30. arcSweep,
  31. false,
  32. paint);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement