Flutter:如果没有数据,TextFormField 焦点
我有一个 TextFormField
如下
TextFormField(
readOnly: true,
validator: (v) => (v.isEmpty) ? "Required" : null,
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: sportCenterEditingController,
decoration: ...,
onTap: () async {
var t = showModalAndReturnData();
if (t != null)
sportCenterEditingController.text = sportCenters[i].name;
}),
,即使当 t == null
时它也会进入焦点模式
如何避免这种情况?如果没有数据,我希望它保持不集中
I have a TextFormField
as follows
TextFormField(
readOnly: true,
validator: (v) => (v.isEmpty) ? "Required" : null,
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: sportCenterEditingController,
decoration: ...,
onTap: () async {
var t = showModalAndReturnData();
if (t != null)
sportCenterEditingController.text = sportCenters[i].name;
}),
and even when t == null
it goes to focus mode
how can I avoid that? If no data, I would like that it keeps to be unfocused
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用此代码
Use this code