David Corrado
04/18/2022, 8:57 PMKirill Grouchnikov
04/18/2022, 9:00 PMDavid Corrado
04/18/2022, 9:10 PMKirill Grouchnikov
04/18/2022, 9:44 PMChris Sinco [G]
04/18/2022, 11:22 PMDavid Corrado
04/19/2022, 12:55 PMKirill Grouchnikov
04/19/2022, 1:03 PMModifier
to be clickable? Is it a name? Is it some logic inside it? Is it all logic inside it? How does a @Composable
function that gets a Modifier
determine if what it gets is this vaguely-defined "clickable"?David Corrado
04/19/2022, 1:22 PMDavid Corrado
04/19/2022, 1:27 PM@Composable
fun AppCard(
modifier: Modifier = Modifier,
content: @Composable () -> Unit
) {
Card {
Box(modifier = modifier) {
content.invoke()
}
}
}
So in order to wrap and have the clickable be to the box you need to pass the modifier to the box. What is the best practice here as I imagine you would want the modifier to be on the root element? Since we have no means to inspect the modifier we can not just pull out the click and get it to the box but have to put everything in the boxKirill Grouchnikov
04/19/2022, 1:34 PMKirill Grouchnikov
04/19/2022, 1:39 PMdazza5000
04/19/2022, 2:03 PMdazza5000
04/19/2022, 2:04 PMdazza5000
04/19/2022, 2:05 PMKirill Grouchnikov
04/19/2022, 2:06 PMModifier.clickable
implementation that makes it a canonical one to handle clicks. If the goal is to prevent the application code to pass any modifier that is tracking mouse and touch interactions and handling them as clicks, then it is simply not doable. If the goal is to prevent the very specific Modifier.clickable
one, then maybe indeed to can look at debug info, or unwrap the clickable chain, or do any similar thing that is going to be super brittle in any case.dazza5000
04/19/2022, 2:07 PM