gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 04:20:56 42 4
gpt4 key购买 nike

我正在尝试使用一个容器来显示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/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com