Skip to content

Difference between known_dimensions and available_space in measure functions #716

Answered by nicoburns
ennis asked this question in Q&A
Discussion options

You must be logged in to vote

Broadly:

  • The available_space is the size of the "containing block" (roughly, the parent node) (closely related to the parent_size, but sometimes the available_space is set to MinContent or MaxContent as part of a multi-pass layout algorithm even if the size of parent is actually known. It's best to think of available_space as a constraint that asks: "If you had this much space, then what size would you be?".
  • The known_dimensions are the size of the node itself. And indeed, if the known_dimension in a particular axis is set then you can generally (always I think) ignore the available_space in that axis. The purpose of known_dimensions is to allow the algorithm to ask "If your size in this…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ennis
Comment options

Answer selected by ennis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants