Skip to content

Instantly share code, notes, and snippets.

@shoaibmushtaq25
Created August 17, 2023 14:41
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/9ca3510b5c45c7063e710c6835bbfe87 to your computer and use it in GitHub Desktop.
Save shoaibmushtaq25/9ca3510b5c45c7063e710c6835bbfe87 to your computer and use it in GitHub Desktop.
@Composable
private fun ProgressStatus(
currentValue: Int,
maxValue: Int,
progressBackgroundColor: Color,
progressIndicatorColor: Color,
completedColor: Color, modifier: Modifier = Modifier
) {
Text(modifier = modifier, text = buildAnnotatedString {
val emphasisSpan =
Typography.titleLarge.copy(color = if (currentValue == maxValue) completedColor else progressIndicatorColor)
.toSpanStyle()
val defaultSpan =
Typography.bodyMedium.copy(color = progressBackgroundColor).toSpanStyle()
append(AnnotatedString("$currentValue", spanStyle = emphasisSpan))
append(AnnotatedString(text = "/", spanStyle = defaultSpan))
append(AnnotatedString(text = "$maxValue", spanStyle = defaultSpan))
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment