Country Code Picker in Flutter

You are currently viewing Country Code Picker in Flutter
Country Code TextFormField

A Customised Flutter TextFormField to Input International Phone Number along with Country Code Picker in Flutter

A customised Flutter TextFormField to input international phone number along with country code.
This country code picker in flutter widget can be used to make a customized text field to take phone number input for any country along with an option to choose country code from a dropdown.

See also  Dropdown FormField in Flutter

Screenshots

Country Code TextFormField
Country Code TextFormField

Installing

To use this package:

Run this command:

flutter pub add intl_phone_field

Or, add the following to your pubspec.yaml file:

dependencies:
  intl_phone_field: ^2.1.0

How to Use

Simply create a IntlPhoneField widget, and pass the required params:z

IntlPhoneField(
    decoration: InputDecoration(
        labelText: 'Phone Number',
        border: OutlineInputBorder(
            borderSide: BorderSide(),
        ),
    ),
    initialCountryCode: 'IN',
    onChanged: (phone) {
        print(phone.completeNumber);
    },
)

Use initialCountryCode to set an initial Country Code.

See also  Flutter Getx State Management - Supabase Simple CRUD Demo

Read Also Pincode Input TextFields

Credit

This project is developed by vanshg395
Download this project from the below link.
https://github.com/vanshg395/intl_phone_field/archive/refs/heads/master.zip
You can visit original source page from the below link:
https://github.com/vanshg395/intl_phone_field

Spread the love

Leave a Reply