import 'package:flutter/cupertino.dart';

import 'input_field.dart';

class FieldValidation {
  static bool validateAll([List<Widget> widgetList = const []]) {
    bool isValid = true;
    for (Widget widget in widgetList) {
      if (widget is InputField) {
        InputField inputFieldCustom = widget;
        bool valid = inputFieldCustom.validate(inputFieldCustom.controller!.text);
        if (!valid) {
          isValid = false;
        }
      }
      // if (widget is CustomDatePicker) {
      //   CustomDatePicker inputFieldCustom = widget;
      //   bool valid = inputFieldCustom.validate(inputFieldCustom.controller!.text);
      //   if (!valid) {
      //     isValid = false;
      //   }
      // }
    }
    return isValid;
  }
}
