Created
October 13, 2021 16:42
-
-
Save GRizzi91/9bf1ef68c204cb86801e724ab53d4a6f 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
@Preview | |
@Composable | |
fun DrawSquare() { | |
Canvas( | |
modifier = Modifier | |
.height(100.dp) | |
.width(200.dp) | |
) { | |
drawRect( | |
color = Color.Red, | |
size = Size(width = size.height, height = size.height), | |
topLeft = Offset(x = 0f, y = 0f) | |
) | |
drawRect( | |
color = Color.Black, | |
size = Size(width = size.height, height = size.height), | |
topLeft = Offset(x = 0f, y = 0f), | |
style = Stroke(width = 5f) | |
) | |
drawRect( | |
color = Color.Red, | |
size = Size(width = size.height, height = size.height), | |
topLeft = Offset(x = size.height, y = 0f) | |
) | |
drawRect( | |
color = Color.Black, | |
size = Size(width = size.height, height = size.height), | |
topLeft = Offset(x = size.height, y = 0f), | |
style = Stroke(width = 5f) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment