Last active
August 17, 2023 15:00
-
-
Save shoaibmushtaq25/3adfed0163d94293e9f6d8f96e60b743 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
Canvas( | |
Modifier | |
.progressSemantics(currentValue / maxValue.toFloat()) | |
.size(CircularIndicatorDiameter) | |
) { | |
// Start at 12 O'clock | |
val startAngle = 270f | |
val sweep: Float = animateFloat.value * 360f | |
val diameterOffset = stroke.width / 2 | |
drawCircle( | |
color = progressBackgroundColor, | |
style = stroke, | |
radius = size.minDimension / 2.0f - diameterOffset | |
) | |
drawCircularProgressIndicator(startAngle, sweep, progressIndicatorColor, stroke) | |
if (currentValue == maxValue) { | |
drawCircle( | |
color = completedColor, | |
style = stroke, | |
radius = size.minDimension / 2.0f - diameterOffset | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment