Created
August 17, 2023 14:41
-
-
Save shoaibmushtaq25/9ca3510b5c45c7063e710c6835bbfe87 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
@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