Created
June 27, 2022 15:04
-
-
Save raghunandankavi2010/400a5585c79797d48e7cc791e0838b47 to your computer and use it in GitHub Desktop.
Multi Progress.
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
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