toExpandedCornerShapeOrSelf

fun Shape.toExpandedCornerShapeOrSelf(cornerExpansion: Dp): Shape

Converts this Shape to an ExpandedRoundedCornerShape if it is a RoundedCornerShape, otherwise returns the shape unchanged.

This extension function provides a safe way to expand rounded corner shapes when needed, while preserving other shape types. If the shape is not a RoundedCornerShape, no conversion is performed and the original shape is returned.

Return

An ExpandedRoundedCornerShape if this shape is a RoundedCornerShape, otherwise returns this shape unchanged.

Since

0.5.0

Parameters

cornerExpansion

The additional length to apply to each corner radius. This value is only used if this shape is a RoundedCornerShape.