1

I am working with a TextField in Flutter and I need to change the starting position of the text cursor. The reason for this is that currently the cursor is too close to the border outline. image of textfield

I tried adding an initial text to the textfield controller which looks like this " ". The problem with the previous solution is that in password fields (where text is obscured) the initial text, even though it's just spaces, obviously appears as written text. Another solution which I thought of but didn't try is creating a Stack widget where I position an image with a border outline and on top of it a text field without outline. Any help would be useful.

1 Answers1

0

A better way to solve this issue would be to use Padding with EdgeInsets.only(left: 10.0), or any other value.

But to answer your question, take a look at this answer, by using a text controller and TextSelection.fromPosition().

Yam Horesh
  • 67
  • 1
  • 2
  • 5