skip to Main Content

I have a TextField with TextAlign.right. If i write some text in it and press the space bar multiple times the spaces are not displayed, until i enter another "visible" character.

How to display the spaces without entering a "visible" character after?

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found a solution to this problem. Hope it helps others. If the space get´s replaced with u00A0 it works like intended.

    onChanged: (value) {
                  String newText = value.replaceAll(' ', 'u00A0');
                  widget.textEditingController.value = widget.textEditingController.value.copyWith(
                    text: newText,
                  );
                }
    

  2. Just set the text direction to right-to-left:

    textAlign: TextAlign.right,
    textDirection: TextDirection.rtl, 
    

    And it will work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search