Yashar
01/24/2021, 5:14 PMBox {
Card(...) {
Row(...)
) {
Surface(
modifier = Modifier
.fillMaxHeight()
.fillMaxWidth(0.5f)
.clickable(onClick = { ... }),
color = Color.Red
) {
...
}
Surface(modifier = Modifier.fillMaxSize().clickable(onClick = { ... }), color = Color.Blue) {
...
}
}
}
Card(
modifier = Modifier
.fillMaxWidth()
.height(boxHeight)
.padding(horizontal = 40.dp, vertical = 16.dp)
.swipeable(
state = swipeableState,
anchors = anchors,
thresholds = { _, _ -> FractionalThreshold(0.3f) },
orientation = Orientation.Horizontal
)
.offset { IntOffset(swipeableState.offset.value.roundToInt(), 0) }
) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.clickable(onClick = { ... })) {
...
}
}
}
matvei
01/25/2021, 5:10 PMoffset
to be before swipeable
. This way your swipeable area will be a top white one, because swipeable bounds will be calculated after offset is applied
3. Consider using experimental SwipeToDismiss that we have in the public API. It seems like it might solve the case you want.Yashar
01/26/2021, 1:00 AMmatvei
01/26/2021, 12:12 PMYashar
01/26/2021, 12:13 PMYashar
01/26/2021, 12:13 PM