I have a page of my application consisting solely of Card
that contains a Column
at the end of which is a MaterialList
. Even if my list contains only one or two elements, the map expands its vertical space to the bottom of the screen, and does not stop at the end of the list elements. The column documentation assumes that this is the normal behavior of the column ("Layout of each child with zero or zero coefficient of flexibility (for example, those that are not expanded) with unlimited vertical restrictions"). I thought moving the list to Flexible
might achieve my desired effect, but when I tried, I got the following error:
RenderFlex children have non-zero flex but incoming height constraints are unbounded. I/flutter (11469): When a column is in a parent that does not provide a finite height constraint, for example if it is I/flutter (11469): in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a I/flutter (11469): flex on a child (eg using a Flexible) indicates that the child is to expand to fill the remaining I/flutter (11469): space in the vertical direction. I/flutter (11469): These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child I/flutter (11469): cannot simultaneously expand to fit its parent.
I clearly misunderstand something about how this layout should work.
Here is a sample code of what I now have in my Scaffold
body for this page:
new Container( // Outer container so we can set margins and padding for the cards // that will hold the rest of the view. alignment: FractionalOffset.topCenter, margin: new EdgeInsets.only(top: style.wideMargin), padding: new EdgeInsets.symmetric(horizontal: style.defaultMargin), child: new Card( child: new Column( children: [ new CustomHeader(), // <
)
How can I get a card that wraps Column
widgets tightly?
source share