Skip to content

Instantly share code, notes, and snippets.

@shakir915
Last active February 9, 2024 12:41
Show Gist options
  • Save shakir915/72165e712c11c9b15e16a60b281f6940 to your computer and use it in GitHub Desktop.
Save shakir915/72165e712c11c9b15e16a60b281f6940 to your computer and use it in GitHub Desktop.
flutter canvas draw a ring with innerRadius and outerRadius
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