gpt4 book ai didi

dart - “缺少焦点范围。”使用输入文本

转载 作者:IT王子 更新时间:2023-10-29 06:46:26 24 4
gpt4 key购买 nike

我尝试使用 Flutter 构建一个表单,我有自己的 StatefulWidget,它返回一个带有 2 个输入的表单(我也尝试使用 TextField)和一个 DropdownButton。

当我执行第二个输入时显示此错误:“缺少焦点范围”。

代码:

import 'package:flutter/material.dart';

class ContactFormView extends StatefulWidget {

@override
CreateFormViewState createState() => new CreateFormViewState();

}

class CreateFormViewState extends State<ContactFormView> {

GlobalKey<FormState> _formKey = new GlobalKey<FormState>();

@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Form(
key: _formKey,
child: new Column(
children: <Widget>[
new Input(
labelText: 'First Name',
onChanged: (InputValue value) {
// Logic here
}
),
new Input(
labelText: 'Last Name',
onChanged: (InputValue value) {
// Logic here
}
),
new RaisedButton(
child: new Text('SUBMIT'),
onPressed: () {
// Logic here
},
)
]
)
)
);
}

}

最佳答案

最后,问题在下一次更新中得到解决。现在,您可以毫无问题地使用此小部件。 https://docs.flutter.io/flutter/widgets/Form-class.html

关于dart - “缺少焦点范围。”使用输入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42753246/

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