flutter_country_code_picker 0.1.2 copy "flutter_country_code_picker: ^0.1.2" to clipboard
flutter_country_code_picker: ^0.1.2 copied to clipboard

You can easily create phone code field.

Flutter Country Code Picker #

A flutter package to select a country from a list of countries.

It works on Android, iOS, macOS, linux, windows and web

Getting Started #

Add the package to your pubspec.yaml:

flutter pub add flutter_contry_code_picker

in your dart file, import the library

import 'package:flutter_country_code_picker/flutter_country_code_picker.dart';

Show country code picker using IntlPhoneField :

example #

The country code widget load the country code with flags

import 'package:flutter/material.dart';
import 'package:flutter_country_code_picker/flutter_country_code_picker.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    var number = "";
    return MaterialApp(
      home: Scaffold(
        body: Column(
          children: [
            // Picker name
            Text("Flutter Country Code Picker"),

            //Picker Widget
            IntlPhoneField(
                maxLength: 10,
                controller: controller,
                initialCountryCode: "IN",
                validator: (data) {
                  return null;
                },
                onChanged: (data) {
                  number = data;
                  print("number is $data");
                }
            )

            //Entered Data
            Text("Entered Number is $number")

          ],
        ),
      ),
    );
  }
}

example ScreenShots #

This example shows how to take full control over the picker by providing your own build`.

gif #

images #

Flutter pub add #

add the package with flutter pub add flutter_contry_code_picker