Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Sellami
Created September 27, 2021 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahmed-Sellami/dccf207acf2b843d73e5f56efcd06ee0 to your computer and use it in GitHub Desktop.
Save Ahmed-Sellami/dccf207acf2b843d73e5f56efcd06ee0 to your computer and use it in GitHub Desktop.
@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