Skip to content

Instantly share code, notes, and snippets.

@GabriellCosta
Created September 19, 2023 14:57
Show Gist options
  • Save GabriellCosta/4a7635db48f079e0fe46ddd650b4b22f to your computer and use it in GitHub Desktop.
Save GabriellCosta/4a7635db48f079e0fe46ddd650b4b22f to your computer and use it in GitHub Desktop.
Compose swipe
val dismissState = rememberDismissState(
confirmStateChange = { dismissValue ->
if (dismissValue == DismissValue.DismissedToStart) {
dismissAction()
true
} else {
false
}
}
)
val directions = buildSet {
if (model.isSwappable) {
add(DismissDirection.EndToStart)
}
}
SwipeToDismiss(
directions = directions,
state = dismissState,
background = { },
) {
InternalShipmentItemComposable(
modifier,
model,
)
}
@GabriellCosta
Copy link
Author

InternalShipmentItemComposable is just a normal composable

background = { } will receive the view that is behind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment