india_state_city_picker 0.0.4
india_state_city_picker: ^0.0.4 copied to clipboard
A Flutter package that provides a searchable India State and City picker widget.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:india_state_city_picker/india_state_city_picker.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: PickerDemo(),
);
}
}
class PickerDemo extends StatefulWidget {
const PickerDemo({super.key});
@override
State<PickerDemo> createState() => _PickerDemoState();
}
class _PickerDemoState extends State<PickerDemo> {
String selectedState = "State";
String selectedCity = "City";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("India State City Picker")),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: IndiaStateCityPicker(
direction: false, // change to true for horizontal
selectedState: selectedState,
selectedCity: selectedCity,
onChanged: (state, city) {
setState(() {
selectedState = state;
selectedCity = city;
});
},
),
),
);
}
}