Use animateItemPlacement() on feed

Change-Id: Id120a6e84e0641679fa54ebf0e34bb04165aa419
pull/947/head
dahunsi 1 year ago
parent b2498c763f
commit 77451779cd

@ -21,6 +21,7 @@ import android.net.Uri
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope
@ -47,6 +48,7 @@ import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
* An extension on [LazyListScope] defining a feed with news resources. * An extension on [LazyListScope] defining a feed with news resources.
* Depending on the [feedState], this might emit no items. * Depending on the [feedState], this might emit no items.
*/ */
@OptIn(ExperimentalFoundationApi::class)
fun LazyStaggeredGridScope.newsFeed( fun LazyStaggeredGridScope.newsFeed(
feedState: NewsFeedUiState, feedState: NewsFeedUiState,
onNewsResourcesCheckedChanged: (String, Boolean) -> Unit, onNewsResourcesCheckedChanged: (String, Boolean) -> Unit,
@ -88,7 +90,9 @@ fun LazyStaggeredGridScope.newsFeed(
) )
}, },
onTopicClick = onTopicClick, onTopicClick = onTopicClick,
modifier = Modifier.padding(horizontal = 8.dp), modifier = Modifier
.padding(horizontal = 8.dp)
.animateItemPlacement(),
) )
} }
} }

Loading…
Cancel
Save