Android 12 Developer Preview is here! Try it out, and give us your feedback!

AwaitPointerEventScope

interface AwaitPointerEventScope : Density
androidx.compose.ui.input.pointer.AwaitPointerEventScope

Receiver scope for awaiting pointer events in a call to PointerInputScope.awaitPointerEventScope.

This is a restricted suspension scope. Code in this scope is always called undispatched and may only suspend for calls to awaitPointerEvent. These functions resume synchronously and the caller may mutate the result before the next await call to affect the next stage of the input processing pipeline.

Summary

Public methods
abstract suspend PointerEvent
awaitPointerEvent(pass: PointerEventPass = PointerEventPass.Main)

Suspend until a PointerEvent is reported to the specified input pass.

Inherited functions
Extension functions
From androidx.compose.foundation.gestures
suspend PointerInputChange?

Reads pointer input events until a drag is detected or all pointers are up.

suspend PointerInputChange
AwaitPointerEventScope.awaitFirstDown(requireUnconsumed: Boolean = true)

Reads events until the first down is received.

suspend PointerInputChange?

Reads pointer input events until a horizontal drag is detected or all pointers are up.

suspend PointerInputChange?
AwaitPointerEventScope.awaitHorizontalTouchSlopOrCancellation(pointerId: PointerId, onTouchSlopReached: (change: PointerInputChange, overSlop: Float) -> Unit)

Waits for horizontal drag motion to pass touch slop, using pointerId as the pointer to examine.

suspend PointerInputChange?
AwaitPointerEventScope.awaitTouchSlopOrCancellation(pointerId: PointerId, onTouchSlopReached: (change: PointerInputChange, overSlop: Offset) -> Unit)

Waits for drag motion to pass touch slop, using pointerId as the pointer to examine.

suspend PointerInputChange?