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

enter image description here


Solution 1: Navid Hosseini

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) {  },
             );