Skip to content

Instantly share code, notes, and snippets.

@raghunandankavi2010
Created June 27, 2022 15:04
Show Gist options
  • Save raghunandankavi2010/400a5585c79797d48e7cc791e0838b47 to your computer and use it in GitHub Desktop.
Save raghunandankavi2010/400a5585c79797d48e7cc791e0838b47 to your computer and use it in GitHub Desktop.
Multi Progress.
drawRect(
color = Color(0xFFFEC93E),
topLeft = Offset(greenSize.toPx(), 0f),
size = Size(yellowSize.toPx(), 8.dp.toPx())
)
//draw red progress with offset = yellow progress + green progress
drawRect(
color = Color(0xFFED5554),
topLeft = Offset(greenSize.toPx() + yellowSize.toPx(), 0f),
size = Size(redSize.toPx(), 8.dp.toPx())
)
//draw grey progress with offset = red progress + yellow progress + green progress
drawRect(
color = Color(0xFFBDBDBD),
topLeft = Offset(greenSize.toPx() + yellowSize.toPx() + redSize.toPx(), 0f),
size = Size(graySize.toPx(), 8.dp.toPx())
)
// draw remaining
val progressPath = Path().apply {
addRoundRect(
RoundRect(
rect = Rect(
offset = Offset(graySize.toPx() + greenSize.toPx() + yellowSize.toPx() + redSize.toPx(), 0f),
size = Size(remainingSize.toPx(), 8.dp.toPx()),
),
topRight = cornerRadius,
bottomRight = cornerRadius
)
)
}
drawPath(
path = progressPath,
color = Color(0xFFE0E0E0),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment