Layout component to implement an expressive group of buttons in a row.
@Sampled
@Composable
@RemoteComposable
@WearPreviewDevices
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
fun RemoteButtonGroupThreeButtonSample(modifier: RemoteModifier = RemoteModifier) {
val icons = listOf(Icons.Filled.MailOutline, Icons.Filled.Favorite, Icons.Filled.Call)
RemoteButtonGroup(modifier = modifier.fillMaxWidth()) {
icons.forEach { icon ->
RemoteIconButton(
onClick = hostAction("button_click".rs),
modifier = RemoteModifier.weight(1f.rf),
colors = RemoteIconButtonDefaults.filledIconButtonColors(),
shapes = RemoteIconButtonDefaults.shapes(RemoteButtonDefaults.shape),
) {
RemoteIcon(imageVector = icon.toRemoteImageVector(), contentDescription = null)
}
}
}
}
@Sampled
@Composable
@RemoteComposable
@WearPreviewDevices
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
fun RemoteButtonGroupAnimatedSample(modifier: RemoteModifier = RemoteModifier) {
val buttons =
listOf(
Icons.Filled.MailOutline to 1f.rf,
Icons.Filled.Favorite to 1.5f.rf,
Icons.Filled.Call to 1f.rf,
)
RemoteButtonGroup(modifier = modifier.fillMaxWidth()) {
buttons.forEach { (icon, weight) ->
RemoteIconButton(
onClick = hostAction("button_click".rs),
modifier = RemoteModifier.weight(weight).animateWidth(),
colors = RemoteIconButtonDefaults.filledIconButtonColors(),
shapes = RemoteIconButtonDefaults.shapes(RemoteButtonDefaults.shape),
) {
RemoteIcon(imageVector = icon.toRemoteImageVector(), contentDescription = null)
}
}
}
}