美文网首页Flutter开发圈
Flutter textField常用配置

Flutter textField常用配置

作者: 郑永博 | 来源:发表于2019-09-25 10:01 被阅读0次
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

相关文章

网友评论

    本文标题:Flutter textField常用配置

    本文链接:https://www.haomeiwen.com/subject/xbfbyctx.html