TextField(
style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(39)),
controller: TextEditingController.fromValue(TextEditingValue(
// 设置内容
text: _inputText,
// 保持光标在最后
selection: TextSelection.fromPosition(TextPosition(
affinity: TextAffinity.downstream,
offset: _inputText.length)))),
onChanged: (value) {
_inputText = value;
},
enableInteractiveSelection: false,//禁用长按复制 剪切
autocorrect: false,
maxLength: 80,
decoration: InputDecoration(
hintText: "Notes", border: InputBorder.none),//无下划线
)
(移动光标和form表单非Null检查)
https://book.flutterchina.club/chapter3/input_and_form.html
网友评论