Skip to content

Instantly share code, notes, and snippets.

@fvilarino
Created December 4, 2022 01:10
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 fvilarino/a6d8550b2ce9c6508fc96fd064e84197 to your computer and use it in GitHub Desktop.
Save fvilarino/a6d8550b2ce9c6508fc96fd064e84197 to your computer and use it in GitHub Desktop.
Segmented Progress - SIgnature
private const val BackgroundOpacity = 0.25f
private const val NumberOfSegments = 8
private val ProgressHeight = 4.dp
private val SegmentGap = 8.dp
@Composable
fun SegmentedProgressIndicator(
/*@FloatRange(from = 0.0, to = 1.0)*/
progress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colors.primary,
backgroundColor: Color = color.copy(alpha = BackgroundOpacity),
progressHeight: Dp = ProgressHeight,
numberOfSegments: Int = NumberOfSegments,
segmentGap: Dp = SegmentGap
) {
check(progress in 0f..1f) { "Invalid progress $progress" }
check(numberOfSegments > 0) { "Number of segments must be greater than 0" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment