-
public final class PlaceholderKt
-
-
Method Summary
Modifier and Type Method Description final static Colorcolor(PlaceholderDefaults $self, Color backgroundColor, Color contentColor, Float contentAlpha)Returns the value used as the the colorparameter value on Modifier.placeholder.final static ColorfadeHighlightColor(PlaceholderDefaults $self, Color backgroundColor, Float alpha)Returns the value used as the the highlightColorparameter value of PlaceholderHighlight.Companion.fade.final static ColorshimmerHighlightColor(PlaceholderDefaults $self, Color backgroundColor, Float alpha)Returns the value used as the the highlightColorparameter value of PlaceholderHighlight.Companion.shimmer.final static Modifierplaceholder(Modifier $self, Boolean visible, Color color, Shape shape, PlaceholderHighlight highlight, Function1<Transition.Segment<Boolean>, FiniteAnimationSpec<Float>> placeholderFadeTransitionSpec, Function1<Transition.Segment<Boolean>, FiniteAnimationSpec<Float>> contentFadeTransitionSpec)Draws some skeleton UI which is typically used whilst content is 'loading'. -
-
Method Detail
-
color
final static Color color(PlaceholderDefaults $self, Color backgroundColor, Color contentColor, Float contentAlpha)
Returns the value used as the the
colorparameter value on Modifier.placeholder.- Parameters:
backgroundColor- The current background color of the layout.contentColor- The content color to be used on top of backgroundColor.contentAlpha- The alpha component to set on contentColor when compositing the color on top of backgroundColor.
-
fadeHighlightColor
final static Color fadeHighlightColor(PlaceholderDefaults $self, Color backgroundColor, Float alpha)
Returns the value used as the the
highlightColorparameter value of PlaceholderHighlight.Companion.fade.- Parameters:
backgroundColor- The current background color of the layout.alpha- The alpha component to set on backgroundColor.
-
shimmerHighlightColor
final static Color shimmerHighlightColor(PlaceholderDefaults $self, Color backgroundColor, Float alpha)
Returns the value used as the the
highlightColorparameter value of PlaceholderHighlight.Companion.shimmer.- Parameters:
backgroundColor- The current background color of the layout.alpha- The alpha component to set on backgroundColor.
-
placeholder
final static Modifier placeholder(Modifier $self, Boolean visible, Color color, Shape shape, PlaceholderHighlight highlight, Function1<Transition.Segment<Boolean>, FiniteAnimationSpec<Float>> placeholderFadeTransitionSpec, Function1<Transition.Segment<Boolean>, FiniteAnimationSpec<Float>> contentFadeTransitionSpec)
Draws some skeleton UI which is typically used whilst content is 'loading'.
To customize the color and shape of the placeholder, you can use the foundation version of Modifier.placeholder, along with the values provided by PlaceholderDefaults.
A cross-fade transition will be applied to the content and placeholder UI when the visible value changes. The transition can be customized via the contentFadeTransitionSpec and placeholderFadeTransitionSpec parameters.
You can provide a PlaceholderHighlight which runs an highlight animation on the placeholder. The shimmer and fade implementations are provided for easy usage.
You can find more information on the pattern at the Material Theming Placeholder UI guidelines.
- Parameters:
visible- whether the placeholder should be visible or not.color- the color used to draw the placeholder UI.shape- desired shape of the placeholder.highlight- optional highlight animation.placeholderFadeTransitionSpec- The transition spec to use when fading the placeholder on/off screen.contentFadeTransitionSpec- The transition spec to use when fading the content on/off screen.
-
-
-
-