flutter_country_extensions 1.0.3 copy "flutter_country_extensions: ^1.0.3" to clipboard
flutter_country_extensions: ^1.0.3 copied to clipboard

A comprehensive Flutter toolkit featuring country & city pickers, custom UI widgets, responsive utilities, and daily developer extensions.

flutter_country_extensions #

A modern, comprehensive Flutter toolkit providing country & city pickers, custom UI dropdowns, responsive utilities, and daily developer extensions to boost productivity.

pub package license

πŸ‘¨β€πŸ’» Developed with ❀️ by Muhammad Sufyan
πŸ“§ muhammadsufyan60738@gmail.com | πŸ’¬ WhatsApp: +92 308 0060738 | πŸ™ GitHub: @Sufyan60738


✨ Features #

  • 🌍 All World Countries: Complete database of countries with flags, dial codes, and full city lists.
  • πŸ“ Smart Pickers:
    • CountryDropdown β€” Standalone searchable country dropdown.
    • CityDropdown β€” Dynamic city dropdown auto-linked to selected country.
    • CountryPhoneField β€” Phone input with integrated flag & dial code picker.
    • CountryCityPhonePicker β€” All-in-one composite form picker.
  • ⚑ Daily Developer Extensions:
    • Widget: .p(), .px(), .py(), .center(), .expanded(), .onTap(), .card(), .cornerRadius().
    • Context: context.width, context.isMobile, context.push(), context.showSuccessSnackBar(), context.hideKeyboard().
    • String: 'test@email.com'.isValidEmail, 'flutter_dev'.toTitleCase, '0300-1234567'.cleanPhoneNumber.
    • Num: 16.h, 10.w, 2.seconds, 500.ms, .delay().

πŸ“Έ Screenshots #

Country Picker City Picker Phone Picker
Country Picker City Picker Phone Picker

πŸ“¦ Installation #

Add this to your pubspec.yaml:

dependencies:
  flutter_country_extensions: ^1.0.3

Then run:

flutter pub get

πŸš€ Quick Start #

1. Import the package #

import 'package:flutter_country_extensions/flutter_country_extensions.dart';

2. Country & City Dropdowns #

// Standalone Country Dropdown
CountryDropdown(
  selectedCountry: selectedCountry,
  onChanged: (country) {
    setState(() => selectedCountry = country);
  },
)

// Dynamic City Dropdown (Linked to Country)
CityDropdown(
  country: selectedCountry,
  selectedCity: selectedCity,
  onChanged: (city) {
    setState(() => selectedCity = city);
  },
)

// Phone Field with Country Flag
CountryPhoneField(
  selectedCountry: selectedCountry,
  onPhoneChanged: (fullPhone, rawNumber, dialCode) {
    print('Full: $fullPhone, Number: $rawNumber');
  },
)

// All-in-one Master Picker
CountryCityPhonePicker(
  showCountry: true,
  showCity: true,
  showPhone: true,
  onChanged: (country, city, phone) {
    print('Selected: ${country?.name}, $city, $phone');
  },
)

3. Daily Developer Extensions #

Spacing & Layout

// Vertical and Horizontal Spacing
16.h // SizedBox(height: 16)
10.w // SizedBox(width: 10)

// Chainable Widget Modifiers
Text('Save')
  .p(12)
  .center()
  .onTap(() => print('Tapped!'))
  .card(radius: 12)

Screen Dimensions & Navigation

if (context.isMobile) {
  // Mobile layout
}

print(context.width); // Screen width
context.push(const ProfileScreen());
context.pop();
context.showSuccessSnackBar('Saved successfully!');
context.hideKeyboard();

String Validations & Helpers

'dev@gmail.com'.isValidEmail;       // true
'flutter_dev'.toTitleCase;           // 'Flutter Dev'
'flutter'.capitalizeFirst;          // 'Flutter'
'0300-1234567'.cleanPhoneNumber;    // '03001234567'

// Country & City String Helpers
'PK'.toCountry();                   // Country(name: 'Pakistan', ...)
'PK'.countryFlag;                   // 'πŸ‡΅πŸ‡°'
'PK'.countryDialCode;               // '+92'
'PK'.countryCities;                 // ['Karachi', 'Lahore', ...]
'Lahore'.countryOfCity;             // Country(name: 'Pakistan', ...)
'Karachi'.isCityOf('PK');           // true
CountryData.searchCities('lah');    // ['Lahore', 'Lahore Cantonment', ...]

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

5
likes
160
points
200
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A comprehensive Flutter toolkit featuring country & city pickers, custom UI widgets, responsive utilities, and daily developer extensions.

Homepage

Topics

#country #city #dropdown #extensions #widget

License

MIT (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on flutter_country_extensions