Last active
October 19, 2021 21:43
-
-
Save victorbrndls/5de57563bef84d494c5968197248035e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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