Skip to content

Instantly share code, notes, and snippets.

@shoaibmushtaq25
Last active August 17, 2023 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoaibmushtaq25/3adfed0163d94293e9f6d8f96e60b743 to your computer and use it in GitHub Desktop.
Save shoaibmushtaq25/3adfed0163d94293e9f6d8f96e60b743 to your computer and use it in GitHub Desktop.
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