buildStateAndCityRow function

Widget buildStateAndCityRow(
  1. OrganizationCubit cubit,
  2. OrganizationState state,
  3. List<String> stateList,
  4. Map<String, List<String>> indiaStatesWithCities,
)

Implementation

Widget buildStateAndCityRow(
  OrganizationCubit cubit,
  OrganizationState state,
  List<String> stateList,
  Map<String, List<String>> indiaStatesWithCities,
) {
  return Row(
    children: [
      Expanded(
        child: buildColumnWithDropdown(
          "State",
          stateList,
          state.selectedState,
          "Select state",
          (val) => cubit.setSelectedState(val),
          false,
        ),
      ),
      const SizedBox(width: 20),
      Expanded(
        child: buildColumnWithDropdown(
          "City",
          state.selectedState != null &&
                  indiaStatesWithCities.containsKey(state.selectedState)
              ? indiaStatesWithCities[state.selectedState]!
              : [],
          state.selectedCity,
          "Select city",
          (val) => cubit.setSelectedCity(val),
          false,
        ),
      ),
    ],
  );
}