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

Wishnuprathikantam

05/05/2022, 10:41 AM
Copy code
LazyPagingItems<Episodes>
How to use group by with LazyPagingItems? I want to implement a sticky header list here so i would need to convert this to Map<String,List<Episodes>> here. One way i can think of is using the itemSnapshot list, but not sure if it's a good practice. Any help is appreciated. Thanks.
j

Jan Bína

05/05/2022, 12:29 PM
Have a look at the
PagingData.insertSeparators
function, I think that's what you are looking for.
w

Wishnuprathikantam

05/05/2022, 1:10 PM
Yep I know about this function but how do i actually use this with compose?
Copy code
list.forEach { (k, v) ->
            stickyHeader {
                SeasonHeader(header = k)
            }
            items(v.count()) { key ->
                val item = v[key]
                EpisodeItem(
                    imageUrl =  "",
                    productDescription = ,                  
                )
            }
        }
This is how I'm currently populating the lazycolumn (using itemSnapshotList).
9 Views