all_country_picker 0.0.8
all_country_picker: ^0.0.8 copied to clipboard
A country picker plugin with textfield, and it will format as you type.
example/lib/main.dart
import 'package:all_country_picker/all_country_picker.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final TextEditingController phoneNumberController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(15),
child: CountryField(
phoneNumberController: phoneNumberController,
countryList: const [
'us',
'tt',
'jm',
'eg',
'dz',
'gm',
'gn',
'mu',
'lr',
'ng',
'cmr',
'ao',
'et',
'so',
'ke',
'zw',
'za',
'fr',
'lt',
'it',
'jm',
'mx',
'bo',
'my',
'au',
'vn',
'la',
'bd',
'tr',
'in',
'af',
'jo',
'sa',
'ye',
'om',
'ae',
'ae',
'ae',
],
onDropdownChanged: (value) {
// print(value!.isoCode);
},
),
),
),
),
);
}
}