Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Created May 29, 2019 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgeCastilloPrz/38c007aa88092ebdaae6788236cf5ddf to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/38c007aa88092ebdaae6788236cf5ddf to your computer and use it in GitHub Desktop.
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