Skip to content

Instantly share code, notes, and snippets.

@CostaFot
Created March 13, 2024 01:35
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 CostaFot/d9dcc9eb2a2aab1732349fb36d16e529 to your computer and use it in GitHub Desktop.
Save CostaFot/d9dcc9eb2a2aab1732349fb36d16e529 to your computer and use it in GitHub Desktop.
@Composable
fun BoxWithConstraintsScope.draggableBox() {
Box(
modifier = Modifier
.fillMaxWidth()
.height(boxHeight)
.background(Color.White)
.align(Alignment.BottomCenter)
.pointerInput(Unit) {
detectVerticalDragGestures { change, dragAmount ->
if (dragAmount < 0f) {
// dragging up
} else if (dragAmount > 0f) {
// dragging down
}
}
}
) {
Image( .... ) // doggo here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment