dropDownFormField<T> static method

Widget dropDownFormField<T>({
  1. required T value,
  2. bool obscureText = false,
  3. TextInputType inputType = TextInputType.text,
  4. ValueChanged<T?>? onChanged,
  5. required List<T> items,
  6. EdgeInsets padding = paddingStepOne,
  7. EdgeInsets margin = paddingStepOne,
})

Implementation

static Widget dropDownFormField<T>(
        {required T value,
        bool obscureText = false,
        TextInputType inputType = TextInputType.text,
        ValueChanged<T?>? onChanged,
        required List<T> items,
        EdgeInsets padding = paddingStepOne,
        EdgeInsets margin = paddingStepOne}) =>
    Container(
        padding: padding,
        margin: margin,
        child: DropdownButtonFormField<T>(
          dropdownColor: AppColors.mainColor,
          elevation: 0,
          decoration: inputDecoration(),
          isExpanded: true,
          value: value,
          icon: Icon(
            Icons.arrow_downward,
            color: AppColors.textColor,
          ),
          style: TextStyle(color: AppColors.textColor),
          onChanged: onChanged,
          items: items.map<DropdownMenuItem<T>>((T value) {
            return DropdownMenuItem<T>(
              value: value,
              child: Text(value.toString()),
            );
          }).toList(),
        ));