zoukankan      html  css  js  c++  java
  • Flutter TextField设置默认值默认值和光标位置

    主要通过controller 实现,具体代码如下

    TextField(
              //输入键盘类型 keyboardType: TextInputType.text, autofocus: true, decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(
    30), borderSide: BorderSide.none), ), onChanged: (value) { this._keyword = value; }, controller: TextEditingController.fromValue(TextEditingValue( text: '${this._keyword == null ? "" : this._keyword}', //判断keyword是否为空 // 保持光标在最后 selection: TextSelection.fromPosition(TextPosition( affinity: TextAffinity.downstream, offset: '${this._keyword}'.length)))), ),
  • 相关阅读:
    iOS开发-Sqlite
    iOS开发-HTTP协议
    iOS开发
    iOS 开发小记 (八)
    iOS
    iOS开发-基础框架
    Java门面模式
    Linux常用命令
    canal使用小结
    MySQL隔离级别的测试
  • 原文地址:https://www.cnblogs.com/yjpjy/p/11504522.html
Copyright © 2011-2022 走看看