flutter_country_state
An intuitive and versatile Flutter package designed to simplify the display of countries, states, and cities within your application. With seamless integration, it offers a comprehensive list of countries worldwide, allowing users to effortlessly navigate through states and cities. Featuring a user-friendly search functionality and extensive customization options, it can be easily integrated into both bottom sheets and full-screen layouts, enhancing the user experience and streamlining development.
This works on both Android, Ios, and Web
Example
Please run the app in the Example folder
Installation
- add the dependency to your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
flutter_country_state:
You can also change the style of the text of list of the country, states, and cities
-searchHint
-substringBackground
-subStringStyle
-style
-searchStyle
selectedCountryBackgroundColor
notSelectedCountryBackgroundColor
selectedStateBackgroundColor
notSelectedStateBackgroundColor
selectedCityBackgroundColor
notSelectedCityBackgroundColor
onSelectCountry
onSelectedState
countryHeaderStyle
stateHeaderStyle
onSelectedCity
Use It
This will display the list of countries in the world
showModalBottomSheet(
isScrollControlled: true,
context: context,
isDismissible: false,
builder: (context) => SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: ShowCountryDialog(
searchHint: 'Search for a country',
substringBackground: Colors.black,
style: const TextStyle(color: Colors.black,fontWeight: FontWeight.w500),
searchStyle: const TextStyle(color: Colors.black),
subStringStyle: const TextStyle(color: Colors.white),
selectedCountryBackgroundColor: Colors.pink,
notSelectedCountryBackgroundColor: Colors.white,
onSelectCountry: (){setState(() {
selectedCountry = Variables.country;
});},
),
),
);
This will display the states of the country selected
showModalBottomSheet(
isScrollControlled: true,
context: context,
isDismissible: false,
builder: (context) => SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: ShowStateDialog(
style: const TextStyle(color: Colors.black,fontWeight: FontWeight.w500),
subStringStyle: const TextStyle(color: Colors.white),
substringBackground: Colors.black,
selectedStateBackgroundColor: Colors.orange,
notSelectedStateBackgroundColor: Colors.white,
onSelectedState: (){
setState(() {
selectedState = Variables.state;
});
},
),
),
);
This will display the cities of the state selected
showModalBottomSheet(
isScrollControlled: true,
context: context,
isDismissible: false,
builder: (context) => SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: ShowCityDialog(
style: const TextStyle(color: Colors.black,fontWeight: FontWeight.w500),
subStringStyle: const TextStyle(color: Colors.white),
substringBackground: Colors.black,
selectedCityBackgroundColor: Colors.orange,
notSelectedCityBackgroundColor: Colors.white,
onSelectedCity: (){
setState(() {
selectedCity = Selected.city;
});
},
),
),
);
Next goal
x
Add countries flagx
Add countries code
Libraries
- cities/Afghanistan_cities
- cities/Albania_ciities
- cities/Algeria_cities
- cities/Andorra
- cities/Angola_cities
- cities/Anguilla_citiies
- cities/Antigua_cities
- cities/Argentina_ciities
- cities/Armenia_cities
- cities/Australia_cities
- cities/Austria_cities
- cities/Azerbaijan_cities
- cities/Bahamas_cities
- cities/Bahrain_cities
- cities/Bangladesh_cities
- cities/Barbados_cities
- cities/Belarus_cities
- cities/Belgium_cities
- cities/Belize_cities
- cities/Benin_cities
- cities/Bermuda_cities
- cities/Bhutan_cities
- cities/Bolivia_cities
- cities/Bosnia_cities
- cities/Botswana_cities
- cities/Brazil_cities
- cities/Brunei_cities
- cities/Bulgaria_cities
- cities/BurkinaFaso_cities
- cities/Burundi_cities
- cities/Cambodia_cities
- cities/Cameroon_cities
- cities/Canada_cities
- cities/CapeVerde_cities
- cities/CaymanIslands_cities
- cities/CentralAfrica_cities
- cities/chad_cities
- cities/Chile_cities
- cities/china_cities
- cities/Colombia_cities
- cities/Comoros_cities
- cities/Congo_cities
- cities/CostaRica_cities
- cities/Cote_cities
- cities/Croatia_cities
- cities/Cuba_cities
- cities/Cyprus_cities
- cities/CzechRepublic_cities
- cities/Denmark_cities
- cities/Djibouti_cities
- cities/Dominica_cities
- cities/DominicanRepublic_cities
- cities/Ecuador_cities
- cities/Egypt_cities
- cities/ElSalvador_cities
- cities/Equatorial_Guinea_cities
- cities/Eritrea_cities
- cities/Estonia_cities
- cities/Ethiopia_cities
- cities/Fiji_cities
- cities/finland_cities
- cities/France_cities
- cities/Gabon_cities
- cities/Gambia_cities
- cities/Germany_cities
- cities/Ghana_cities
- cities/Gibraltar_cities
- cities/Greece_cities
- cities/Greenland_cities
- cities/Grenada_cities
- cities/Guadeloupe_cities
- cities/Guam_cities
- cities/Guatemala_cities
- cities/Guernsey_cities
- cities/Guinea-Bissau_cities
- cities/Guinea_cities
- cities/Guyana_cities
- cities/Haiti_cities
- cities/Honduras_cities
- cities/Hong_cities
- cities/Hungary_cities
- cities/Iceland_cities
- cities/India_cities
- cities/Indonesia_cities
- cities/Iran_cities
- cities/Iraq_cities
- cities/Ireland_cities
- cities/Isle_cities
- cities/Israel_cities
- cities/Italy_cities
- cities/Jamaica_cities
- cities/Japan_cities
- cities/Jordan_cities
- cities/Kazakhstan_cities
- cities/Kenya_cities
- cities/Kuwait_cities
- cities/Kyrgyzstan_cities
- cities/Laos_cities
- cities/Latvia_cities
- cities/Lebanon_cities
- cities/Lesotho_cities
- cities/Liberia_cities
- cities/Liechtenstein_cities
- cities/Lithuania_cities
- cities/Luxembourg_cities
- cities/Macedonia_cities
- cities/Madagascar_cities
- cities/Malawi_cities
- cities/Malaysia_cities
- cities/Maldives_cities
- cities/Mali_cities
- cities/Malta_cities
- cities/Martinique_cities
- cities/Mauritania_cities
- cities/Mauritius_cities
- cities/Mayotte_cities
- cities/Mexico_cities
- cities/Micronesia_cities
- cities/Miquelon_cities
- cities/Moldova_cities
- cities/Monaco_cities
- cities/Mongolia_cities
- cities/Montenegro_cities
- cities/Montserrat_cities
- cities/Morocco_cities
- cities/Mozambique_cities
- cities/Myanmar_cities
- cities/Namibia_cities
- cities/Nauru_cities
- cities/Nepal_cities
- cities/Netherlands_cities
- cities/New_zealand_cities
- cities/Nicaragua_cities
- cities/Niger_cities
- cities/Nigeria_cities
- cities/North_Korea_cities
- cities/Northern_Mariana_Islands_cities
- cities/Norway_cities
- cities/Oman_cities
- cities/Pakistan_cities
- cities/Palau_cities
- cities/Palestinian_cities
- cities/Panama_cities
- cities/Papua_New_Guinea_cities
- cities/Paraguay_cities
- cities/Peru_cities
- cities/Philippines_cities
- cities/Poland_cities
- cities/Portugal_cities
- cities/Principe_cities
- cities/Puerto_Rico_cities
- cities/Qatar_cities
- cities/Romania_cities
- cities/Russia_cities
- cities/Rwanda_cities
- cities/Saint_Kitts_cities
- cities/Saint_Lucia_cities
- cities/Saint_Vincent_cities
- cities/Samoa_cities
- cities/Sao_Tome_cities
- cities/Saudi_Arabia_cities
- cities/Senegal_cities
- cities/Serbia_cities
- cities/Seychelles_cities
- cities/Sierra Leone_cities
- cities/Singapore_cities
- cities/Slovakia_cities
- cities/Slovenia_cities
- cities/Solomon_Islands_cities
- cities/Somalia_cities
- cities/South_Africa_cities
- cities/South_Korea_cities
- cities/Spain_cities
- cities/Sri_Lanka_cities
- cities/Sudan_cities
- cities/Swaziland_cities
- cities/Sweden_cities
- cities/Switzerland_cities
- cities/Syria_cities
- cities/Taiwan_cities
- cities/Tajikistan_cities
- cities/Tanzania_cities
- cities/Thailand_cities
- cities/Togo_cities
- cities/Tokelau_cities
- cities/Tonga_cities
- cities/Trinidad_cities
- cities/Tunisia_cities
- cities/Turkey_cities
- cities/Turkmenistan_cities
- cities/Turks_Islands_cities
- cities/Tuvalu_cities
- cities/UAE_cities
- cities/Uganda_cities
- cities/Ukraine_cities
- cities/United_Kingdom_cities
- cities/Uruguay_cities
- cities/USA_cities
- cities/Uzbekistan_cities
- cities/Vanuatu_cities
- cities/Venezuela_cities
- cities/Vietnam_cities
- cities/Wallis_cities
- cities/Yemen_cities
- cities/Zambia_cities
- cities/Zimbabwe_cities
- city_screen
- complied_cities
- cty-list
- flutter_country_state
- select_state
- state-list
- state_screen