【发布时间】:2021-06-29 07:00:28
【问题描述】:
我正在尝试创建一个 FocusNode 来列出文本,但我没有这样做。
userNameNode 是:
final FocusNode userNameNode =FocusNode();
导致错误的userNameNode的用法:
Stack(
fit: StackFit.passthrough,
textDirection: TextDirection.ltr,
children: const [
_Image(),
_ListOfInputs(
userNameNode: userNameNode,
)]);
userNameNode的错误是:
The values in a const list literal must be constants.
Try removing the keyword 'const' from the list literal.dart(non_constant_list_element)
The element type 'dynamic' can't be assigned to the list type 'Widget'.
_ListOfInputs 类是:
class _ListOfInputs extends StatelessWidget {
final FocusNode userNameNode;
const ListOfInputs(
this.userNameNode,
);
}
【问题讨论】: