A flutter package to display list of Countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Sample 1 | Sample 2 | Sample 3 | Sample 4 |
---|---|---|---|
STEP ONE: Please, add country_picker_plus
to your package dependencies:
flutter pub add country_picker_plus
STEP TWO: Import the relevant package in the file you want to use:
import 'package:country_picker_plus/country_picker_plus.dart';
The package has two methods that you can use according to your needs
- By using the main package, all three fields, which are the country, State, and City, are created by default, and you can design them as you wish.
Sample code for this section:
CountryPickerPlus(
isRequired: true,
countryLabel: "Country",
countrySearchHintText: "Search Country",
countryHintText: "Tap to Select Country",
stateLabel: "State",
stateHintText: "Tap to Select State",
cityLabel: "City",
cityHintText: "Tap to Select City",
bottomSheetDecoration: bottomSheetDecoration,
decoration: fieldDecoration,
searchDecoration: searchDecoration,
onCountrySaved: (value) {},
onCountrySelected: (value) {},
onStateSelected: (value) {},
onCitySelected: (value) {},
),
Note: You can hide all fields until the previous field is selected
For Instance:
In the main package class. Use the following property
hideFields: true,
- Or use each of the fields individually [
country
,state
,city
]
Sample code for this section:
CountryPickerPlus.country(...);
CountryPickerPlus.state(country:'COUNTRY_NAME',....);
CountryPickerPlus.city(country:'COUNTRY_NAME',state:'STATE_NAME',...);
And and and other features that you can play with using code... :)
Made with contrib.rocks.
A Package Developed by Ali Hosseini
Please, report the bugs through the Github repository: https://github.com/real-ali/country_picker_plus/issues