Intl Phone Number Input

A single and customizable flutter package for internation phone number input

Usage

Constructors

s/nConstructor
1InternationalPhoneNumberInput
2InternationalPhoneNumberInput.withCustomDecoration
3InternationalPhoneNumberInput.withCustomBorder

Available Parameters

InternationalPhoneNumberInput({
@required onInputChange,
      onInputValidated,
      inputBorder,
      inputDecoration,
      initialCountry2LetterCode = 'NG',
      hintText = '(800) 000-0001 23',
      shouldParse = true,
      shouldValidate = true,
      formatInput = true,
      errorMessage = 'Invalid phone number'});
ParameterDatatypeInitial ValueDefault 1Decoration 2CustomBorder 3
onInputChangefunction(string)null✔️✔️✔️
onInputValidatedfunction(string)null✔️✔️✔️
inputBorderInputBordernull✔️✔️
inputDecorationInputDecorationnull✔️✔️
initialCountry2LetterCodeStringNG✔️✔️✔️
hintTextString(800) 000-0001 23✔️✔️
shouldParsebooleantrue✔️✔️✔️
shouldValidatebooleantrue✔️✔️✔️
formatInputbooleantrue✔️✔️✔️
errorMessageStringInvalid phone number✔️✔️

Examples

InternationalPhoneNumberInput(
 onInputChange: onPhoneNumberChanged,
);

Media 1|100x200,20%

InternationalPhoneNumberInput(
  onInputChange: onPhoneNumberChanged,
  shouldParse: false,
  );

Media 2

InternationalPhoneNumberInput(
  onInputChange: onPhoneNumberChanged,
  shouldParse: true,
  shouldValidate: true,
  initialCountry2LetterCode: 'US',
  hintText: 'Insert phone number',
  );

Media 3

InternationalPhoneNumberInput.withCustomBorder(
  onInputChange: onPhoneNumberChanged,
  inputBorder: OutlineInputBorder(),
  hintText: '(100) 123-4567 8901',
  initialCountry2LetterCode: 'US',
  errorMessage: 'Wrong number',
);

Media 4

InternationalPhoneNumberInput.withCustomDecoration(
  onInputChange: onPhoneNumberChanged,
  initialCountry2LetterCode: 'US',
  inputDecoration: InputDecoration(
    border: OutlineInputBorder(
    borderRadius: BorderRadius.all(
      Radius.circular(40),
      ),
    ),
  ),
);

Media 4

InternationalPhoneNumberInput.withCustomDecoration(
  onInputChange: onPhoneNumberChanged,
  onInputValidated: onInputChanged,
  initialCountry2LetterCode: 'US',
  inputDecoration: InputDecoration(
    hintText: 'Enter phone number',
    errorText: valid ? null : 'Invalid',
    border: OutlineInputBorder(
      borderRadius: BorderRadius.all(
        Radius.circular(40),
      ),
    ),
  ),
);

Media 6

Dependencies

Credits

A special thanks to niinyarko

Libraries

intl_phone_number_input