androidx.compose.material.ripple
Interfaces
RippleAlpha | |
RippleTheme |
Defines the appearance for Ripples. |
Annotations
ExperimentalRippleApi |
Top-level functions summary
Unit |
RippleAlpha defines the alpha of the ripple / state layer for a given Interaction. |
Indication |
rememberRipple(bounded: Boolean = true, radius: Dp = Dp.Unspecified, color: Color = Color.Unspecified) Creates and remembers a Ripple using values provided by RippleTheme. |
Indication |
rememberRippleIndication(bounded: Boolean = true, radius: Dp? = null, color: Color = Color.Unspecified) Creates and remembers a Ripple using values provided by RippleTheme. |
Top-level properties summary
ProvidableAmbient<RippleTheme> |
Ambient used for providing RippleTheme down the tree. |
Top-level functions
<no name provided>
fun <no name provided>(): Unit
RippleAlpha defines the alpha of the ripple / state layer for a given Interaction.
rememberRipple
@Composable fun rememberRipple(
bounded: Boolean = true,
radius: Dp = Dp.Unspecified,
color: Color = Color.Unspecified
): Indication
Creates and remembers a Ripple using values provided by RippleTheme.
A Ripple is a Material implementation of Indication that expresses different Interactions by drawing ripple animations and state layers.
A Ripple responds to Interaction.Pressed by starting a new RippleAnimation, and responds to other Interactions by showing a fixed StateLayer with varying alpha values depending on the Interaction.
If you are using MaterialTheme in your hierarchy, a Ripple will be used as the default Indication inside components such as androidx.compose.foundation.clickable and androidx.compose.foundation.indication. You can also manually provide Ripples through androidx.compose.foundation.AmbientIndication for the same effect if you are not using MaterialTheme.
You can also explicitly create a Ripple and provide it to components in order to change the parameters from the default, such as to create an unbounded ripple with a fixed size.
Parameters | |
---|---|
bounded: Boolean = true | If true, ripples are clipped by the bounds of the target layout. Unbounded ripples always animate from the target layout center, bounded ripples animate from the touch position. |
radius: Dp = Dp.Unspecified | the radius for the ripple. If Dp.Unspecified is provided then the size will be calculated based on the target layout size. |
color: Color = Color.Unspecified | the color of the ripple. This color is usually the same color used by the text or iconography in the component. This color will then have RippleTheme.rippleAlpha applied to calculate the final color used to draw the ripple. If Color.Unspecified is provided the color used will be RippleTheme.defaultColor instead. |
rememberRippleIndication
@Composable funrememberRippleIndication(
bounded: Boolean = true,
radius: Dp? = null,
color: Color = Color.Unspecified
): Indication
Deprecated.
Creates and remembers a Ripple using values provided by RippleTheme.
A Ripple is a Material implementation of Indication that expresses different Interactions by drawing ripple animations and state layers.
A Ripple responds to Interaction.Pressed by starting a new RippleAnimation, and responds to other Interactions by showing a fixed StateLayer with varying alpha values depending on the Interaction.
If you are using MaterialTheme in your hierarchy, a Ripple will be used as the default Indication inside components such as androidx.compose.foundation.clickable and androidx.compose.foundation.indication. You can also manually provide Ripples through androidx.compose.foundation.AmbientIndication for the same effect if you are not using MaterialTheme.
You can also explicitly create a Ripple and provide it to components in order to change the parameters from the default, such as to create an unbounded ripple with a fixed size.
Parameters | |
---|---|
bounded: Boolean = true | If true, ripples are clipped by the bounds of the target layout. Unbounded ripples always animate from the target layout center, bounded ripples animate from the touch position. |
radius: Dp? = null | the radius for the ripple. If null is provided then the size will be calculated
based on the target layout size. |
color: Color = Color.Unspecified | the color of the ripple. This color is usually the same color used by the text or iconography in the component. This color will then have RippleTheme.rippleAlpha applied to calculate the final color used to draw the ripple. If Color.Unspecified is provided the color used will be RippleTheme.defaultColor instead. |
Top-level properties
AmbientRippleTheme
val AmbientRippleTheme: ProvidableAmbient<RippleTheme>
Ambient used for providing RippleTheme down the tree.
See RippleTheme.defaultRippleColor and RippleTheme.defaultRippleAlpha functions for the default implementations for color and alpha.