-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
@Composable
private fun GoodExample7(
snackbarLauncher: SnackbarLauncher?
) {
val cardClickMessage = stringResource(id = R.string.custom_focus_indicators_example_7_message)
val interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
var isCheck by remember { mutableStateOf(false) }
OutlinedCard(
onClick = {
snackbarLauncher?.show(cardClickMessage)
},
modifier = Modifier
.padding(top = 8.dp)
.indication(
interactionSource = interactionSource,
indication = VisibleFocusIndication(
themedIndicationColor = MaterialTheme.colorScheme.primary
)
).toggleable(
value = isCheck,
onValueChange = { isCheck = it },
role = Role.Checkbox,
interactionSource = interactionSource,
indication = ripple()
)
,
// Key technique: Provide a common interactionSource to both clickable Card and indication.
interactionSource = interactionSource
) {
Row (
horizontalArrangement = Arrangement.Center,
modifier = Modifier.padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
BodyText(
textId = R.string.custom_focus_indicators_example_7_card_description,
modifier = Modifier
)
Checkbox(checked = isCheck, onCheckedChange = null)
}
}
}
Expected:
After the click event, it should keep showing the Border indication. An additional issue, is if there is some other update say for example a progress bar update, in those cases it also loses the focus from the element.
Metadata
Metadata
Assignees
Labels
No labels

