我在树中得到了很多小部件组,并想开始将它们提取到自己的小部件中。
我尝试使用 Ctrl-Alt-W,此命令不执行任何操作,并且在出现问题时不显示任何错误。
如果您转到顶部菜单并单击重构、提取、提取到小部件,则会出现以下错误:
Can only extract a widget expression or a method returning widget.
这是我试图提取的代码示例:
Expanded(
child: Container(
child: Padding(
padding: const EdgeInsets.only(
left: 8.0,
right: 8.0,
top: 8.0,
bottom: 4.0),
child: new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
filled: true,
hintStyle: new TextStyle(
color: Colors.grey[800]),
hintText: "Supervisor",
fillColor: Colors.white70),
),
),
),
),
我将如何修改小部件树中的此代码以返回以便可以轻松提取它。
谢谢
最佳答案
关于Flutter 提取小部件需要返回小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56558409/