intl_phone_number_input 0.0.10

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 [1]Decoration [2]CustomBorder [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

[0.0.10]

  • Minor changes to the source file

[0.0.9]

  • Critical bug fixed caused by changing source files and packages

[0.0.8]

  • Minor changes to the source file
  • Added example
  • Updated README.md
  • Added examples to README.md

[0.0.7]

  • Critical bug fixed
  • Updated README.md

[0.0.6]

  • Updated README.md
  • Fixed issues with text input not validating
  • Fixed issues with text input not parsing

[0.0.5]

  • Critical bug fixed
  • Removed example
  • Fixed countries.json assets not loading

[0.0.4]

  • Critical bug fixed
  • Fixed image assets not loading

[0.0.3]

  • Critical bug fixed
  • Added examples
  • Fixed image assets not loading

[0.0.2]

  • Critical bug fixed
  • Updated README.md

[0.0.1]

Initial project release #
  • Updated README.md
  • Added support for custom input decoration
  • Added support for custom input border

example/README.md

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 [1]Decoration [2]CustomBorder [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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  intl_phone_number_input: ^0.0.10

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:intl_phone_number_input/intl_phone_number_input.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
libphonenumber ^1.0.0 1.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test