checkBeforeRegister method
dynamic
checkBeforeRegister(
{ - bool? isEnd,
})
Implementation
checkBeforeRegister({bool? isEnd}) {
bool isOkey = true;
bool emailValid = RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(emailController.text);
if (widget.registerWith != RegisterWith.phoneSign) {
if (emailController.text.isEmpty) {
isOkey = false;
} else {
isOkey = emailValid;
if (!emailValid) {
isEmailWrong = true;
} else {
isEmailWrong = false;
}
if (widget.registerWith == RegisterWith.emailSign) {
if (emailController.text.contains("@sellon.net") ||
emailController.text.contains("sellon")) {
isOkey = false;
isEmailWrong = true;
isEmailSellonWrong = true;
} else {
isEmailWrong = false;
isEmailSellonWrong = false;
}
}
}
}
if (fullnameController.text.isEmpty) {
isOkey = false;
}
if (Config.AppVersion == VersionApps.singapura) {
if (phoneNumberController.text.isEmpty) {
isOkey = false;
} else {
if (phoneNumberController.text.length <= 7) {
isPhoneWrong = true;
} else {
isPhoneWrong = false;
}
}
}
if (widget.registerWith == RegisterWith.emailSign) {
if (passwordController.text.isEmpty) {
isOkey = false;
} else {
if (!validateStructure(passwordController.text)) {
isOkey = false;
isPasswordWrong = true;
} else {
isPasswordWrong = false;
}
}
if (passwordconfirmController.text.isEmpty) {
isOkey = false;
}
if (passwordconfirmController.text != passwordController.text) {
isOkey = false;
isPasswordNotMatchWrong = true;
} else {
isPasswordNotMatchWrong = false;
}
}
// if (posCode.isEmpty) {
// if (Config.AppVersion == VersionApps.indonesia) {
// isOkey = true;
// } else {
// isOkey = false;
// }
// }
if (Config.AppVersion == VersionApps.singapura) {
if (addressNoteController.text.isEmpty) {
isOkey = false;
}
if (isChangezipcode) {
isOkey = false;
}
if (addressController.text.isEmpty) {
isOkey = false;
} else {
if (addressController.text.length < 6) {
isOkey = false;
}
}
if (posCode == "") {
isOkey = false;
}
if (addresName == "") {
isOkey = false;
}
} else if (Config.AppVersion == VersionApps.indonesia) {
if (widget.registerWith == RegisterWith.phoneSign ||
widget.registerWith == RegisterWith.emailSign) {
if (phoneNumberController.text.isEmpty) {
isOkey = false;
} else {
if (phoneNumberController.text.length > 5 &&
phoneNumberController.text.length <= 15) {
if (phoneNumberController.text.characters.first.toString() == "0" &&
phoneNumberController.text.characters
.toList(growable: true)[1] ==
"8") {
} else {
isOkey = false;
}
} else {
isOkey = false;
}
}
}
// if (idCover == null) {
// // idCover = Config.wilayahLocalID.id;
// isOkey = false;
// }
// if (iaCantRegister) {
// if (isEnd != null) {
// Helper().showDialogBox(
// context,
// Icons.error_outline_rounded,
// Languanges.of(context)!.sorryText + "!",
// Languanges.of(context)!.youAreNotInOurServiceArea, backOrOkey: () {
// SellonRouter.pop(context);
// // SellonRouter.pop(context);
// });
// }
// // Toast.show(, context)
// isOkey = false;
// }
// if (latitude == 0.0 && longitude == 0.0) {
// if (jalan == null || jalan == '') {
// isOkey = false;
// } else if (kecamatan == null || kecamatan == '') {
// isOkey = false;
// } else if (kelurahan == null || kelurahan == '') {
// isOkey = false;
// } else if (kota == null || kota == '') {
// isOkey = false;
// } else {
// isOkey = true;
// }
// }
}
if (!registerCheckBox) {
isOkey = false;
}
isOkeySignup = isOkey;
setState(() {});
}