Skip to content

Instantly share code, notes, and snippets.

@zurche
Created November 11, 2023 15:49
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 zurche/75dac26aefee082a14dcdc851b1396f0 to your computer and use it in GitHub Desktop.
Save zurche/75dac26aefee082a14dcdc851b1396f0 to your computer and use it in GitHub Desktop.
onClick()
@Composable
private fun NavButton(icon: ImageVector, isSelected: Boolean = false, onClick: () -> Unit) { // <------- HERE
val backgroundColor = if (isSelected) LightOlive else CryptoDark800
val iconTint = if (isSelected) Color.Black else Color.White
Icon(
imageVector = icon,
contentDescription = "contentDescription",
modifier = Modifier
.size(48.dp)
.background(backgroundColor, CircleShape)
.padding(10.dp)
.clickable { onClick() }, // <------- HERE
tint = iconTint
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment