Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ArcPainter, rendering background colored circle.
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,
2 * pi, // complete circumference
false,
backgroundPaint);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.