IntrinsicWidth and IntrinsicHeight

Want all the widgets inside Row or Column to be as tall/wide as the tallest/widest widget? Search no more!

In case you have this kind of layout:

Widget build(BuildContext context) {

return Scaffold(

appBar: AppBar(title: Text('IntrinsicWidth')),

body: Center(

child: Column(

children: <Widget>[

RaisedButton(

onPressed: () {},

child: Text('Short'),

),

RaisedButton(

onPressed: () {},

child: Text('A bit Longer'),

),

RaisedButton(

onPressed: () {},

child: Text('The Longest text button'),

),

],

),

),

);

}

But you would like to have all buttons as wide as the widest, just use IntrinsicWidth :

Widget build(BuildContext context) {

return Scaffold(

appBar: AppBar(title: Text('IntrinsicWidth')),

body: Center(

child: IntrinsicWidth(

child: Column(

crossAxisAlignment: CrossAxisAlignment.stretch,

children: <Widget>[

RaisedButton(

onPressed: () {},

child: Text('Short'),

),

RaisedButton(

onPressed: () {},

child: Text('A bit Longer'),

),

RaisedButton(

onPressed: () {},

child: Text('The Longest text button'),

),

],

),

),

),

);

}