Flutter开发圈

Flutter textField常用配置

2019-09-25  本文已影响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

上一篇 下一篇

猜你喜欢

热点阅读