TinoGuo/pin_input_text_field

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

Closed this issue · 1 comments

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 ?

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.