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
drawCircle(color=Color.Red, center = topLeftControlPoint1, radius = 4f) | |
drawCircle(color=Color.Blue, center = topLeftControlPoint2, radius = 4f) |
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
cubicTo( | |
x1 = topLeftControlPoint1.x, // First Control Point X coordinate | |
y1 = topLeftControlPoint1.y, // First Control Point Y coordinate | |
x2 = topLeftControlPoint2.x, // Second Control Point X coordinate | |
y2 = topLeftControlPoint2.y, // Second Control Point Y coordinate | |
x3 = width.times(.25f), // Line End Point X coordinate | |
y3 = height.times(.02f) // Line End Point Y coordinate | |
) |
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
val topLeftControlPoint1 = Offset(width.times(.02f), height.times(.03f)) | |
val topLeftControlPoint2 = Offset(width.times(.03f), height.times(.02f)) |
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 | |
@Preview(showBackground = true) | |
fun BezierTest() { | |
Canvas(modifier = Modifier.size(300.dp), onDraw = { | |
val path = Path().apply { | |
val width = size.width // Capturing all the available width | |
val height = size.height // Capturing all the available height | |
// Top left corner |
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 | |
@Preview(showBackground = true) | |
fun BezierTest() { | |
Canvas(modifier = Modifier.size(300.dp), onDraw = { | |
val path = Path().apply { | |
// Here's were we'll draw our custom shape's path | |
} |
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 |
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 |
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>>) { | |
val maxMonthValue = monthlyPreview.maxBy { it.second }.second | |
Row( | |
modifier = Modifier.fillMaxSize(), | |
verticalAlignment = Alignment.Bottom | |
) { | |
for (pairPreview in monthlyPreview) { | |
val columnHeightWeight = pairPreview.second / maxMonthValue | |
BarView( |
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>>) { | |
val maxMonthValue = monthlyPreview.maxBy { it.second }.second //<-- We find the max Float value of our Pair List | |
Row( | |
modifier = Modifier.fillMaxSize(), | |
verticalAlignment = Alignment.Bottom //<--- This is important to align them as required by spec | |
) { | |
for (pairPreview in monthlyPreview) { | |
val columnHeightWeight = pairPreview.second / maxMonthValue //<-- We use it to get a value between 0 and 1 | |
Card( |
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>>) { | |
TODO("Not yet implemented") | |
} |