TinoGuo / pin_input_text_field

A textField widget to help display different style pin
Apache License 2.0
374 stars 81 forks source link

Use "maxLength" TextField property instead of formatter to prevent TextEditingValue.selection issue #49

Closed monisnap-julien closed 3 years ago

monisnap-julien commented 3 years ago

Hello,

I've noticed that when I enter more characters than the maxLength, the selection is still increased (so the cursor is virtually moved from one character). It leads to the fact that I need to delete 'invisible characters" to finally delete the pin I entered.

The behaviour is because you use LengthLimitingTextInputFormatter, is described here in the introduction section : https://api.flutter.dev/flutter/services/LengthLimitingTextInputFormatter-class.html

Could you use maxLength TextField widget property to prevent this issue ?

TinoGuo commented 3 years ago

This issue is due to enableInteractiveSelection = true, the cursor would move to the start of the line. btw, I used the maxLength inside actually. the fix would requires to ensure the cursor is always at last but not working in iOS.