我正在使用这段代码:如何在Flutter中设置这种布局
Container(
height: 200.0,
decoration: new BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
child: Center(
child: Stack(
children: <Widget>[
Icon(Icons.play_arrow, color: Colors.blue, size: 200.0,)
],
),
),
);
答案 0 :(得分:3)
尝试此操作,您只需要使Stack
对准中心并在Text
数组中添加Stack
。
Container(
height: 200.0,
decoration: new BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
child: Center(
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Icon(
Icons.play_arrow,
color: Colors.blue,
size: 200.0,
),
Text(
"Play",
style: TextStyle(fontSize: 18,color: Colors.white),
),
],
),
),
)