There is a bug in Flutter while using RTL (Right To Left) TextField. If we click on (A), the cursor will stop at B, one before the end of the text, and we can't edit the last character! I created this issue and I hope Flutter people see it and fix it
Asked
Active
Viewed 534 times
2
-
can you provide a link to your posted issue? – Ahmad Hamwi Jun 23 '22 at 08:02
1 Answers
5
I solve this bug ..
in your TextField you should use controller and onTab function write
if (textController.selection ==
TextSelection.fromPosition(TextPosition(
offset:
textController.text.length -
1))) {
textController.selection =
TextSelection.fromPosition(TextPosition(
offset: textController.text.length));
}
full example like
TextField(
textAlign: TextAlign.right,
textDirection: TextDirection.rtl,
controller:textController,
maxLength: 10,
onTap: () {
if (textController.selection ==
TextSelection.fromPosition(TextPosition(
offset:
textController.text.length -
1))) {
textController.selection =
TextSelection.fromPosition(TextPosition(
offset:textController.text.length));
}
},
onChanged: (text) { },
);

Navid Hosseini
- 124
- 8