package com.ustadmobile.libuicompose.components import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.grid.LazyGridScope import androidx.compose.runtime.Composable import androidx.paging.compose.itemKey import app.cash.paging.compose.LazyPagingItems fun LazyGridScope.ustadPagedItems( pagingItems: LazyPagingItems, key: (T) -> Any, itemContent: @Composable (T?) -> Unit ) { items( count = pagingItems.itemCount, key = pagingItems.itemKey { key(it) } ) { index -> itemContent(pagingItems[index]) } } fun LazyListScope.ustadPagedItems( pagingItems: LazyPagingItems, key: (T) -> Any, itemContent: @Composable (T?) -> Unit ) { items( count = pagingItems.itemCount, key = pagingItems.itemKey { key(it) } ) { index -> itemContent(pagingItems[index]) } }