Hi,
I’m writing a UI layout system myself, and I’m currently stuck on this issue and researching prior art. Widgets like multiline text (or anything that “flows” like that) need to know their assigned width, before they can calculate their desired height, because that width determines the line breaking and how many lines of text the widget will have. A linear constraint system like Cassowary struggles with this, since the relation isn’t linear. Simpler top-down layout algorithms also struggle, since parents usually ask children for their sizes in one pass - not width first, then height, in two passes. How does Flutter handle this?
It’s a specific instance of a more general kind of constraint dependency problem. I’ve been skimming academic papers from the 90’s and 00’s on constraint-based UI layout, but outside of Apple’s Auto Layout (which used Cassowary), it seems most UI libraries don’t use them. Some of the papers discuss other kinds of constraint solvers, besides the linear equations in Cassowary, but none of the papers mention multi-line text widgets, which makes me suspicious that a lot of these are more impractical academic exercises.
Rob