TextField

作者: neobuger | 来源:发表于2023-01-29 17:25 被阅读0次
TextField(

controller: TextEditingController.fromValue(TextEditingValue(
                  text: '${this.widget.data!["value"]}',  //判断keyword是否为空
                  // 保持光标在最后

                  selection: TextSelection.fromPosition(TextPosition(
                      affinity: TextAffinity.downstream,
                      offset: '${this.widget.data!["value"]}'.length)))),
              cursorHeight: 15,
              // textAlignVertical: TextAlignVertical.center,
              // textAlign: TextAlign.justify,
              onChanged: (text) {
                print("输入改变时" + text);

              },

              maxLines: 1,
              style: TextStyle(
                color: Color(0xff333333),

              ),
              // maxLength: 200,
              decoration: InputDecoration(
                hintText: "请输入",
                hintMaxLines: 1,
                hintStyle: TextStyle(
                  color: Color(0xff999999),

                ),
                isCollapsed: true,
                enabledBorder: new UnderlineInputBorder( // 不是焦点的时候颜色
                  borderSide: BorderSide(
                      color: Color(0x00000000)
                  ),
                ),
                focusedBorder: new UnderlineInputBorder( // 焦点集中的时候颜色
                  borderSide: BorderSide(
                      color: Color(0x00000000)
                  ),
                ),
              ),
            )
isCollapsed: true, 这个当textfield设置高度后 引起的问题有很好的效果

相关文章

网友评论

      本文标题:TextField

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