flame-engine/flame

ExpandedComponent

Closed this issue · 2 comments

Problem to solve

RowLayout and ColumnLayout have no way to selectively make some of its children expand to fill up remaining space.

Proposal

  1. Under _layoutMainAxisImpl, look for direct children of type ExpandedComponent.
  2. Solve for available expandable space by summing the mainAxis lengths of non-ExpandedComponent children
  3. Divide the expandable space among all ExpandedComponents, and size them to their corresponding spaces.
  4. ExpandedComponent subclasses PaddingComponent (or some common superclass) with shrinkWrap set to false, so that setting its size also sets its child size automatically.

More information

No response

Other

  • Are you interested in working on a PR for this?

Sounds good, but I don't think this should be related to the padding component, since this is a margin and not padding. We should maybe redesign the MarginComponent.

I guess that's fine. The reason I brought up PaddingComponent was because of the behavior I described in item 5 of the proposal. But since item 5 is being contested for PaddingComponent, and that behavior is required for this, I can just implement it specifically for ExpandedComponent.