inputDecoration function

InputDecoration inputDecoration(
  1. String label, {
  2. IconData? prefixIcon,
  3. IconData? suffixIconData,
  4. IconButton? suffixIcon,
  5. bool isMultiLine = false,
  6. Color? borderColor,
  7. bool enableBorder = false,
  8. EdgeInsetsGeometry? contentPadding,
  9. String? helperText,
})

Implementation

InputDecoration inputDecoration(String label,
    {IconData? prefixIcon,
    IconData? suffixIconData,
    IconButton? suffixIcon,
    bool isMultiLine = false,
    Color? borderColor,
    bool enableBorder = false,
    EdgeInsetsGeometry? contentPadding,
    String? helperText}) {
  return InputDecoration(
    errorBorder: OutlineInputBorder(
      borderRadius: BorderRadius.circular(10),
      borderSide: BorderSide(
        color: Colors.red,
        width: 1.0,
      ),
    ),
    border:
        OutlineInputBorder(borderSide: BorderSide(color: Colors.grey[200]!)),
    filled: true,
    helperText: helperText,
    helperStyle: TextStyle(color: Colors.grey, fontSize: 14),
    labelStyle: TextStyle(fontSize: 14),
    enabledBorder: OutlineInputBorder(
        borderRadius: BorderRadius.circular(10),
        borderSide: enableBorder
            ? BorderSide(color: Colors.grey[300]!)
            : BorderSide.none),
    focusedBorder: OutlineInputBorder(
      borderRadius: BorderRadius.circular(10),
      borderSide: BorderSide(
        color: borderColor ?? Color(0xffff7f00),
        width: 1.0,
      ),
    ),
    labelText: label,
    prefixIcon: Icon(prefixIcon, size: 15),
    suffixIcon: suffixIcon != null ? suffixIcon : Icon(suffixIconData),
    contentPadding: contentPadding ??
        EdgeInsets.symmetric(
          vertical: isMultiLine ? 16 : 0.0,
        ),
  );
}