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

Leandro Garcia

01/05/2021, 6:45 PM
Hello, I'm getting started with compose and was looking at
LazyColumn
and
LazyColumnFor
when should one or the other be used? I see that
LazyColumnFor
calls
LazyColumn
internally
z

Zach Klippenstein (he/him) [MOD]

01/05/2021, 6:48 PM
I think the
Lazy*For
composables are about to be deprecated
👍 2
c

Colton Idle

01/05/2021, 6:53 PM
Noob... BUT I've used these! but take my advice with a huge grain of salt. If you use LazyColumn then you get to use a "DSL" inside of it for an item or items. Using LazyColumnFor is a shortcut as far as I can tell. See here for a list that I tried to build for LazyColumnFor, but I couldn't have more than one LazyColumnFor wrapped in a Column (which I thought would be the case) Instead I just do LazyColumnFor and use the DSL inside to really easily build a list of heterogeneous items. https://gist.github.com/ColtonIdle/85db918c763076cbb147b722e6807007
l

Leandro Garcia

01/05/2021, 7:07 PM
@Zach Klippenstein (he/him) [MOD] ok, thanks. So I'll just stick with the not `for`ones
z

Zach Klippenstein (he/him) [MOD]

01/05/2021, 8:06 PM
the impl of
Lazy*For
is pretty simple iirc, so you could always just write it yourself for your own codebase if you really want to save a few characters
👍 2