@OptIn(ExperimentalMaterialApi::class)
@Composable
fun SelectableCard(
modifier: Modifier = Modifier,
selected: Boolean,
enabled: Boolean = true,
backgroundColor: Color = MaterialTheme.colors.surface,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
val strokeColor = if (selected) {
MaterialTheme.colors.secondary
} else {
MaterialTheme.colors.whatever
}
CompositionLocalProvider(
LocalRippleConfiguration provides RippleConfiguration(
color = MaterialTheme.colors.secondary
),
) {
Card(
onClick = onClick,
modifier = modifier,
border = BorderStroke(1.dp, SolidColor(value = strokeColor)),
backgroundColor = backgroundColor,
elevation = 0.dp,
content = content
)
}
}
all there is to it
and the question is now how should I cache the
RippleConfiguration
instance, or if I should at all?