|
|
|
|
@ -26,6 +26,7 @@ class CompleteProfilePage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
bool isChecked = false;
|
|
|
|
|
String? firstName = "", lastName = "", email = "", password = "", confirmPassword = "";
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -51,6 +52,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: "First Name",
|
|
|
|
|
value: firstName,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
firstName = v;
|
|
|
|
|
},
|
|
|
|
|
@ -58,6 +60,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: "Surname",
|
|
|
|
|
value: lastName,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
lastName = v;
|
|
|
|
|
},
|
|
|
|
|
@ -65,6 +68,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: "Email",
|
|
|
|
|
value: email,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
email = v;
|
|
|
|
|
},
|
|
|
|
|
@ -74,6 +78,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
hint: "Create Password",
|
|
|
|
|
isPasswordEnabled: true,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
value: password,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
password = v;
|
|
|
|
|
},
|
|
|
|
|
@ -83,6 +88,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
hint: "Confirm Password",
|
|
|
|
|
isPasswordEnabled: true,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
value: confirmPassword,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
confirmPassword = v;
|
|
|
|
|
},
|
|
|
|
|
@ -92,7 +98,12 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
// hint: "Phone Number",
|
|
|
|
|
// ),
|
|
|
|
|
50.height,
|
|
|
|
|
"By creating an account you agree to our Terms of Service and Privacy Policy".toText12(),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
buildCheckbox(),
|
|
|
|
|
"By creating an account you agree to our Terms of Service and\n Privacy Policy".toText12(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
ShowFillButton(
|
|
|
|
|
title: "Continue",
|
|
|
|
|
@ -107,23 +118,56 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildCheckbox() => Checkbox(
|
|
|
|
|
value: isChecked,
|
|
|
|
|
activeColor: Colors.blue,
|
|
|
|
|
onChanged: (value){
|
|
|
|
|
setState(() {
|
|
|
|
|
isChecked = value!;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Future<void> performCompleteProfile() async {
|
|
|
|
|
if (password == confirmPassword) {
|
|
|
|
|
print(widget.user.data!.userId??"userId");
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
RegisterUser user = await UserApiClent().basicComplete(widget.user.data?.userId ?? "", firstName!, lastName!, email!, password!);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
|
Utils.showToast( "Successfully Registered, Please login once");
|
|
|
|
|
pop(context);
|
|
|
|
|
// navigateReplaceWithName(context, AppRoutes.dashboard,arguments: user);
|
|
|
|
|
if (firstName != "") {
|
|
|
|
|
if (lastName != "") {
|
|
|
|
|
if (validateStructure(password ?? "")) {
|
|
|
|
|
if (password == confirmPassword) {
|
|
|
|
|
if (isChecked) {
|
|
|
|
|
print(widget.user.data!.userId ?? "userId");
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
RegisterUser user = await UserApiClent().basicComplete(widget.user.data?.userId ?? "", firstName!, lastName!, email!, password!);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
if (user.messageStatus == 1) {
|
|
|
|
|
Utils.showToast("Successfully Registered, Please login once");
|
|
|
|
|
pop(context);
|
|
|
|
|
// navigateReplaceWithName(context, AppRoutes.dashboard,arguments: user);
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(user.message ?? "");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
Utils.showToast("Please accept terms");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast("Please enter same password");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast(user.message ?? "");
|
|
|
|
|
Utils.showToast("Password Should contains Character, Number, Capital and small letters");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast("Please enter same password");
|
|
|
|
|
}else{
|
|
|
|
|
Utils.showToast("Surname is mandatory");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
Utils.showToast("First name is mandatory");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool validateStructure(String value){
|
|
|
|
|
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
|
|
|
|
|
RegExp regExp = new RegExp(pattern);
|
|
|
|
|
return regExp.hasMatch(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|