Created
May 29, 2019 21:29
-
-
Save JorgeCastilloPrz/38c007aa88092ebdaae6788236cf5ddf to your computer and use it in GitHub Desktop.
ArcPainter, rendering background colored circle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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