InteractionSource¶
interface InteractionSource
A read-only stream of Interactions a component emits about itself (press, hover, focus, drag). Several independent pieces of UI - the widget's own visuals, a shared "indication" effect, a test assertion - can all observe the same interaction state this way, instead of each hand-rolling its own separate hovered/pressed/focused booleans.
Inheritors¶
Properties¶
interactions¶
abstract val interactions: Flow<Interaction>
Functions¶
collectIsDraggedAsState¶
@Composable
fun InteractionSource.collectIsDraggedAsState(): State<Boolean>
true while a drag is active (until its DragInteraction.Stop/DragInteraction.Cancel).
collectIsFocusedAsState¶
@Composable
fun InteractionSource.collectIsFocusedAsState(): State<Boolean>
true while the component holds vanilla keyboard/controller focus.
collectIsHoveredAsState¶
@Composable
fun InteractionSource.collectIsHoveredAsState(): State<Boolean>
true while the pointer is hovering the component.
collectIsPressedAsState¶
@Composable
fun InteractionSource.collectIsPressedAsState(): State<Boolean>
true while a PressInteraction.Press is active (until its PressInteraction.Release/PressInteraction.Cancel).