FieldModel constructor

FieldModel({
  1. required String label,
  2. double? padding,
  3. String name = '',
  4. String sameTo = '',
  5. String sameToError = '',
  6. Types type = Types.text,
  7. String errorMessage = '',
  8. bool mandatory = false,
  9. InputActions action = InputActions.auto,
  10. String hint = '',
  11. bool vallidate = false,
  12. int maxLength = 0,
  13. String maxLengthMessage = '',
  14. int minLength = 0,
  15. String minLengthMessage = '',
  16. bool password = false,
  17. bool readOnly = false,
  18. List<FieldOptionsModel> options = const [],
  19. String dateTimeFormat = 'MM/dd/yyyy',
  20. TextCapitalization capitalization = TextCapitalization.none,
  21. DateTypes dateType = DateTypes.eighteenYearsBefore,
  22. Color readOnlyColor = const Color(0xFFE9EAEE),
  23. dynamic value,
  24. List<TextInputFormatter>? formatters,
})

Implementation

FieldModel({
  required this.label,
  this.padding,
  this.name = '',
  this.sameTo = '',
  this.sameToError = '',
  this.type = Types.text,
  this.errorMessage = '',
  this.mandatory = false,
  this.action = InputActions.auto,
  this.hint = '',
  this.vallidate = false,
  this.maxLength = 0,
  this.maxLengthMessage = '',
  this.minLength = 0,
  this.minLengthMessage = '',
  this.password = false,
  this.readOnly = false,
  this.options = const [],
  this.dateTimeFormat = 'MM/dd/yyyy',
  this.capitalization = TextCapitalization.none,
  this.dateType = DateTypes.eighteenYearsBefore,
  this.readOnlyColor = const Color(0xFFE9EAEE),
  this.value,
  this.formatters,
}) {
  if (this.name.isEmpty) {
    this.name = this.label;
  }
  if (this.type == Types.dropdown && this.options.isEmpty) {
    throw Exception('You need to set items for a dropdown');
  }
}