Leverages libphonenumber to allow for asynchronous and synchronous formatting of phone numbers in Flutter apps. Includes a TextInputFormatter to allow real-time AsYouType formatting.
This will work fine for the first number. If I then change it from GB -> US -> GB using the country drop down if I type in a number you will only be able to type in half. I.e the formatter allows only "0 000000".
If I change inputContainsCountryCode to true. Then the default GB requires you to enter the country code in the second box and the country GB doesn't.
The issue seem to stem from the fact that phoneMaskMobileNational is different between the two responses. This means that the LibPhonenumberTextFormatter can't work in a consistent way between the two options.
On a flutter iOS app I'm running into issues after someone changes from the default option (UK) and then back to it, the uk mask is inconsistent.
I have two text boxes with the following [+44] [rest of number]. And the following formatter:
This will work fine for the first number. If I then change it from GB -> US -> GB using the country drop down if I type in a number you will only be able to type in half. I.e the formatter allows only "0 000000".
If I change
inputContainsCountryCode
to true. Then the default GB requires you to enter the country code in the second box and the country GB doesn't.The issue seem to stem from the fact that
phoneMaskMobileNational
is different between the two responses. This means that theLibPhonenumberTextFormatter
can't work in a consistent way between the two options.LibPhonenumberTextFormatter( phoneNumberType: PhoneNumberType.mobile, phoneNumberFormat: PhoneNumberFormat.national, country: _currentlySelectedCountry, inputContainsCountryCode: true,
CountryWithPhoneCode.gb()
gives the following:From the countries list I get this: