Skip to content

Instantly share code, notes, and snippets.

@victorbrndls
Last active October 19, 2021 21:43
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 victorbrndls/5de57563bef84d494c5968197248035e to your computer and use it in GitHub Desktop.
Save victorbrndls/5de57563bef84d494c5968197248035e to your computer and use it in GitHub Desktop.
combinedClickable(onLongClick, onDoubleClick, onClick)
draggable(
orientation = Orientation.Horizontal,
state = rememberDraggableState { delta ->
val newValue = offsetPosition.value + delta
offsetPosition.value = newValue.coerceIn(minPx, maxPx)
}
)
swipeable(
state = swipeableState,
anchors = anchors,
thresholds = { _, _ -> FractionalThreshold(0.3f) },
orientation = Orientation.Horizontal
)
pointerInput(Unit) {
detectTapGestures(onPress, onDoubleTap, onLongPress, onTap)
detectDragGestures { change, dragAmount ->
change.consumeAllChanges()
offsetX += dragAmount.x
offsetY += dragAmount.y
}
}
horizontalScroll, verticalScroll
// Detects the scroll gestures, but does not offset its contents.
// Has nested scroll built in
scrollable
nestedScroll(nestedScrollConnection, nestedScrollDispatcher)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment