Created
August 17, 2023 14:53
-
-
Save shoaibmushtaq25/2ed071e6b69fb3a7a2dfd209a03c1656 to your computer and use it in GitHub Desktop.
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
private fun DrawScope.drawCircularProgressIndicator( | |
startAngle: Float, | |
sweep: Float, | |
color: Color, | |
stroke: Stroke | |
) { | |
// To draw this circle we need a rect with edges that line up with the midpoint of the stroke. | |
// To do this we need to remove half the stroke width from the total diameter for both sides. | |
val diameterOffset = stroke.width / 2 | |
val arcDimen = size.width - 2 * diameterOffset | |
drawArc( | |
color = color, | |
startAngle = startAngle, | |
sweepAngle = sweep, | |
useCenter = false, | |
topLeft = Offset(diameterOffset, diameterOffset), | |
size = Size(arcDimen, arcDimen), | |
style = stroke | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment