innerShadow
Functions summary
Modifier |
Modifier.innerShadow(shape: Shape, block: InnerShadowScope.() -> Unit)Draws an inner shadow behind the rest of the content with the geometry specified by the given shape and the shadow properties defined the |
Cmn
|
Modifier |
Modifier.innerShadow(shape: Shape, shadow: Shadow)Draws an inner shadow on top of the rest of the content with the geometry specified by the given shape and the shadow properties defined by the |
Cmn
|
Functions
Modifier.innerShadow
fun Modifier.innerShadow(shape: Shape, block: InnerShadowScope.() -> Unit): Modifier
Draws an inner shadow behind the rest of the content with the geometry specified by the given shape and the shadow properties defined the InnerShadowScope. This is different than Modifier.shadow as this does not introduce a graphicsLayer to render elevation based shadows. This shadow is rendered without a single light source and will render consistently regardless of the on screen position of the content. This is similar to Modifier.innerShadow except that specification of inner shadow parameters is done with the lambda with InnerShadowScope allows for more efficient transformations for animated use cases without recomposition.
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.ui.Modifier import androidx.compose.ui.draw.innerShadow import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.shadow.Shadow import androidx.compose.ui.unit.dp Box(Modifier.size(100.dp, 100.dp).innerShadow(RectangleShape, Shadow(12.dp)))
| Parameters | |
|---|---|
shape: Shape |
Geometry of the shadow |
block: InnerShadowScope.() -> Unit |
|
Modifier.innerShadow
fun Modifier.innerShadow(shape: Shape, shadow: Shadow): Modifier
Draws an inner shadow on top of the rest of the content with the geometry specified by the given shape and the shadow properties defined by the Shadow. This is different than Modifier.shadow as this does not introduce a graphicsLayer to render elevation based shadows. Additionally this shadow will render only within the geometry and can be used to provide a recessed like visual effect. This shadow is rendered without a single light source and will render consistently regardless of the on screen position of the content.
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.size import androidx.compose.ui.Modifier import androidx.compose.ui.draw.innerShadow import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.shadow.Shadow import androidx.compose.ui.unit.dp Box(Modifier.size(100.dp, 100.dp).innerShadow(RectangleShape, Shadow(12.dp)))