flutter_country_code_picker 0.1.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

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

<img src=https://user-images.githubusercontent.com/99036793/204272434-db5bab2d-b782-4828-bbf0-e0e06d0959ff.gif width=40%>

images

<img src=https://user-images.githubusercontent.com/99036793/204272531-f525a6cb-3183-4624-bc97-07e75bdb24ee.jpg width=40% height=40%>

<img src=https://user-images.githubusercontent.com/99036793/204272538-79a97f6a-8c89-4273-a713-52f5040736ed.jpg width=40% height=40%>

<img src=https://user-images.githubusercontent.com/99036793/204272542-72f0c9f0-6742-4547-87c0-c86b580c9cb1.jpg width=40% height=40%>

<img src=https://user-images.githubusercontent.com/99036793/204272546-936955ac-bbba-410a-a61a-f3a9cedfe998.jpg width=40% height=40%>

Flutter pub add

add the package with flutter pub add flutter_contry_code_picker