androidx.compose.ui.input.pointer
pointerInput
Function · from org.jetbrains.compose.ui:ui:1.12.2
No hand-written docs yet.
Create a modifier for processing pointer input within the region of the modified element.
Form 1
fun Modifier.pointerInput(key1: Any?, block: PointerInputEventHandler): Modifier
key1: Any?Required
key1: Any?RequiredNot described.
block: PointerInputEventHandlerRequired
block: PointerInputEventHandlerRequiredNot described.
With key2
fun Modifier.pointerInput(
key1: Any?,
key2: Any?,
block: PointerInputEventHandler,
): Modifier
key2: Any?Required
key2: Any?RequiredNot described.
With keys
fun Modifier.pointerInput(vararg keys: Any?, block: PointerInputEventHandler): Modifier
keys: Any?Required
keys: Any?RequiredNot described.
Same as above: block.
Library docs
Create a modifier for processing pointer input within the region of the modified element.
pointerInput blocks may call PointerInputScope.awaitPointerEventScope to install a pointer
input handler that can AwaitPointerEventScope.awaitPointerEvent to receive and consume pointer
input events. Extension functions on PointerInputScope or AwaitPointerEventScope may be
defined to perform higher-level gesture detection. The pointer input handling block will be
cancelled and re-started when pointerInput is recomposed with a different key1 or the
block class is different.
When a pointerInput modifier is created by composition, if block captures any local variables
to operate on, two patterns are common for working with changes to those variables depending on
the desired behavior.
Specifying the captured value as a key``key1 parameter will cause block to cancel and restart
from the beginning if the value changes: