FieldModel constructor
FieldModel(- {@required String label,
- String name: '',
- String sameTo: '',
- String sameToError: '',
- Types type: Types.text,
- String errorMessage: '',
- bool mandatory: false,
- InputActions action: InputActions.auto,
- String hint: '',
- bool vallidate: false,
- int maxLength: 0,
- String maxLengthMessage: '',
- int minLength: 0,
- String minLengthMessage: '',
- bool password: false,
- bool readOnly: false,
- List<FieldOptionsModel> options: const [],
- String dateTimeFormat: 'MM/dd/yyyy',
- DateTypes dateType: DateTypes.eighteenYearsBefore,
- dynamic value}
)
Implementation
FieldModel({
@required this.label,
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.dateType = DateTypes.eighteenYearsBefore,
this.value,
}) {
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');
}
}