I have a small Box in a big Box. The large Box has a width of
. The small Box has a width of
Modifier.fillMaxWidth(1 / 7f)
. Elsewhere in my code outside my Composable I am defining an animation. There, I need the offset of my small Box to be the same as its width. Is there any way to use
as a variable? If not, how can I get the right width for my offset?
Zach Klippenstein (he/him) [MOD]
1 year ago
You can use
to get the size of a composable once it’s measured, although the size won’t be available until after the first composition (might be fine depending on your animation).Since your width is also fixed relative to your parent, you could also use
to get the max available width inside your big box and calculate the width for your child yourself (slightly less flexible, but available immediately).