hasSubAttributes function

bool hasSubAttributes(
  1. Map<String, dynamic> defs,
  2. FormFieldType fieldType,
  3. String key
)

Implementation

bool hasSubAttributes(Map<String, dynamic> defs, FormFieldType fieldType, String key) {
  final field = defs[key] as Map<String, dynamic>;
  if (fieldType == FormFieldType.textarea ||
      fieldType == FormFieldType.dateTimePicker ||
      fieldType == FormFieldType.dateRangePicker ||
      fieldType == FormFieldType.rangeSlider) {
    if (fieldType == FormFieldType.textarea) {
      return field.containsKey('numberOfLines');
    }

    if (fieldType == FormFieldType.dateTimePicker && field.containsKey('datePickerMode')) {
      return true;
    }
    if (fieldType == FormFieldType.dateRangePicker &&
        field.containsKey('dateRange') &&
        ((field['dateRange'] as Map?) != null && ((field['dateRange'] as Map?)!['firstDate'] != null)) &&
        ((field['dateRange'] as Map?)!['lastDate'] != null)) {
      return true;
    }
    if (fieldType == FormFieldType.rangeSlider &&
        field.containsKey('sliderRange') &&
        (field['sliderRange'] as Map?) != null &&
        (field['sliderRange'] as Map).containsKey('min') &&
        (field['sliderRange'] as Map).containsKey('max') &&
        (field['sliderRange'] as Map).containsKey('divisions')) {
      return true;
    }
  }
  return false;
}