Last active
February 9, 2024 12:41
-
-
Save shakir915/72165e712c11c9b15e16a60b281f6940 to your computer and use it in GitHub Desktop.
flutter canvas draw a ring with innerRadius and outerRadius
This file contains hidden or 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
double centerX = positioned.dx; | |
double centerY = positioned.dy; | |
// Inner and outer radii | |
double innerRadius =radius; | |
double outerRadius = 500+ ((1 - progress) *500); | |
Paint ringPaint = Paint() | |
..color = colorShadow.withOpacity(opacityShadow) // Color for the ring | |
..style = PaintingStyle.stroke | |
..strokeWidth = outerRadius - innerRadius; // Adjust the width of the ring | |
// Draw the ring using stroke | |
canvas.drawCircle(Offset(centerX, centerY), (outerRadius + innerRadius) / 2, ringPaint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment