IndicationInstance
interface IndicationInstance
androidx.compose.foundation.IndicationInstance |
Generic interface to define the instance if the Indication to draw visual effects when certain interaction happens.
Indication can be stateful or stateless, and they expected to be created by Indication and used in-place and not reused between different indication modifiers.
Summary
Public methods | |
---|---|
abstract Unit |
ContentDrawScope.drawIndication(interactionState: InteractionState) Method to draw visual effects based on InteractionState. |
open Unit |
Callback which is called when this IndicationInstance disappears from composition and should free any allocated resources / stop on-going animations / etc |
Public methods
drawIndication
abstract fun ContentDrawScope.drawIndication(interactionState: InteractionState): Unit
Method to draw visual effects based on InteractionState.
Usually, in this method indication reads InteractionState to observe its value and draw any visuals to reflect this state. Refer to the Interaction to see what states are possible and draw visual effects when InteractionState contains them.
This method MUST call ContentDrawScope.drawContent at some point in order to draw the rest of the UI tree below indication.
Parameters | |
---|---|
interactionState: InteractionState | state of the parent of this indication |
onDispose
open fun onDispose(): Unit
Callback which is called when this IndicationInstance disappears from composition and should free any allocated resources / stop on-going animations / etc