placeholderShimmer
@ExperimentalWearMaterialApi
@Composable
public fun Modifier.placeholderShimmer(
placeholderState: PlaceholderState,
shape: Shape = MaterialTheme.shapes.small,
color: Color = MaterialTheme.colors.onSurface,
): Modifier
Modifier to draw a placeholder shimmer over a component. The placeholder shimmer is a 45 degree gradient from Top|Left of the screen to Bottom|Right. The shimmer is coordinated via the animation frame clock which orchestrates the shimmer so that every component will shimmer as the gradient progresses across the screen.
Example of a Chip
with icon and a label that put placeholders over individual content slots and
then draws a placeholder shimmer over the result:
Example of a Chip
with icon and a primary and secondary labels that draws another Chip
over
the top of it when waiting for placeholder data to load and then draws a placeholder shimmer over
the top:
NOTE: The order of modifiers is important. If you are adding both Modifier.placeholder
and
Modifier.placeholderShimmer
to the same composable then the shimmer must be before in the
modifier chain. Example of Text
composable with both placeholderShimmer and placeholder
modifiers.
Parameters
placeholderState | the current placeholder state that determine whether the placeholder shimmer should be shown. |
shape | the shape of the component. |
color | the color to use in the shimmer. |