Far*_*ana 9 android dart flutter
我想禁用所有与复制、粘贴和全选相关的功能textformfield。我有一个密码字段,它可以接受键盘提示并默认粘贴数据,但是当我执行诸如调用登录服务之类的操作时,密码字段出错了。
TextFormField(
obscureText: true,
style: styleText,
textInputAction: TextInputAction.done,
controller: _passwordController,
focusNode: _passwordFocus,
onFieldSubmitted: (term){
_passwordFocus.unfocus();
},
keyboardType: TextInputType.text,
validator: validatePassword,
decoration: InputDecoration(
focusedBorder: border,
border: border,
enabledBorder: border,
hintStyle: styleText,
hintText: 'Password'),
onSaved: (String val) {
_password = val;
},
),
Run Code Online (Sandbox Code Playgroud)
Neh*_*waj 31
您可以使用enableinteractiveSelection : false禁用复制/粘贴。
TextFormField(
enableInteractiveSelection: false,
obscureText: true,
style: styleText,
textInputAction: TextInputAction.done,
controller: _passwordController,
focusNode: _passwordFocus,
onFieldSubmitted: (term){
_passwordFocus.unfocus();
},
keyboardType: TextInputType.text,
validator: validatePassword,
decoration: InputDecoration(
focusedBorder: border,
border: border,
enabledBorder: border,
hintStyle: styleText,
hintText: 'Password'),
onSaved: (String val) {
_password = val;
},
),
Run Code Online (Sandbox Code Playgroud)
Muh*_*fay 14
您可以尝试一下这disable any particular option并不是所有的选项。
TextFormField(
toolbarOptions: ToolbarOptions(
copy: true,
cut: true,
paste: false,
selectAll: false,
),
...
..
.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5854 次 |
| 最近记录: |