https://kotlinlang.org logo
Title
s

Sean Proctor

05/12/2023, 3:32 PM
Is it possible to specify the bounds of an indication for a custom layout? When someone taps on a row in my
Layout
, I want that row to be indicated, not the entire
Layout
.
c

Chris Fillmore

05/12/2023, 3:49 PM
Any reason the indication isn’t attached to the row?
s

Sean Proctor

05/12/2023, 3:51 PM
It's a custom
Layout
so there is no row composable.
c

Chris Fillmore

05/12/2023, 3:53 PM
Ah, ok, I misunderstood. I haven’t done any custom layouts so I’m not familiar with this problem.
s

Sean Proctor

05/12/2023, 3:53 PM
This is my first one, so me either.
l

Louis Pullen-Freilich [G]

05/12/2023, 4:20 PM
This won't really work as is currently, you'll need to have a separate indication modifier for each row rather than the whole layout.
s

Sean Proctor

05/12/2023, 4:32 PM
How would I specify an indication for a particular row?
l

Louis Pullen-Freilich [G]

05/12/2023, 4:48 PM
You’d need to have a layout (like a
Box
) per row to put the modifier on - if you want the row itself to be clickable / show indication, then you need some layout that defines this bounds / represents this row
It doesn’t really work with a virtual layout like this, if you need to group multiple elements as one for the purposes of indication or otherwise
On a side note you’d probably find that it would make a bunch of stuff much better here: e.g you wouldn’t need to have this manual pointer input tracking logic, you could just add
Modifier.clickable
to each row, which would also properly implement accessibility that your current implementation doesn’t have support for.
s

Sean Proctor

05/13/2023, 12:57 PM
Thanks, that was a great idea. I didn't think about the fact that a row doesn't necessarily need to contain anything.