Hi there, is there a way to use offset/absoluteOff...
# compose
m
Hi there, is there a way to use offset/absoluteOffset in a Column and force the column to fit the content ?
Copy code
@Composable
fun Test() {
    Column(modifier = Modifier.border(2.dp, Color.Red, RectangleShape)) {
        Box(modifier = Modifier
            .fillMaxWidth()
            .padding(horizontal = 10.dp)
            .height(300.dp)
            .border(2.dp, Color.Green, RectangleShape)
        )

        Box(modifier = Modifier
            .fillMaxWidth()
            .padding(horizontal = 10.dp)
            .height(100.dp)
            .offset(y = -(50).dp)
            .border(2.dp, Color.Blue, RectangleShape)
        )

    }
}
a
you could write your own layout modifier with
Modifier.layout {}
that reports a smaller measured size
🙌 1
m
Thank a lot @Adam Powell, I manage to solve the issue with
Copy code
fun Modifier.removeOffsetSpace(
    offsetToRemove: Dp,
) = layout { measurable, constraints ->
    val placeable = measurable.measure(constraints)
    val height = placeable.height - offsetToRemove.roundToPx()

    layout(placeable.width, height) {
        placeable.placeRelative(0, 0)
    }
}
👍 1