Fla*_*eil 1 textfield dart flutter
我尝试创建一个 TextField 来keyboardType: TextInputType.visiblePassword禁用预测文本,但我无法转到新行,因为它是一个提交按钮。我尝试添加textInputAction: TextInputAction.newline但也不起作用。
我的文本字段:
TextField(
focusNode: myFocusNode,
autocorrect: false,
enableSuggestions: false,
toolbarOptions: ToolbarOptions(copy: false, cut: false, paste: false),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.newline,
autofocus: true,
maxLines: null,
controller: textEditor,
decoration: InputDecoration(fillColor: Colors.grey[100])
))));
Run Code Online (Sandbox Code Playgroud)
您只需添加以下参数即可禁用预测文本。
enableSuggestions: false,
autocorrect: false,
Run Code Online (Sandbox Code Playgroud)
但要启用多行,您需要将“keyboardType”更改为“TextInputType.multiline”。
TextField(
autocorrect: false,
enableSuggestions: false,
toolbarOptions: ToolbarOptions(copy: false, cut: false, paste: false),
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
autofocus: true,
maxLines: null,
decoration: InputDecoration(fillColor: Colors.grey[100]))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4699 次 |
| 最近记录: |