Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Sellami
Created Sep 27, 2021
Embed
What would you like to do?
@ExperimentalAnimationApi
@Composable
fun ShoesCard(shoesArticle: ShoesArticle) {
/* ... */
val isDragged = remember { mutableStateOf(false) }
val zIndex = if (isDragged.value) 1.0f else 0.0f
val rotation = if (isDragged.value) -5.0f else 0.0f
val elevation = if (isDragged.value) 8.dp else 0.dp
Box(
Modifier
.padding(horizontal = 16.dp)
.dragToReorder(
{ isDragged.value = true },
{ isDragged.value = false }
)
.zIndex(zIndex)
.rotate(rotation)
) {
Column(
modifier = Modifier
.shadow(elevation, RoundedCornerShape(8.dp))
.clip(RoundedCornerShape(8.dp))
.background(
color = shoesArticle.color
)
.padding(slotPaddingDp)
.align(Alignment.CenterStart)
.fillMaxWidth()
) { /* ... */ }
Image(/* ... */)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment