country_state_picker 0.0.5 copy "country_state_picker: ^0.0.5" to clipboard
country_state_picker: ^0.0.5 copied to clipboard

A Package for Selecting Countries and States from a Dropdown Field. Compactible with IOS,ANDROID AND WEB. Feel free to make PR's and suggestions.

Description #

This package provides drop-down items for selecting countries and states.

Features
  • Select Country
  • Select State per selected country
  • Pass validators to validate country and state when submitting form
Parameters
Param Required Default Type Description
onCountryChanged null Function (String) Handle Country Selection
onStateChanged null Function (String) Handle State Selection
onStateTap null void Handle Input onTap Event
onStateTap null void Handle Input onTap Event
flagSize 22.0 double Size of Country Flag on Input Label
listFlagSize 22.0 double Size of Country Flag on List Label
inputDecoration -- InputDecoration Style for InputFields
hintTextStyle -- TextStyle Style for Hint Text of Input
itemTextStyle -- TextStyle Style for Text of DropdownItem
dropdownColor Grey Color Style for Text of DropdownItem
elevation 0 int Elevation of Dropdown List
isExpanded true bool Determines if Input field should fill parent width
divider -- Widget Widget to create space or style between the country and state field
countryLabel -- Widget Label for country field
stateLabel -- Widget Label for state field
countryHintText -- String hintText for country field
stateHintText -- String hintText for state field
noStateFoundText -- String Hint to ack no states exist on the selected country (eg. Aruba)
onCountryChanged null Function (String) Validate Country Selection on Submition
onStateChanged null Function (String) Validate State Selection on Submition

How To Use #

  1. Import the package

    import 'package:country_state_picker/country_state_picker.dart';
    
  2. Provide at least the required params

    CountryStatePicker(
      onCountryChanged: (ct) => setState(() {
          country = ct;
          state = null;
        }),
        onStateChanged: (st) => setState(() {
          state = st;
        }),
     ),
    
    

Todo #

  • Select Country
  • Select State
  • Validate Country
  • Validate State
  • Create Select City
  • Add Select City
  • Add Variants to the widget
3
likes
130
pub points
84%
popularity

Publisher

verified publisheracloe.com

A Package for Selecting Countries and States from a Dropdown Field. Compactible with IOS,ANDROID AND WEB. Feel free to make PR's and suggestions.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on country_state_picker