I'm trying to get a child Box
to extend outside parent Box
when it's height is greater and it's aligned in a certain way. Because the child box is aligned bottom, I'd expect the Cyan line to not be visible when inside the parent box
But instead this happens
Child Box height resizes and prints out as being roughly 20.dp.
Is there a Modifier
I can leverage to achieve this effect?
val density = LocalDensity.current
Box(modifier = Modifier
.padding(top = 250.dp)
.fillMaxWidth()
.height(20.dp)
.background(Color.Red)
.clipToBounds()
) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(80.dp)
.background(Color.Green)
.align(Alignment.BottomCenter)
.onSizeChanged {
density.run {
Log.i("Box Height", it.height.toDp().toString())
}
}
) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(5.dp)
.background(Color.Cyan)
.align(Alignment.TopCenter)
)
Box(
modifier = Modifier
.fillMaxWidth()
.height(5.dp)
.background(Color.Yellow)
.align(Alignment.BottomCenter)
)
Box(
modifier = Modifier
.fillMaxHeight()
.width(5.dp)
.background(Color.Magenta)
.align(Alignment.CenterStart)
)
Box(
modifier = Modifier
.fillMaxHeight()
.width(5.dp)
.background(Color.Blue)
.align(Alignment.CenterEnd)
)
}
}