[当我键入“。”或“ @”之类的字符时,如何在TextFormField中删除电子邮件的自动完成功能?

问题描述 投票:0回答:1

我使用TextFormField小部件创建了输入字段。当我键入之前已经使用过的电子邮件时,该字段只需输入电子邮件以及键入的部分。当我键入“。”这样的字符时,会发生这种情况。要么 ”@”。例如:考虑一封电子邮件:“ [email protected]”。当我键入“ abcd”时。该字段再次将电子邮件添加为“ abcd.abcd.efgh @”。

child: Container(
                  padding: const EdgeInsets.only(left: 10, right: 10),
                  alignment: Alignment.center,
                  height: SizeConfig.blockSizeHorizontal * 11.5,
                  // height: 45.0,
                  decoration: new BoxDecoration(
                      color: Colors.grey[50].withOpacity(0.9),
                      border: new Border.all(color: Colors.grey[100]),
                      borderRadius: new BorderRadius.circular(5.0)),
                  child: TextFormField(
                    controller: emailController,
                    keyboardType: TextInputType.emailAddress,
                    autofocus: false,
                    autovalidate: false,
                    style: TextStyle(fontSize: 18),
                    decoration: InputDecoration(
                      border: InputBorder.none,
                      hintText: 'Email',
                      hintStyle: TextStyle(fontSize: 18),
                    ),
                  ),
                ),

flutter dart
1个回答
0
投票

尝试将TextFormField的autocorrect和/或enableSuggestions属性设置为false。这两个选项均默认启用。

© www.soinside.com 2019 - 2024. All rights reserved.