farouk osama
farouk osama

Reputation: 2529

Flutter : Why can't I move the cursor in the TextField to the beginning of the text?

I have a TextField widget. After filling it out, I Have Tried to move the cursor to the beginning of the text, but I could not do that.

The cursor stops after the first letter, not before.

Is the reason that the text is in Arabic which is right to left writing language?

Is there any solution to this problem?

Upvotes: 4

Views: 1037

Answers (2)

Mithson
Mithson

Reputation: 1782

Try adding Directionality class in your code like this

new Directionality(
    textDirection: TextDirection.rtl,
    child: TextField(
     textAlign: TextAlign.right,
     controller: _textEdittingControler_bookName,
     autofocus: true,
     decoration: new InputDecoration(
                labelText: "افزودن کتاب",
                hintText: "نام کتاب را وارد کنید"
                ),
     )

Refer documentation for more info about directionality class

Upvotes: 1

jeremynac
jeremynac

Reputation: 1242

Have you tried maybe setting TextField(textDirection: TextDirection.rtl) ? It might solve your problem as it's supposed to be used when you write text right to left.

Upvotes: 3

Related Questions