Hey all is there any way for a `Box` to stop const...
# compose
i
Hey all is there any way for a
Box
to stop constraining its children? I just want them to overflow when I
offset(x,y)
them or size them
Copy code
Box(Modifier.size(256.dp)) {
    Box(Modifier.border(2.dp, Color.Red).size(512.dp)) {
    }
}
The inner box always gets constrained to the outer box which I don’t want, but I do want all the cool things about the box such as
Alignment
I just don’t want it to constrain children size, any ideas? 🙂
m
You can achieve that by appending
wrapContentSize(unbounded=true)
modifier to the chain of the outer Box's modifiers:
Copy code
Box(Modifier.size(256.dp).wrapContentSize(unbounded=true)) {
    Box(Modifier.border(2.dp, Color.Red).size(512.dp)) {
    }
}
❤️ 1
i
ah nice one!