country_state_city_dropdown 0.1.2
country_state_city_dropdown: ^0.1.2 copied to clipboard
A customizable Flutter package for searchable, cascading Country, State, and City dropdowns using JSON data.
π Country State City Dropdown #
A Flutter package that provides dynamic, cascading dropdowns for selecting Country, State, and City using local JSON data. Built with full customizability and search functionality.
β¨ Features #
β
Cascading dropdowns (Country β State β City)
β
Built-in search with OverlayEntry
β
No external dependencies
β
Form-friendly and highly customizable
β
Dark mode/theme support
β
Easy integration
π Getting Started #
Add the dependency in your pubspec.yaml file:
dependencies:
country_state_city_dropdown: ^0.1.2
Then run:
flutter pub get
π¦ Usage #
Hereβs a basic example of how to use the package:
import 'package:flutter/material.dart';
import 'package:country_state_city_dropdown/country_state_city_dropdown.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Country State City Picker')),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: CountryStateCityPicker(
onCountryChanged: (country) => print("Country: ${country.name}"),
onStateChanged: (state) => print("State: ${state.name}"),
onCityChanged: (city) => print("City: ${city.name}"),
spacing: 10,
),
),
),
);
}
}
This will show 3 dropdowns that dynamically update based on previous selections.
π Example #
Check the /example folder for a complete working demo.
π License #
This project is licensed under the MIT License.
Made with β€οΈ by @ir-khan