我正在使用以下代码:如何在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,)
],
),
),
);
Run Code Online (Sandbox Code Playgroud)
尝试此操作,您只需要Stack对齐中心并添加Textin 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),
),
],
),
),
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1539 次 |
| 最近记录: |