【发布时间】:2022-02-18 14:21:42
【问题描述】:
我无法弄清楚为什么会发生此错误以及如何解决此问题。这是代码。错误是从顶部到中心小部件之前的行。我认为 () 或 [] 可能还不够,但我想不通。如果有关于解决此类错误的任何提示,我也想知道它们。谢谢你。
Container(
child: Stack(
children: <Widget>[
Container(
margin: const EdgeInsets.only(top: 30.0),
decoration: BoxDecoration(color: Colors.pinkAccent),
),
Row(
children: <Widget>[
IconButton(
icon: Icon(FontAwesomeIcons.user),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.location_on),
onPressed: () {},
),
Spacer(),
IconButton(
icon: Icon(Icons.playlist_add),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.message),
onPressed: () {},
),
],
),
Center(
child: FloatingActionButton(
child: Icon(
Icons.grade,
color: Colors.pinkAccent,
),
backgroundColor: Colors.white,
onPressed: () {},
),
),
],
),
),
【问题讨论】:
-
你错过了第 6 行的右括号和逗号,用于关闭容器
-
该行是否应该是容器的子级?
-
第7行:添加
child: Row(.....
标签: flutter