Created
November 17, 2021 13:53
-
-
Save go-cristian/c3fa893581ed48393077abc3e5ccca25 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
@Composable | |
fun SelectionPill( | |
option: ToggleButtonOption, | |
selected: Boolean, | |
onClick: (option: ToggleButtonOption) -> Unit = {} | |
) { | |
Button( | |
onClick = { onClick(option) }, | |
colors = ButtonDefaults.buttonColors( | |
backgroundColor = MaterialTheme.colors.background, | |
), | |
shape = RoundedCornerShape(0), | |
elevation = ButtonDefaults.elevation(0.dp, 0.dp), | |
contentPadding = PaddingValues(0.dp), | |
modifier = Modifier.padding(14.dp, 0.dp), | |
) { | |
Row( | |
modifier = Modifier.padding(0.dp), | |
verticalAlignment = Alignment.Bottom, | |
) { | |
Title5( | |
text = option.text, | |
color = if (selected) highlighted() else nonHighlighted(), | |
modifier = Modifier.padding(0.dp), | |
) | |
if (option.iconRes != null) { | |
Icon( | |
painterResource(id = option.iconRes), | |
contentDescription = null, | |
tint = if (selected) highlighted() else nonHighlighted(), | |
modifier = Modifier.padding(4.dp, 2.dp, 2.dp, 2.dp), | |
) | |
} | |
} | |
} | |
} |
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 VerticalDivider() { | |
Divider( | |
modifier = Modifier | |
.fillMaxHeight() | |
.width(2.dp) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment