natintosh / intl_phone_number_input

MIT License
163 stars 490 forks source link

Refactoring of input_widget and validator, added ability to include padding below selector button #421

Open rfowler5 opened 6 months ago

rfowler5 commented 6 months ago

I cleaned up the logic dealing with validation of input_widget, addressing the following: https://github.com/natintosh/intl_phone_number_input/issues/385

As part of cleaning up the logic, I fixed the return type of the phone number utils validator (isValidNumber). The native code returns a boolean, so it should never be null anyway.

I added the ability to add padding below the country selector. This allows a consumer to fix an issue where the flag--when not used as a prefix icon--would jump up when a phone number validation error message displayed and caused the TextField to grow in height. The flag would jump up because more padding is added when the input_widget is in the error state. The consumer can now add padding and follow the work-around listed here (https://github.com/flutter/flutter/issues/15400#issuecomment-475773473) to keep both the flag and the phone input field fixed when error messages are displayed.

Some updates to the gradle version in the example also.