Hi All, Can we have custom indication on the selec...
# compose
d
Hi All, Can we have custom indication on the selectable param under Modifier
1
Copy code
.selectable(
    selected = false,
    onClick =  { },
    indication = ???
),
Earlier i was using combinedClickable with a custom Indication, but for some reason it is not working when i'm using it with Navigation for compose. The clicks event are not getting registered. Thats why i switch to selectable
c
I didn’t knew we had a selectable, I implemented one myself 😞
🌈 2
d
@Cicero any idea about the issue that i'm facing with combinedClickable
c
Copy code
@Composable
fun SelectableItem(
    modifier: Modifier = Modifier,
    text: String,
    selected: Boolean = false,
    onClick: (() -> Unit)? = null,
) {

    Button(
        onClick = { onClick?.invoke() },
        modifier = modifier
            .height(gu17)
            .fillMaxWidth()
            .defaultMinSize(minHeight = gu15),
        elevation = ButtonDefaults.elevation(Elevation),
        border = if (selected) BorderStroke(SelectableItemBorderStroke, AppColor.SelectableItemBorder) else null,
        colors = ButtonDefaults.buttonColors(backgroundColor = AppColor.SelectableItemBackground),
    ) {
        Text(
            modifier = Modifier.padding(gu1),
            text = text,
            style = SelectiableItem(),
            fontStyle = null,
            fontWeight = null,
            fontFamily = null,
            textDecoration = null,
            textAlign = TextAlign.Center,
            overflow = TextOverflow.Ellipsis,
            softWrap = true,
            maxLines = 3
        )
    }
}
This is my selectable
I believe there is some updates in the new 06 libraries about navigation and clicks, take a look 🙂
d
Just updated to beta:06, checking if the issue still persists
s
If you specify an indication you have to set the interactionSource as well
d
will try that, thx