ShadowContext
sealed interface ShadowContext
Class responsible for managing shadow related dependencies. This includes creation and caching of
various DropShadowPainter
and InnerShadowPainter
instances based on the provided Shadow
.
Functions
fun createInnerShadowPainter(shape: Shape, shadow: Shadow): InnerShadowPainter
Return an InnerShadowPainter
instance for the provided shape
and shadow
. This may
return a previously allocated InnerShadowPainter
instance for the same parameters, for
efficiency. For example, a design system that leverages shadows may have the same properties
across multiple UI elements. In this case, the same dependencies for an InnerShadowPainter
can be reused.
fun createDropShadowPainter(shape: Shape, shadow: Shadow): DropShadowPainter
Return a DropShadowPainter
instance for the provided shape
and shadow
. This may return
a previously allocated DropShadowPainter
instance for the same parameters, for efficiency.
For example, a design system that leverages shadows may have the same properties across
multiple UI elements. In this case, the same dependencies for a DropShadowPainter
can be
reused.
fun clearCache()
Clear all previously cached InnerShadowPainter
and DropShadowPainter
instances alongside
all other shadow dependencies.