altafc22 / csc_picker

A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
BSD 3-Clause "New" or "Revised" License
27 stars 118 forks source link

Unable to select cities or states #81

Closed Henry0149 closed 9 months ago

Henry0149 commented 9 months ago

Both Properties showStates and showCities are set to true, yet i cant get the dropdown.

                              SizedBox(
                                width: 370.w,
                                height: 120.h,
                                child: CSCPicker(
                                  key: _cscPickerKey,
                                  // defaultCountry: CscCountry.United_States,
                                  // disableCountry: true,
                                  showCities: true,
                                  showStates: true,
                                  countrySearchPlaceholder: "Country",
                                  stateSearchPlaceholder: "State",
                                  citySearchPlaceholder: "City",
                                  countryDropdownLabel: "Country",
                                  stateDropdownLabel: "*State",
                                  cityDropdownLabel: "*City",
                                  // disabledDropdownDecoration: BoxDecoration(
                                  //   borderRadius: BorderRadius.all(
                                  //     Radius.circular(30.r),
                                  //   ),
                                  //   color: Colors.grey.shade300,
                                  //   border: Border.all(
                                  //       color: Colors.grey.shade300,
                                  //       width: 1),
                                  // ),
                                  dropdownDecoration: BoxDecoration(
                                    borderRadius: BorderRadius.all(
                                      Radius.circular(30.r),
                                    ),
                                    color: Colors.white,
                                    border: Border.all(
                                      color: Colors.grey.shade300,
                                      width: 1,
                                    ),
                                  ),
                                  //flagState: CountryFlag.ENABLE,
                                  currentCountry: "US",
                                  countryFilter: const [
                                    CscCountry.United_States
                                  ],
                                  selectedItemStyle: GoogleFonts.inter(
                                    color: Colors.black,
                                    fontSize: 14,
                                  ),

                                  ///DropdownDialog Heading style [OPTIONAL PARAMETER]
                                  dropdownHeadingStyle: GoogleFonts.inter(
                                      color: Colors.black,
                                      fontSize: 17,
                                      fontWeight: FontWeight.bold),

                                  ///DropdownDialog Item style [OPTIONAL PARAMETER]
                                  dropdownItemStyle: GoogleFonts.inter(
                                    color: Colors.black,
                                    fontSize: 14,
                                  ),
                                  dropdownDialogRadius: 30.0,
                                  onStateChanged: (value) {
                                    setState(() {
                                      ///store value in state variable
                                      stateValue = value;
                                    });
                                  },

                                  ///triggers once city selected in dropdown
                                  onCityChanged: (value) {
                                    setState(() {
                                      ///store value in city variable
                                      cityValue = value;
                                    });
                                  },
                                ),
                              ),

This is my code

Drop Down are suppose to be enabled

haleem13 commented 8 months ago

did you figure out how to do it

Henry0149 commented 8 months ago

If you have a country set by default, it will disable other fields. You have to reselect the country, then fields will be enabled