flutter_country_extensions 1.0.3
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.
π¨βπ» 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().
- Widget:
πΈ Screenshots #
| 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.



