Kazemihabib1996
03/17/2020, 8:30 PMfixedWidth
(maxWidth == minWidth) it sets the containerWidth equal to that with out considering the padding
layout(containerWidth, containerHeight) {
val p = placeable ?: measurables.firstOrNull()?.measure(childConstraints)
p?.let {
val position = alignment.align(
IntPxSize(
containerWidth - it.width - totalHorizontal,
containerHeight - it.height - totalVertical
)
)
it.place(
padding.left.toIntPx() + position.x,
padding.top.toIntPx() + position.y
)
}
}
So it can draw the children outside the container it certain cases for example:
Container(modifier = LayoutSize.Constrain(200.ipx.toDp(), 200.ipx.toDp())
, padding = EdgeInsets(300.ipx.toDp(), 300.ipx.toDp())
) {
Button{Text("H")}
}
In preview it shows it's drawn outside the container but in real device it doesn't draw the children even when preview shows the children inside the Container but return value of align is negative (position variable).
padding = EdgeInsets(300.ipx.toDp(), 300.ipx.toDp(), 300.ipx.toDp(), 300.ipx.toDp())
can create the last situation.