案例代码
class HomenCenter extends StatelessWidget {
Widget build(BuildContext context) {
// TODO: implement build
return Padding(
padding: EdgeInsets.all(5),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Container(child: Text(‘你好啊‘, style: TextStyle(color: Colors.white),), height: 150, decoration: BoxDecoration(color: Colors.black),
),
)
],
),
SizedBox(height: 5,),
Container(
height: 150,
child: Row(
children: <Widget>[
Expanded(flex: 2, child: Container(decoration: BoxDecoration(color: Colors.yellow))
),
SizedBox(width: 5,),
Expanded(
flex: 1,
child: Column(
children: <Widget>[
Expanded(flex: 1, child: Container(decoration: BoxDecoration(color: Colors.red),)),
SizedBox(height: 5,),
Expanded(flex: 1, child: Container(decoration: BoxDecoration(color: Colors.blue),))
]
)
)
],
),
)
],
),
);
}
}
页面布局 Paddiing Row Column Expanded 组件详解
原文:https://www.cnblogs.com/zhaofeis/p/12333496.html