grandstaish
10/31/2020, 12:55 PMCheckbox (but also not appear disabled)?
Context: I have a ListItem with a trailing Checkbox where clicking the list item toggles the checked state. I’m currently sharing the interactionState between the checkbox and list item so that they ripple together. Sharing interactions like this is cool, but I’d prefer having no ripple at all on the checkboxAlexjlockwood
10/31/2020, 5:13 PMAlexjlockwood
10/31/2020, 5:14 PMgrandstaish
10/31/2020, 6:00 PMinteractionState is non-nullableAlexjlockwood
10/31/2020, 6:04 PMAlexjlockwood
10/31/2020, 6:07 PMAlexjlockwood
10/31/2020, 6:11 PMlen
10/31/2020, 8:13 PM@Composable
fun ReadOnlySwitch(checked: Boolean) {
val colors = SwitchConstants.defaultColors(
disabledCheckedThumbColor = MaterialTheme.colors.secondaryVariant,
disabledCheckedTrackColor = MaterialTheme.colors.secondaryVariant,
disabledUncheckedThumbColor = MaterialTheme.colors.surface,
disabledUncheckedTrackColor = MaterialTheme.colors.onSurface
)
Switch(checked, onCheckedChange = {}, enabled = false, colors = colors)
}grandstaish
11/01/2020, 2:14 PMAlexjlockwood
11/01/2020, 6:25 PMLouis Pullen-Freilich [G]
11/01/2020, 6:38 PMgrandstaish
11/01/2020, 8:41 PM