world_code_picker 1.0.0
world_code_picker: ^1.0.0 copied to clipboard
Beautiful & lightweight Flutter package to pick country codes with emoji flags, search, and smooth UI — perfect for phone authentication.
📱 Country Code Picker #
A lightweight and customizable Flutter package to pick country codes easily. 🌍
✨ Features #
- 🔹 Searchable country list (name, ISO, dial code)
- 🔹 Default selection support
- 🔹 Works with TextField or forms
- 🔹 Callback when user selects a country
- 🔹 Emoji flags support 🇮🇳 🇺🇸 🇬🇧
- 🔹 Simple API, no heavy dependencies
🚀 Installation #
Add the dependency in your pubspec.yaml:
dependencies:
world_code_picker: ^0.0.9
Run:
flutter pub get
📖 Example #
Here’s a minimal usage example:
import 'package:flutter/material.dart';
import 'package:world_code_picker/country.dart';
import 'package:world_code_picker/world_code_picker.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Country Code Picker Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Country? _selected;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Country Code Picker")),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FilledButton.icon(
icon: const Icon(Icons.flag),
label: const Text('Pick Country Code'),
onPressed: () async {
final result = await showCountryCodePickerBottomSheet(
context: context,
style: const CountryPickerStyle(
sheetTitle: 'Select your country',
searchHintText: 'Search country, ISO, or +code',
cornerRadius: 20,
),
);
if (result != null) {
setState(() => _selected = result);
}
},
),
const SizedBox(height: 16),
Text(
_selected == null
? 'Selected: None'
: 'Selected: ${_selected!.flagEmoji} ${_selected!.name} (${_selected!.dialCode})',
style: Theme.of(context).textTheme.titleMedium,
),
],
),
),
);
}
}
📸 Screenshots #
| Country Picker | Search Feature |
|---|---|
![]() |
![]() |
⚙️ Parameters #
| Parameter | Type | Description |
|---|---|---|
sheetTitle |
String | Title shown at the top of bottom sheet |
searchHintText |
String | Placeholder in the search field |
cornerRadius |
double | Corner radius of the bottom sheet |
🤝 Contributing #
Contributions are welcome! 🎉
- Open an issue for bugs/feature requests
- Submit a PR for fixes and improvements
📄 License #
This project is licensed under the MIT License.
See the LICENSE file for details.