---
title: "ShadowContext"
description: "Class responsible for managing shadow related dependencies. This includes creation and caching of
various [DropShadowPainter] and [InnerShadowPainter] instances based on the provided [Shadow]."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
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

```kotlin
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.


```kotlin
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.


```kotlin
fun clearCache()
```


Clear all previously cached `InnerShadowPainter` and `DropShadowPainter` instances alongside
all other shadow dependencies.



