inputFieldWidgetWithLabel static method

Widget inputFieldWidgetWithLabel(
  1. BuildContext context,
  2. String keyName,
  3. String labelName,
  4. String hintText,
  5. Function onValidate,
  6. Function onSaved, {
  7. String initialValue = "",
  8. dynamic obscureText = false,
  9. double labelFontSize = 20,
  10. bool labelBold = true,
  11. double fontSize = 18,
  12. double hintFontSize = 15,
  13. double paddingLeft = 20,
  14. double paddingRight = 20,
  15. double paddingTop = 0,
  16. double paddingBottom = 0,
  17. Widget? suffixIcon,
  18. Icon? prefixIcon,
  19. double borderRadius = 30,
  20. Color borderColor = Colors.redAccent,
  21. Color borderFocusColor = Colors.redAccent,
  22. double borderWidth = 2,
  23. double focusedBorderWidth = 2,
  24. double enabledBorderWidth = 1,
  25. bool showPrefixIcon = false,
  26. Color prefixIconColor = Colors.redAccent,
  27. double prefixIconPaddingLeft = 30,
  28. double prefixIconPaddingRight = 10,
  29. double prefixIconPaddingTop = 0,
  30. double prefixIconPaddingBottom = 0,
  31. double containerHeight = 60,
  32. double containerWidth = 0,
  33. bool isMultiline = false,
  34. Function? onChange,
  35. Color textColor = Colors.black,
  36. Color hintColor = Colors.black,
  37. Color validationColor = Colors.redAccent,
  38. double contentPadding = 6,
  39. int multilineRows = 4,
  40. bool isNumeric = false,
  41. Color backgroundColor = Colors.transparent,
  42. Color borderErrorColor = Colors.redAccent,
  43. Color borderFocusedErrorColor = Colors.redAccent,
  44. double errorBorderWidth = 2,
  45. double focusedErrorBorderWidth = 2,
  46. bool isReadonly = false,
  47. Color labelFontColor = Colors.black,
})

Implementation

static Widget inputFieldWidgetWithLabel(
  BuildContext context,
  String keyName,
  String labelName,
  String hintText,
  Function onValidate,
  Function onSaved, {
  String initialValue = "",
  obscureText: false,
  double labelFontSize: 20,
  bool labelBold = true,
  double fontSize = 18,
  double hintFontSize = 15,
  double paddingLeft = 20,
  double paddingRight = 20,
  double paddingTop = 0,
  double paddingBottom = 0,
  Widget? suffixIcon,
  Icon? prefixIcon,
  double borderRadius = 30,
  Color borderColor = Colors.redAccent,
  Color borderFocusColor = Colors.redAccent,
  double borderWidth = 2,
  double focusedBorderWidth = 2,
  double enabledBorderWidth = 1,
  bool showPrefixIcon = false,
  Color prefixIconColor = Colors.redAccent,
  double prefixIconPaddingLeft = 30,
  double prefixIconPaddingRight = 10,
  double prefixIconPaddingTop = 0,
  double prefixIconPaddingBottom = 0,
  double containerHeight = 60,
  double containerWidth = 0,
  bool isMultiline = false,
  Function? onChange,
  Color textColor = Colors.black,
  Color hintColor = Colors.black,
  Color validationColor = Colors.redAccent,
  double contentPadding = 6,
  int multilineRows = 4,
  bool isNumeric = false,
  Color backgroundColor = Colors.transparent,
  Color borderErrorColor = Colors.redAccent,
  Color borderFocusedErrorColor = Colors.redAccent,
  double errorBorderWidth = 2,
  double focusedErrorBorderWidth = 2,
  bool isReadonly = false,
  Color labelFontColor = Colors.black,
}) {
  return Container(
    padding: EdgeInsets.only(left: 0, right: 0),
    child: Column(
      children: <Widget>[
        new Padding(
          padding: EdgeInsets.only(
            left: 0,
            right: 0,
            top: 10,
            bottom: 10,
          ),
          child: Align(
            alignment: Alignment.topLeft,
            child: Text(
              labelName,
              textAlign: TextAlign.left,
              style: TextStyle(
                fontSize: labelFontSize,
                fontWeight: labelBold ? FontWeight.bold : null,
                color: labelFontColor,
              ),
            ),
          ),
        ),
        inputFieldWidget(
          context,
          keyName,
          hintText,
          onValidate,
          onSaved,
          initialValue: initialValue,
          obscureText: obscureText,
          fontSize: fontSize,
          hintFontSize: hintFontSize,
          paddingLeft: paddingLeft,
          paddingRight: paddingRight,
          paddingTop: paddingTop,
          paddingBottom: paddingBottom,
          prefixIcon: prefixIcon,
          suffixIcon: suffixIcon,
          borderRadius: borderRadius,
          borderColor: borderColor,
          borderFocusColor: borderFocusColor,
          borderWidth: borderWidth,
          enabledBorderWidth: enabledBorderWidth,
          focusedBorderWidth: focusedBorderWidth,
          showPrefixIcon: showPrefixIcon,
          prefixIconColor: prefixIconColor,
          prefixIconPaddingLeft: prefixIconPaddingLeft,
          prefixIconPaddingRight: prefixIconPaddingRight,
          prefixIconPaddingTop: prefixIconPaddingTop,
          prefixIconPaddingBottom: prefixIconPaddingBottom,
          onChange: onChange,
          isMultiline: isMultiline,
          textColor: textColor,
          hintColor: hintColor,
          validationColor: validationColor,
          multilineRows: multilineRows,
          contentPadding: contentPadding,
          isNumeric: isNumeric,
          backgroundColor: backgroundColor,
          borderErrorColor: borderErrorColor,
          borderFocusedErrorColor: borderFocusedErrorColor,
          errorBorderWidth: errorBorderWidth,
          focusedErrorBorderWidth: focusedErrorBorderWidth,
          isReadonly: isReadonly,
        ),
      ],
    ),
  );
}