Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Repository files navigation

LazyColumnItemDiffAnimations

An experimental method for providing item diff animations in a LazyColumn. Note that this only handles additions and removals, not moves.

ezgif-4-c97be879c5b6

inline fun <T> LazyListScope.animatedItemsIndexed(
    state: List<AnimatedItem<T>>,
    enterTransition: EnterTransition = expandVertically(),
    exitTransition: ExitTransition = shrinkVertically(),
    noinline key: ((item: T) -> Any)? = null,
    crossinline itemContent: @Composable LazyItemScope.(index: Int, item: T) -> Unit
)

The state parameter should be obtained through the use of the updateAnimatedItemsState method:

fun <T> updateAnimatedItemsState(
    newList: List<T>
): State<List<AnimatedItem<T>>> 

Implementation is found here.

Example usage:

val animationState by updateAnimatedItemsState(list)
LazyColumn(Modifier.fillMaxSize()) {
    animatedItemsIndexed(animationState, key = { it }) { _, item ->
        // item content
        // ...
    }
}

This repo also provides an example activity.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.