Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Sellami
Created September 27, 2021 22:07
Embed
What would you like to do?
@ExperimentalAnimationApi
@Composable
fun ShoesCard(
shoesArticle: ShoesArticle,
slideState: SlideState
) {
/* ... */
val verticalTranslation by animateIntAsState(
targetValue = when (slideState) {
SlideState.UP -> -itemHeight
SlideState.DOWN -> itemHeight
else -> 0
},
)
/* ... */
Box(
Modifier
.padding(horizontal = 16.dp)
.dragToReorder(
{ isDragged.value = true },
{ isDragged.value = false }
)
.offset { IntOffset(0, verticalTranslation) }
.zIndex(zIndex)
.rotate(rotation)
) { /* ... */ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment