https://kotlinlang.org logo
#compose
Title
# compose
k

Koneko Toujou

09/26/2021, 8:45 AM
how does Compose solve the following problem? there exists a Row with a child Row the child Row must know what it's size will be in order to compute how to place it's children but the parent Row cannot know the size of it's child Row until it has measured the child Row, and the child Row cannot know what it's size will be until the parent Row has measured it for example parent Row
measure child Row
> child Row needs to know how big it will be in order to be able to layout it's children
> child Row needs information from parent Row
> > parent Row has no information because it is still trying to measure child Row
> > parent Row does not know how big child Row should be
> child Row does not know how big parent Row wants child Row to be
> child Row cannot measure itself reliably without assuming how big it is going to be
🧵 1
a

Adam Powell

09/26/2021, 2:32 PM
This happens using constraints. Parents measure children by passing a
Constraints
object that contains minimum and maximum width and height. The child can choose to be any size within that range.
k

Koneko Toujou

09/27/2021, 12:13 AM
Thanks :)
👍 1
2 Views