Created
July 27, 2023 13:33
-
-
Save zurche/b8000eb13dfff704bbde0ac877ecf744 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 | |
fun MonthlyCapPreview(monthlyPreview: List<Pair<String, Float>>) { | |
Column(horizontalAlignment = Alignment.CenterHorizontally) { | |
val maxMonthValue = monthlyPreview.maxBy { it.second }.second | |
Row( | |
modifier = Modifier.fillMaxHeight(.8f), | |
verticalAlignment = Alignment.Bottom | |
) { | |
for (pairPreview in monthlyPreview) { | |
val columnHeightWeight = pairPreview.second / maxMonthValue | |
Card( | |
modifier = Modifier | |
.weight(1f) | |
.fillMaxHeight(columnHeightWeight) | |
.padding(5.dp) | |
) { } | |
} | |
} | |
Row( | |
verticalAlignment = Alignment.CenterVertically | |
) { | |
for (pairPreview in monthlyPreview) { | |
Text( | |
modifier = Modifier.weight(1f), | |
text = pairPreview.first, | |
textAlign = TextAlign.Center | |
) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment