I want to make an animation of a button, when clicked, its sizes increase and go beyond the size of the Box(). I wrote an animation with a custom Shape, it works, but where it is used, you have to write Modifier.size(21.dp) instead of Modifier.size(20.dp). And look like:
Can I somehow write an animation with an output beyond the sizes of Box()? Because now the solution looks a little complicated
Default Composables like Box, Row or Column limit maximum height or width a child can get based on their maximum Constraints. You can find more details about Constraints and how size modifiers work under the hood in this answer.
What you should do is to force maximum
Constraints
beyond parent if you wish to increase a child's maximum dimensions bigger than parent.You can use
Modifier.wrapContentSize(unBounded=true)
,Modifier.requiredSize
orModifier.layout{}
which wrapContentSize also does under the hood to animate size beyond parents.