Shadow
Class
Common
class Shadow
private constructor(
val radius: Dp,
val spread: Dp,
val offset: DpOffset,
color: Color,
brush: Brush?,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
val blendMode: BlendMode,
)
Group of parameters that represent how a drop shadow or inner shadow should be rendered.
Secondary Constructors
constructor(
radius: Dp,
brush: Brush,
spread: Dp = 0.dp,
offset: DpOffset = DpOffset.Zero,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = 1f,
blendMode: BlendMode = DefaultBlendMode,
) : this(
radius = radius,
spread = spread,
offset = offset,
color = Color.Black,
brush = brush,
alpha = alpha,
blendMode = blendMode,
)
Creates a group of parameters that represent how a drop shadow or inner shadow should be rendered.
Parameters
radius | The blur radius of the shadow |
brush | Brush used to blend against a mask defined by the shadow geometry |
spread | Optional parameter to grow the shadow geometry by |
offset | Optional parameter to offset the shadow within the geometry bounds |
alpha | Optional opacity of the shadow |
blendMode | Optional blending algorithm used by the shadow |
constructor(
radius: Dp,
color: Color = Color.Black,
spread: Dp = 0.dp,
offset: DpOffset = DpOffset.Zero,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = 1f,
blendMode: BlendMode = DefaultBlendMode,
) : this(
radius = radius,
spread = spread,
offset = offset,
color = if (color.isSpecified) color else Color.Black,
brush = null,
alpha = alpha,
blendMode = blendMode,
)
Creates a group of parameters that represent how a drop shadow or inner shadow should be rendered.
Parameters
radius | The blur radius of the shadow |
color | The color of the shadow. If Color.Unspecified is provided, Color.Black will be used as a default. |
spread | Optional parameter to grow the shadow geometry by |
offset | Optional parameter to offset the shadow within the geometry bounds |
alpha | Optional opacity of the shadow |
blendMode | Optional blending algorithm used by the shadow |
Properties
Common
val color: Color
Color of the shadow. If Color.Unspecified
is provided, Color.Black
will be used as a
default. This color is only used if brush
is null.
Common
val brush: Brush?
Optional brush to render the shadow with.
Common
val alpha: Float
Opacity of the shadow
Common
class Shadow(
@Stable val color: Color = Color(0xFF000000),
@Stable val offset: Offset = Offset.Zero,
@Stable val blurRadius: Float = 0.0f,
)
A single shadow.
Functions
fun copy(
color: Color = this.color,
offset: Offset = this.offset,
blurRadius: Float = this.blurRadius,
): Shadow
Companion Object
Properties
Common
val None = Shadow()
Constant for no shadow.