【问题标题】:Flutter Error too many positional arguments颤振错误太多位置参数
【发布时间】: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


【解决方案1】:

我通过删除行内的行解决了同样的错误 所以不要在行标签内写行标签,否则你会遇到这个错误

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2019-10-22
  • 1970-01-01
  • 2020-04-20
  • 2021-04-21
  • 1970-01-01
  • 2021-06-04
  • 2020-01-23
  • 2020-08-10
  • 1970-01-01
相关资源
最近更新 更多