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

Johan Reitan

02/24/2022, 10:49 AM
Has anyone been able to display
LazyColumn
sections as `Card`s like described in this thread? I am trying to implement the following design, where each section could contain 100s of items. This is why I’m hesitant to chuck the whole section inside a
Column
, and loose the benefits of
LazyColumn
. A workaround that I’ve used successfully in
RecyclerView
earlier, is to use a
Card
in each item and modify its corners so that it looks like a whole card when put together. In Compose, however, this workaround produces shadows between every item, as described in the thread I mentioned. That particular issue is marked as Won’t Fix (Infeasible).
The iOS team apparently has no problems implementing this 🤷‍♂️
z

Zoltan Demant

02/24/2022, 10:58 AM
I have the exact same use case. The closest to a solution I managed to get was to skip elevations altogether and extend the "card" to full width. You can then play around with using a shadow at the end of each parent-item. Its not ideal though, and I ended up populating the items inside the card instead (my use case has 1-10 items only, and that doesnt seem to make any difference in terms of performance, theyre all laid out in 0-2 ms).
👍 1
c

Colton Idle

02/27/2022, 10:14 AM
I think the way that I've seen someone on the compose team recommend how to do this is to make use of LazyListScope. Sorry for the ping @Andrey Kulikov but you helped with something like this wayyy back in compose alpha. I wonder if you have any suggestion now that we're in 2022.
👀 2
j

Johan Reitan

02/28/2022, 12:46 PM
I’m guessing you’re talking about this thread: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1611166479125400?thread_ts=1611009295.080700&cid=C01D6HTPATV I completely forgot that I actually chimed in on that thread at the time as well 😄