fl_country_code_picker 0.0.1 fl_country_code_picker: ^0.0.1 copied to clipboard
A Flutter package for showing a modal that contains country dial code. The user can also search for the available codes and select right from the modal.
fl_country_code_picker #
A Flutter package for showing a modal that contains country dial code. The user can also search for the available codes and select right from the modal.
Flutter Country Code Picker #
Disclaimer, this idea originally came from: [country_code_picker]: https://pub.dev/packages/country_code_picker package.
With this package you can show a country code selector and manipulate the selected CountryCode
model.
đ¨ Installation #
dependencies:
fl_country_code_picker: ^0.0.1
â Import #
import 'package:fl_country_code_picker/fl_country_code_picker.dart';
đšī¸ Usage #
Just put the component in your application through any functions where you can show the picker.
GestureDetector(
onTap: () async {
final code = await FlCountryCodePicker(
context: context,
pickerMaxHeight: 500.0,
).showPicker();
if (code != null) {
print(code);
}
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 8.0, vertical: 4.0),
margin: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: const BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(5.0))),
child: Text('Show Picker',
style: const TextStyle(color: Colors.white)),
),
),
CountryCode
object can be used to manipulate the selected country code by the user.
Type | Description | |
---|---|---|
name | String | The name of the country |
code | String | The 2 character ISO code of the country |
dialCode | String | The country dial code. By convention, international telephone numbers are represented by prefixing the country code with a plus sign (+). e.g. +1 for US |
flagImage | Widget | Widget that can be used on retrieving the selected country flag's image. |
Examples #
Mobile and Web preview
đ Bugs/Requests #
If you encounter any problems feel open an issue. If you feel the library is missing a feature, please raise a ticket on Github and we'll look into it. Pull request are also welcome.
đ License #
MIT License