countrydialselector
A lightweight and customizable Flutter package for selecting country phone dial codes using a smooth wheel-style picker.
Built to be simple, flexible, and easy to integrate into any Flutter application.
β¨ Features
- π‘ Smooth wheel-style country dial code selector
- π Built-in list of common countries and dial codes
- π― Supports initial country selection
- π¨ Fully customizable colors (selected, unselected, border)
- π§© Strongly typed API using
CountryData - π¦ Lightweight and package-friendly
- π Supports custom country lists
πΈ Preview
Android
iOS
Images are rendered automatically on pub.dev when placed in the
assets/folder.
π Installation
Add this to your pubspec.yaml:
dependencies:
countrydialselector: ^0.0.1
Then run:
flutter pub get
π¦ Import
import 'package:countrydialselector/countrydialselector.dart';
π§βπ» Basic Usage
CountryPickerWheel(
initialCountry: const CountryData(
name: 'Nigeria',
dialCode: '+234',
),
selectedTextColor: Colors.green,
unselectedTextColor: Colors.grey,
borderColor: Colors.green,
onSelected: (country) {
debugPrint('${country.name} β ${country.dialCode}');
},
)
π¨ Customization
CountryPickerWheel(
selectedTextColor: Colors.blue,
unselectedTextColor: Colors.black45,
borderColor: Colors.blue,
height: 240,
itemExtent: 60,
onSelected: (country) {},
)
π Using a Custom Country List
CountryPickerWheel(
countries: const [
CountryData(name: 'Ghana', dialCode: '+233'),
CountryData(name: 'Kenya', dialCode: '+254'),
CountryData(name: 'Egypt', dialCode: '+20'),
],
onSelected: (country) {
print(country.dialCode);
},
)
π API Reference
CountryPickerWheel
| Property | Type | Description |
|---|---|---|
countries |
List<CountryData> |
List of countries to display |
initialCountry |
CountryData? |
Country selected initially |
onSelected |
ValueChanged<CountryData> |
Callback when selection changes |
selectedTextColor |
Color |
Color of selected item |
unselectedTextColor |
Color |
Color of unselected items |
borderColor |
Color |
Highlight border color |
height |
double |
Height of the picker wheel |
itemExtent |
double |
Height of each wheel item |
CountryData
class CountryData {
final String name;
final String dialCode;
const CountryData({
required this.name,
required this.dialCode,
});
}
π§ͺ Local Testing
You can test this package locally using a path dependency or by running the example/ app if included.
π€ Contributing
Contributions are welcome!
- Fork the repository
- Create a feature branch
- Submit a pull request
π License
This project is licensed under the MIT License.
Author
Ridwan Abdulazeez
If you find this package useful, please β the repository and share feedback!
---
## β
pubspec.yaml (assets section)
Make sure this is included in **your package `pubspec.yaml`**:
```yaml
flutter:
assets:
- assets/android.png
- assets/ios.png
And your folder structure should be:
countrydialselector/
ββ assets/
β ββ android.png
β ββ ios.png
ββ lib/
ββ README.md
ββ pubspec.yaml
π₯ Youβre now pub.devβready
Once you:
- commit the LICENSE
- commit README
- commit assets
Run:
flutter pub publish