checkProfileMandatoryFields method
dynamic
checkProfileMandatoryFields(
{ - bool? isEdited,
})
Implementation
checkProfileMandatoryFields({bool? isEdited}) {
if (isEdited != null) {
setIsEdit(isEdited);
}
var isCompleted = false;
if (profileNameController.text.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "customerName";
isProfileDetailsCompleted.value = false;
return;
}
if (profileIdController.text.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "customerId";
isProfileDetailsCompleted.value = false;
return;
}
if (profileEmailController.text.isNotEmpty) {
if (validateEmail(profileEmailController.text) == null) {
isCompleted = true;
} else {
firstEncounteredEmptyField = "enterValidEmail";
isCompleted = false;
isProfileDetailsCompleted.value = false;
return;
}
} else {
isCompleted = false;
firstEncounteredEmptyField = "email";
isProfileDetailsCompleted.value = false;
return;
}
if (profileMobileController.text.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "mobileNumber";
isProfileDetailsCompleted.value = false;
return;
}
if (selectedLocationType.value.type != null &&
selectedLocationType.value.type!.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "locationType";
isProfileDetailsCompleted.value = false;
return;
}
if (selectedRegion.value.locationName != null &&
selectedRegion.value.locationName!.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "region";
isProfileDetailsCompleted.value = false;
return;
}
if (profileCountryController.text.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "country";
isProfileDetailsCompleted.value = false;
return;
}
if (profileMarketSegmentController.text.isNotEmpty) {
isCompleted = true;
} else {
isCompleted = false;
firstEncounteredEmptyField = "marketSegment";
isProfileDetailsCompleted.value = false;
return;
}
if (isCompleted) {
isProfileDetailsCompleted.value = true;
}
// if (profileMarketSegmentController.text.isNotEmpty &&
// profileNameController.text.isNotEmpty &&
// profileIdController.text.isNotEmpty &&
// profileEmailController.text.isNotEmpty &&
// profileMobileController.text.isNotEmpty &&
// /*profileELoadController.text.isNotEmpty &&*/
// selectedLocationType.value.type != null &&
// selectedLocationType.value.type!.isNotEmpty &&
// selectedRegion.value.locationName != null &&
// selectedRegion.value.locationName!.isNotEmpty) {
// isProfileDetailsCompleted.value = true;
// } else {
// isProfileDetailsCompleted.value = false;
// }
}