Indication
@Stable interface Indication
androidx.compose.foundation.Indication |
Indication represents visual effects that occur when certain interactions happens. For example: showing a ripple effect when a component is pressed, or a highlight when a component is focused.
An instance of Indication is a factory that is required to produce IndicationInstances on demand for each component that uses an indication modifier using rememberUpdatedInstance.
Indication is typically provided throughout the hierarchy through LocalIndication - you can provide a custom Indication to LocalIndication to change the default Indication used for components such as clickable.
Summary
Public methods | |
---|---|
abstract IndicationInstance |
rememberUpdatedInstance(interactionSource: InteractionSource) remembers a new IndicationInstance, and updates its state based on Interactions emitted via interactionSource . |
Public methods
rememberUpdatedInstance
@Composable abstract fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance
remembers a new IndicationInstance, and updates its state based on Interactions emitted via interactionSource . Typically this will be called by indication, so one IndicationInstance will be used for one component that draws Indication, such as a button.
Implementations of this function should observe Interactions using interactionSource, using them to launch animations / state changes inside IndicationInstance that will then be reflected inside IndicationInstance.drawIndication.
Parameters | |
---|---|
interactionSource: InteractionSource | the InteractionSource representing the stream of Interactions the returned IndicationInstance should represent |
Return | |
---|---|
an | IndicationInstance that represents the stream of Interactions emitted by interactionSource |