【发布时间】:2021-07-13 10:20:16
【问题描述】:
我的应用中有一个简单的TextField 小部件。我注意到蓝色光标始终位于末尾,以便我可以在那里输入更多文本。但是,当我在输入的开头或中间的任何地方点击以更改光标焦点位置时,它不会去那里。它总是在那里,我必须删除所有输入才能回到那里。
我已经搜索了如何实现这一点,但我发现最接近的是这个我不明白的小例子。
https://www.codegrepper.com/code-examples/whatever/flutter+texteditingcontroller+cursor+position
以下是我的小部件。
TextField(
controller: _descriptionTextController,
enableInteractiveSelection: false,
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: InputDecoration(
fillColor: Colors.transparent,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: 'Product description',
),
style: TextFieldStyle,
),
谁能帮帮我。
【问题讨论】:
-
去掉或改成
true这个参数enableInteractiveSelection: false
标签: flutter