dropDownWidgetWithLabel static method

dynamic dropDownWidgetWithLabel(
  1. BuildContext context,
  2. String labelName,
  3. String hintText,
  4. dynamic value,
  5. List lstData,
  6. Function onChanged,
  7. Function onValidate, {
  8. double labelFontSize = 20,
  9. bool labelBold = true,
  10. double hintFontSize = 15,
  11. Color borderColor = Colors.redAccent,
  12. double borderRadius = 30,
  13. Color borderFocusColor = Colors.redAccent,
  14. double paddingLeft = 20,
  15. double paddingRight = 20,
  16. double paddingTop = 0,
  17. double paddingBottom = 0,
  18. String optionValue = "id",
  19. String optionLabel = "name",
  20. double contentPadding = 6,
  21. Color validationColor = Colors.redAccent,
  22. Color textColor = Colors.black,
  23. Color hintColor = Colors.black,
  24. double borderWidth = 2,
  25. double focusedBorderWidth = 2,
  26. double enabledBorderWidth = 1,
  27. Widget? suffixIcon,
  28. Icon? prefixIcon,
  29. bool showPrefixIcon = false,
  30. Color prefixIconColor = Colors.redAccent,
  31. double prefixIconPaddingLeft = 30,
  32. double prefixIconPaddingRight = 10,
  33. double prefixIconPaddingTop = 0,
  34. double prefixIconPaddingBottom = 0,
})

Implementation

static dropDownWidgetWithLabel(
  BuildContext context,
  String labelName,
  String hintText,
  dynamic value,
  List<dynamic> lstData,
  Function onChanged,
  Function onValidate, {
  double labelFontSize: 20,
  bool labelBold = true,
  double hintFontSize = 15,
  Color borderColor = Colors.redAccent,
  double borderRadius = 30,
  Color borderFocusColor = Colors.redAccent,
  double paddingLeft = 20,
  double paddingRight = 20,
  double paddingTop = 0,
  double paddingBottom = 0,
  String optionValue = "id",
  String optionLabel = "name",
  double contentPadding = 6,
  Color validationColor = Colors.redAccent,
  Color textColor = Colors.black,
  Color hintColor = Colors.black,
  double borderWidth = 2,
  double focusedBorderWidth = 2,
  double enabledBorderWidth = 1,
  Widget? suffixIcon,
  Icon? prefixIcon,
  bool showPrefixIcon = false,
  Color prefixIconColor = Colors.redAccent,
  double prefixIconPaddingLeft = 30,
  double prefixIconPaddingRight = 10,
  double prefixIconPaddingTop = 0,
  double prefixIconPaddingBottom = 0,
}) {
  return Container(
    padding: EdgeInsets.only(left: 10, right: 10),
    child: Column(
      children: <Widget>[
        new Padding(
          padding: EdgeInsets.only(
            left: 0,
            right: 10,
            top: 10,
            bottom: 10,
          ),
          child: Align(
            alignment: Alignment.topLeft,
            child: Text(
              labelName,
              textAlign: TextAlign.left,
              style: TextStyle(
                fontSize: labelFontSize,
                fontWeight: labelBold ? FontWeight.bold : null,
              ),
            ),
          ),
        ),
        dropDownWidget(
          context,
          hintText,
          value,
          lstData,
          onChanged,
          onValidate,
          hintFontSize: hintFontSize,
          borderColor: borderColor,
          borderRadius: borderRadius,
          borderFocusColor: borderFocusColor,
          paddingLeft: paddingLeft,
          paddingRight: paddingRight,
          paddingTop: paddingTop,
          paddingBottom: paddingBottom,
          optionValue: optionValue,
          optionLabel: optionLabel,
          contentPadding: contentPadding,
          validationColor: validationColor,
          textColor: textColor,
          hintColor: hintColor,
          borderWidth: borderWidth,
          focusedBorderWidth: focusedBorderWidth,
          enabledBorderWidth: enabledBorderWidth,
          suffixIcon: suffixIcon,
          prefixIcon: prefixIcon,
          showPrefixIcon: showPrefixIcon,
          prefixIconColor: prefixIconColor,
          prefixIconPaddingLeft: prefixIconPaddingLeft,
          prefixIconPaddingRight: prefixIconPaddingRight,
          prefixIconPaddingTop: prefixIconPaddingTop,
          prefixIconPaddingBottom: prefixIconPaddingBottom,
        )
      ],
    ),
  );
}