Created
April 10, 2024 10:09
-
-
Save AndreVero/1389cf3fde62ee0d2025dd05aa04f903 to your computer and use it in GitHub Desktop.
Sun and moon composable
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 SunMoonComponent( | |
rotation: Float, | |
modifier: Modifier = Modifier, | |
) { | |
Box( | |
modifier = modifier | |
) { | |
Icon( | |
painter = painterResource(id = R.drawable.icon_house), | |
contentDescription = "House", | |
Modifier | |
.align(Alignment.Center) | |
.size(60.dp), | |
tint = Color.Gray | |
) | |
Box( | |
modifier = Modifier | |
.fillMaxSize() | |
.rotate(rotation) | |
) { | |
Icon( | |
painter = painterResource(id = R.drawable.icon_sun), | |
contentDescription = "Sun", | |
Modifier.align(Alignment.TopStart), | |
tint = Color.Yellow | |
) | |
Icon( | |
painter = painterResource(id = R.drawable.icon_moon), | |
contentDescription = "Moon", | |
Modifier | |
.align(Alignment.BottomStart) | |
.rotate(180f), | |
tint = Color.White | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment