flutter - “Positional arguments must occur before named arguments. Try moving all of the positional arguments before the named arguments”错误抖动

标签 flutter dart containers

我正在尝试使用一个容器来显示TextField,但是该容器不喜欢我的操作顺序。这是我的代码:

  Widget build(BuildContext context) {
return Scaffold(
    appBar: AppBar(
      title: Text("New Grocery List"),
    ),
    drawer: AppDrawer(),
    Container(
      child: Column(
        children: <Widget>[
          TextField(
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Default TextField',
            ),
          ),
        ],
      ),
    )
);
}
我发现容器代码在另一个可能起作用的线程中,所以我认为它是由于其他原因而发生的。

最佳答案

问题是您缺少脚手架的 body 。尝试将body:放在Contaiter之前。

Widget build(BuildContext context) {
return Scaffold(
    appBar: AppBar(
      title: Text("New Grocery List"),
    ),
    drawer: AppDrawer(),
    body: Container( //put body in this line
      child: Column(
        children: <Widget>[
          TextField(
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Default TextField',
            ),
          ),
        ],
      ),
    )
);
}

关于flutter - “Positional arguments must occur before named arguments. Try moving all of the positional arguments before the named arguments”错误抖动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62643792/

相关文章:

c++组合(有一个)问题

flutter - 在 flutter 中停止在 DraggableScrollableSheet 中滚动

list - 在 flutter dart 中合并 2 个对象列表的最简单方法是什么?

flutter - 用容器包装脚手架以获得渐变背景,如何在 flutter 中将渐变设置为容器背景?

来自现有 Rails/Unicorn/MySQL 应用程序的 Docker 镜像

node.js - 从 docker 容器连接到主机 mongodb

dart - 弹出第二页后触发FirstPage的setState方法

flutter - 无法在 listView.builder 中显示原生广告?

dart - 将Dart代码格式设置为html

flutter - IconButton onPressed函数抛出错误代码