Is it possible to scope some value in the `Lazy*` ...
# compose
k
Is it possible to scope some value in the
Lazy*
item scope? For example, I would like to apply some background color to an item in my
LazyColumn.
While a user is scrolling, I want the content to be changed but keep the same background color. If I understand it correctly, items are being recycled in the
Lazy*
components, so I guess it should be possible to
remember
something in a “container” (it would be equivalent to keeping something in
ViewHolder
in
RecyclerView
world and binding different data). I could achieve that by hoisting a list of background colors and querying them using a modulo like that:
index.rem(visibleItemCount)
however, it doesn’t feel right, and also
visibleItemCount
can vary.
m
you could use drawBehind the Lazy*, getting the items position relative to parent
k
Thanks, but the color was just an example. I’m still looking for a way to scope something to `Lazy*`’s item 🙂