构造函数
const Expanded({
Key key,
int flex = 1, //
@required Widget child, // 必需有
})
Expanded 必须配合Columns、Row、Flex使用
DEMO

return Row(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
color: Colors.blueAccent,
alignment: Alignment.center,
child: Text("1"),
height: 50,
),
),
Expanded(
flex: 2,
child: Container(
color: Colors.red,
alignment: Alignment.center,
child: Text("1"),
height: 50,
),
),
Expanded(
flex: 3,
child: Container(
color: Colors.amber,
alignment: Alignment.center,
child: Text("1"),
height: 50,
),
)
],
);
网友评论