https://kotlinlang.org logo
#compose
Title
# compose
p

PHondogo

03/26/2023, 8:34 AM
Hello! I have state as Array<Array<Int>> and have composable as Row[Column] rendering it. I need to handle click event knowing (rowIndex, columnIndex) of target cell. If attach clickabe for each cell it take much time for redrawing when matrix is large. Is it possible to attach clickable on container element and somehow calculate rowIndex and columnIdex for each click event on container? If yes how?
l

Loney Chou

03/26/2023, 4:56 PM
Modifier.pointerInput
is what you need, the ultimate pointer input handler. Maybe
PointerInputScope.detectTapGestures
can somehow help you here, though it's a quite large extension.
4 Views