Vinay Gaba
07/27/2020, 4:44 PMrawPressStartGestureFilter
to it. This actually works but it also ends up interfering with the scroll of the screen that these composables are on (this is expected as this is how you’d expect this gesture filter to work). Is there a better way to accomplish this? Just using tap
or clickable
on the parent composable still propagates the touch to the child composable so I need a better way to intercept the touch while keeping the scroll functionality intact.galex
07/27/2020, 4:47 PMStack(Modifier.fillMaxSize()) {
children?.invoke()
Box(
modifier = Modifier.fillMaxSize().tapGestureFilter {},
backgroundColor = colorResource(id = R.color.transparent_black),
gravity = ContentGravity.Center
) {
CircularProgressIndicator()
}
}
Vinay Gaba
07/27/2020, 4:49 PMgalex
07/27/2020, 4:58 PMVinay Gaba
07/27/2020, 5:04 PMBox(modifier = Modifier.clickable{ //do Something }) {
child()
}
It’s possible that this does not create an “gesture hierarchy” of sorts but Stack does? Do you happen to know?galex
07/27/2020, 5:16 PMVinay Gaba
07/27/2020, 5:55 PMonPositioned
modifier but the size it returns is incorrect and it ends up occupying a lot more space than the space the child composable occupies.
Stack {
var size by state{ IntSize(0, 0) }
Box(Modifier.onPositioned{size = it.size}) {
childComposable
}
// Height it returns is almost double of what the child composable occupies.
Box(Modifier.height(it.size.dp))
}
Zach Klippenstein (he/him) [MOD]
07/27/2020, 6:39 PMonPositioned
callback will be fired if multiple nodes are re-layed out, so there are clearly bugs. I’d suggest filing a bug.Vinay Gaba
07/27/2020, 6:48 PMmatchParentSize
. So my example would have to look like this and it works!
Stack {
Box {
childComposable()
}
Box(Modifier.matchParentSize())
}