How to make a widget fill remaining space in a Column
Not 100% sure but I think you mean this. The Expanded widget expands to the space it can use. Althought I think it behaves a bit differently in a Row or Column.
new Column(
children: <Widget>[
new Text('Title',
style: new TextStyle(fontWeight: FontWeight.bold)
),
new Expanded(
child: new Text('Datetime',
style: new TextStyle(color: Colors.grey)
),
),
],
)
You can use:
-
Expanded
withAlign
to position childColumn( children: [ FlutterLogo(), Expanded( // add this child: Align( alignment: Alignment.bottomCenter, child: FlutterLogo(), ), ), ], )
-
Spacer
Column( children: [ FlutterLogo(), Spacer(), // add this FlutterLogo(), ], )
-
mainAxisAlignment
Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, // add this children: [ FlutterLogo(colors: Colors.orange), FlutterLogo(colors: Colors.blue), ], )
If you need just to add blank space, use Spacer()
new Column(
children: <Widget>[
new Text('Title',
style: new TextStyle(fontWeight: FontWeight.bold)
),
new Text('Datetime',
style: new TextStyle(color: Colors.grey)
),
Spacer(),
],