Skip to content

Instantly share code, notes, and snippets.

@AndreVero
Created April 10, 2024 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreVero/1389cf3fde62ee0d2025dd05aa04f903 to your computer and use it in GitHub Desktop.
Save AndreVero/1389cf3fde62ee0d2025dd05aa04f903 to your computer and use it in GitHub Desktop.
Sun and moon composable
@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