gpt4 book ai didi

android - 在 flutter 中禁用粘贴并从 textformfield 中选择所有功能按钮

转载 作者:IT王子 更新时间:2023-10-29 07:12:25 28 4
gpt4 key购买 nike

我想在 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;
},
),

最佳答案

您可以使用 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;
},
),

关于android - 在 flutter 中禁用粘贴并从 textformfield 中选择所有功能按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54860910/

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