在 flutter 中我有一个文本字段。现在假设用户类型
2+2+2+2+2+2+2+2+2
现在他点击左边第二个“2”并继续输入“3”,文本变大并向右移动,在某些时候我的光标隐藏到右侧。
如果您在计算器应用程序中看到文本向右增长,但光标出现并停在最右端,现在您输入的任何值文本都会向左增长。
有什么办法可以解决这个问题吗..
谢谢
试试这个!
TextField(
controller: _textController,
textAlign: TextAlign.right,
decoration: InputDecoration(
border: OutlineInputBorder(),
),
onChanged: (text) {
_textController.selection = TextSelection.fromPosition(
TextPosition(offset: _textController.text.length)
);
},
)