Open jimmyff opened 3 years ago
Also with a country like Bulgaria, where numbers can be 7 or 8 digits, as you're enter your 7th digit it moves your position back to the start, making it easy to accidentally enter the 8 digit at the start
this is also the case when using autoValidateMode: AutovalidateMode.disabled
Hello Everyone Is there any updates on this issue? I am facing it too when passing initial value to the InternationalPhoneNumberInput widget
The same issue appears to occur in web. Using release 0.7.0+2 and Flutter version 2.5.3
any update on this?
While this might be unintended, I think it is actually beneficial to retain this behaviour because the cursors moves to the front and the user is unable to add more digits by mistake.
The downside of this is if they want to change it they must tap on the end to get the cursor position to the final digit.
Is there any updates on this issue?
Hey, any news ? I am facing the same issue with italian numbers that should be able to go up to 12 digits but the cursor gets resetted to its start position after a maximum of 11. It's really inconvenient for our users
Same problem with Finnish phone numbers
Hey,
I have solved this problem by adding the line below in the project file (widgets/input_widget.dart)
Just add
controller!.selection = TextSelection.collapsed(offset: phoneNumber.length);
under
controller!.text = widget.formatInput
? phoneNumber
: phoneNumber.replaceAll(RegExp(r'[^\d+]'), '');
Hey,
I have solved this problem by adding the line below in the project file (widgets/input_widget.dart)
Just add
controller!.selection = TextSelection.collapsed(offset: phoneNumber.length);
under
controller!.text = widget.formatInput ? phoneNumber : phoneNumber.replaceAll(RegExp(r'[^\d+]'), '');
This works. Thank you
In onInputChanged
method, add the following line
numCont.selection = TextSelection.collapsed(offset: numCont.text.length);
and numCont
is your own TextEditingController
.
Here is the full code:
onInputChanged: (PhoneNumber number) {
numCont.selection = TextSelection.collapsed(offset: numCont.text.length);
},
Hey,
I have solved this problem by adding the line below in the project file (widgets/input_widget.dart)
Just add
controller!.selection = TextSelection.collapsed(offset: phoneNumber.length);
under
controller!.text = widget.formatInput ? phoneNumber : phoneNumber.replaceAll(RegExp(r'[^\d+]'), '');
After the recent flutter upgrade to v3.10.0 and after, the cursor starts to misbehave by going back to the beginning like it used to. Anyone have any idea why the recent flutter upgrade is making that happen?
As soon as the number successfully validates the cursor jumps to the start of the text input. This makes it hard for someone to amend a possible mistake as well as being a little disorientating.