You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
750 B
Dart
27 lines
750 B
Dart
|
1 month ago
|
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;
|
||
|
|
}
|
||
|
|
}
|