I feel a little dumb for asking this, but is there...
# compose
s
I feel a little dumb for asking this, but is there a way to allow a child Composable to be larger than a parent Composable?
đź‘Ś 1
t
wrapContentSize(unbounded = true)
maybe?
a
Making a child larger than the parent is exactly what scrolling containers and modifiers do, so yes 🙂
A parent (
Layout
composable or
Modifier.layout
) can measure children however it likes so long as its own reported size matches its requested constraints
s
To be clear, I meant for a child to draw outside the bounds of it’s parents, and actually appear larger
it’s an odd use-case
a
The answer is still yes, layouts in compose don't clip by default, though a few material containers do
s
So if I have an image thats 500dpX500dp, inside of a Box that’s 100dp X 100dp, it won’t clip, and I could still center it?
a
Assuming none of the other containers between that and the root clip it, yes