代码:
new Row(
children: <Widget>[
new RaisedButton(
onPressed: (){},
color: Colors.red,
child: new Text('红色按钮'),
),
Expanded(child: new RaisedButton(
onPressed: (){},
color: Colors.green,
child: new Text('绿色按钮'),
),),
new RaisedButton(
onPressed: (){},
color: Colors.blue,
child: new Text('蓝色按钮'),
)
总结:
//横向布局
Row(
children:<widget>{
//不灵活布局
new ReisedButton(
onPressed:(){}//不处理
color ://颜色
child:new Text(‘’)按钮文字
),
//灵活布局
Expanded(child: new RaisedButton(
同上
),),
如果两边不灵活布局 中间一个灵活,那就会不灵活布局是根据内容大小展示,灵活的自动撑满一行
}
],
),