Expand widgets inside the Stack widget
You can try wrapping the Column with a positioned
widget. Set top
to 0 and bottom
to 0. This will make the column fill the stack vertically.
sample code:
Stack(
children: <Widget>[
// Background widget rep
Container(
color: Colors.pink,
),
Positioned(
top: 0,
bottom: 0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('madonna'),
Text('flutter'),
],
),
)
],
)
I think you could wrap you column in a container like this:
Container(
height: double.infinity,
width: double.infinity,
child: Column()
),
Use Positioned.fill
Stack(
children: [
Positioned.fill(
child: Column(
children: [
//...
],
),
),
//...
],
);
More info about Positioned
in Flutter Widget of the Week
How does it work?
This is all about constraints. Constraints are min/max width/height values that are passed from the parent to its children. In the case of Stack
. The constraints it passes to its children state that they can size themselves as small as they want, which in the case of some widgets means they will be their "natural" size. After being sized, Stack
will place its children in the top left corner.Positioned.fill
gets the same constraints from Stack
but passes different constraints to its child, stating the it (the child) must be of exact size (which meant to fill the Stack
).
Positioned.fill()
is the same as:
Positioned(
top: 0,
right: 0,
left: 0,
bottom:0,
child: //...
)