Created
May 31, 2021 17:21
-
-
Save Indy9000/abf5e260a011909a534bcf6d051e64bb to your computer and use it in GitHub Desktop.
animated-donut-chart-06
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
void drawLabels(Canvas canvas, Offset c, double radius, double startAngle, | |
double sweepAngle, String label) { | |
final r = radius * 0.4; | |
final dx = r * cos(startAngle + sweepAngle / 2.0); | |
final dy = r * sin(startAngle + sweepAngle / 2.0); | |
final position = c + Offset(dx, dy); | |
drawTextCentered(canvas, position, label, labelStyle, 100.0, (Size sz) { | |
final rect = Rect.fromCenter( | |
center: position, width: sz.width + 5, height: sz.height + 5); | |
final rrect = RRect.fromRectAndRadius(rect, Radius.circular(5)); | |
canvas.drawRRect(rrect, midPaint); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment