pincode_country_state_city_pro 1.0.0 copy "pincode_country_state_city_pro: ^1.0.0" to clipboard
pincode_country_state_city_pro: ^1.0.0 copied to clipboard

Offline-first Flutter address picker package with country/state/city dropdowns, typeahead search, pincode auto-fill, and country-specific postal code validation.

example/lib/main.dart

import 'package:example/picker_type_toggle_widget.dart';
import 'package:flutter/material.dart';
import 'package:pincode_country_state_city_pro/pincode_country_state_city_pro.dart';

void main() {
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  AddressPickerController controller = AddressPickerController();
  PickerType selectedPickerType = PickerType.dropDownSearch;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        backgroundColor: Colors.blue,
        title: const Text(
          "Pincode ➜ Country ➜ State ➜ City",
          style: TextStyle(color: Colors.white),
        ),
      ),
      body: Stack(
        children: [
          Positioned.fill(
            child: Image.asset(
              "assets/home_page_background_image.png",
              fit: BoxFit.cover,
              opacity: const AlwaysStoppedAnimation(.5),
            ),
          ),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 15),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                PickerTypeToggleWidget(
                  pickerType: selectedPickerType,
                  onToggle: (type) {
                    if (type != null) {
                      setState(() {
                        selectedPickerType = type;
                        controller = AddressPickerController();
                      });
                    }
                  },
                ),
                const SizedBox(height: 8),
                //Default picker
                Expanded(
                  child: PincodeCountryStateCityPicker(
                    key: ValueKey<String>(selectedPickerType.name),
                    controller: controller,
                    pickerType: selectedPickerType,
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
4
likes
160
points
21
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Offline-first Flutter address picker package with country/state/city dropdowns, typeahead search, pincode auto-fill, and country-specific postal code validation.

Repository (GitHub)
View/report issues

Topics

#address-picker #country-state-city #pincode #postal-code #autofill

License

MIT (license)

Dependencies

collection, dropdown_search, flutter, http

More

Packages that depend on pincode_country_state_city_pro