TextAreaElement constructor

TextAreaElement({
  1. String? id,
  2. String? label,
  3. String? hint,
  4. Validation? validator,
  5. DecorationElement? decorationElement,
  6. int maxLines = 3,
  7. bool showCounter = false,
  8. int maxCharacter = 250,
  9. String messageError = "this field is required",
  10. bool readOnly = false,
  11. bool isRequired = false,
  12. bool visibility = true,
})

Implementation

TextAreaElement({
  String? id,
  String? label, //= "Comment",
  String? hint, //= "Comment",
  Validation? validator,
  DecorationElement? decorationElement,
  this.maxLines = 3,
  this.showCounter = false,
  this.maxCharacter = 250,
  String messageError = "this field is required",
  bool readOnly = false,
  bool isRequired = false,
  bool visibility = true,
}) : super(
        id: id,
        label: label,
        hint: hint,
        decorationElement: decorationElement,
        validator: (text) {
          if (isRequired && text != null && text.isEmpty) {
            return messageError;
          }
          if (validator != null) return validator(text);

          return null;
        },
        error: messageError,
        typeInput: TypeInput.multiLine,
        readOnly: readOnly,
        visibility: visibility,
      );