Skip to content

kulture-rob-snider/intl-phone-number-input

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intl Phone Number Input

A single and customizable flutter package for international phone number input

What's new

* Added focus node
* Custom list of countries e.g. ['NG', 'GH', 'BJ' 'TG', 'CI']
* Country Flag and Logo now formatted

Usage

Constructors

s/n Constructor
1 InternationalPhoneNumberInput
2 InternationalPhoneNumberInput.withCustomDecoration
3 InternationalPhoneNumberInput.withCustomBorder

Available Parameters

InternationalPhoneNumberInput({
@required onInputChange,
      onInputValidated,
      focusNode,
      countries,
      inputBorder,
      inputDecoration,
      initialCountry2LetterCode = 'NG',
      hintText = '(800) 000-0001 23',
      shouldParse = true,
      shouldValidate = true,
      formatInput = true,
      errorMessage = 'Invalid phone number'});
Parameter Datatype Initial Value Default [1] Decoration [2] CustomBorder [3]
onInputChange function(string) null ✔️ ✔️ ✔️
onInputValidated function(string) null ✔️ ✔️ ✔️
focusNode FocusNode null ✔️ ✔️ ✔️
countries List null ✔️ ✔️ ✔️
inputBorder InputBorder null ✔️ ✔️
inputDecoration InputDecoration null ✔️ ✔️
initialCountry2LetterCode String NG ✔️ ✔️ ✔️
hintText String (800) 000-0001 23 ✔️ ✔️
shouldParse boolean true ✔️ ✔️ ✔️
shouldValidate boolean true ✔️ ✔️ ✔️
formatInput boolean true ✔️ ✔️ ✔️
errorMessage String Invalid phone number ✔️ ✔️

Examples

InternationalPhoneNumberInput(
 onInputChanged: onPhoneNumberChanged,
);

Media 1|100x200,20%

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

Media 2

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

Media 3

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

Media 4

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

Media 4

InternationalPhoneNumberInput.withCustomDecoration(
  onInputChanged: 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 100.0%