country_calling_code_kit 1.0.2 copy "country_calling_code_kit: ^1.0.2" to clipboard
country_calling_code_kit: ^1.0.2 copied to clipboard

A sleek Flutter package for picking country codes with flags, names, and dial codes. Customizable UI, platform-ready, and user-friendly.

Country Calling Code Kit #

📞 Country Code Picker – With Style! #

Tired of boring dropdowns and confusing country pickers? Say hello to your new favorite Flutter package, the ultimate toolkit for selecting country calling codes with flair! 🌍✨

💡 Features You'll Love #

  • Tap & Pick – Whether it’s a slick bottom sheet or a classic dialog, users can choose countries faster than you can say “international roaming.”
  • Smart by Default – Automatically detects the default country based on your device settings. Less thinking, more doing.
  • Flag it Up – Beautifully displays country flags, names, and dialing codes in a clean and classy UI.
  • Platform Party – Android, iOS, Web, macOS, Linux, Windows – this package supports them all.
  • Make it Yours – Fully customizable UI components to match your app’s vibe.

From Argentina 🇦🇷 to Zimbabwe 🇿🇼, your users can connect globally with a single tap. It’s fast, intuitive, and actually fun to use.

Show some ❤️ and ⭐️ the Repo #

Resources:

Usage #

Import the package #

import 'package:country_calling_code_kit/country_calling_code_kit.dart';

Get the default country (based on device settings) #

void main() async {
  Country? country = await getDefaultCountry();
}

Show country picker dialog #

void main() async {
  Country? selectedCountry = await showCountryPickerDialog(context: context);
  if (selectedCountry != null) {
    // Use the selected country
    print('Selected country: ${selectedCountry.name}');
    print('Country code: ${selectedCountry.countryCode}');
    print('Calling code: ${selectedCountry.callCode}');
  }
}

Show a country picker bottom sheet #


void main() async {
  Country? selectedCountry = await showCountryPickerModalSheet(context: context);
  if (selectedCountry != null) {
    // Use the selected country
    print('Selected country: ${selectedCountry.name}');
    print('Country code: ${selectedCountry.countryCode}');
    print('Calling code: ${selectedCountry.callCode}');
  }
}

Example #

See the /example folder for a complete example app.

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

class CountryPickerDemo extends StatefulWidget {
  @override
  _CountryPickerDemoState createState() => _CountryPickerDemoState();
}

class _CountryPickerDemoState extends State<CountryPickerDemo> {
  Country? country;

  @override
  void initState() {
    super.initState();
    initCountry();
  }

  void initCountry() async {
    country = await getDefaultCountry() ?? countries.first;
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Country Picker Demo')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            if (country != null) ...[
              Image.asset(
                country!.flag,
                width: 100,
                height: 60,
              ),
              SizedBox(height: 16),
              Text('Name: ${country!.name}'),
              Text('Code: ${country!.countryCode.toString().toUpperCase()}'),
              Text('Call Code: ${country!.callCode}'),
              SizedBox(height: 24),
            ],
            ElevatedButton(
              onPressed: () async {
                final selectedCountry = await showCountryPickerDialog(context: context);
                if (selectedCountry != null) {
                  setState(() {
                    country = selectedCountry;
                  });
                }
              },
              child: Text('Select Country'),
            ),
          ],
        ),
      ),
    );
  }
}

Credits #

This package is inspired by and gives credit to country_calling_code_picker.

Contributions #

1
likes
160
points
43
downloads

Publisher

verified publisheryashashm.dev

Weekly Downloads

A sleek Flutter package for picking country codes with flags, names, and dial codes. Customizable UI, platform-ready, and user-friendly.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

device_region, flutter

More

Packages that depend on country_calling_code_kit