Compose Modifier

absolutePadding

Apply additional space along each edge of the content in Dp: left, top, right and bottom.

AbsolutePaddingModifier

@Composable
fun AbsolutePaddingModifier() {
    Box(Modifier.background(color = Color.Gray)) {
        Box(
            Modifier.absolutePadding(left = 20.dp, top = 30.dp, right = 20.dp, bottom = 30.dp)
                .size(50.dp)
                .background(Color.Blue)
        )
    }
}

Last updated: