fix issues

fatima
Fatimah Alshammari 4 years ago
parent 8058231f43
commit 227f6df5a3

@ -80,6 +80,15 @@ class UserApiClent {
return await ApiClient().postJsonForResponse(ApiConsts.Login_V2_OTPVerify, postParams); return await ApiClient().postJsonForResponse(ApiConsts.Login_V2_OTPVerify, postParams);
} }
Future<Response> RefreshToken(String token, String refreshToken) async {
var postParams = {
"token": token,
"refreshToken": refreshToken
};
String t = AppState().getUser.data!.accessToken ?? "";
return await ApiClient().postJsonForResponse(ApiConsts.RefreshToken, postParams, token: t);
}
Future<Country> getAllCountries() async { Future<Country> getAllCountries() async {
var postParams = {}; var postParams = {};
return await ApiClient().getJsonForObject((json) => Country.fromJson(json), ApiConsts.GetAllCountry); return await ApiClient().getJsonForObject((json) => Country.fromJson(json), ApiConsts.GetAllCountry);

@ -5,6 +5,7 @@ class ApiConsts {
static String BasicOTP = baseUrlServices + "api/Register/BasicOTP"; static String BasicOTP = baseUrlServices + "api/Register/BasicOTP";
static String BasicVerify = baseUrlServices + "api/Register/BasicVerify"; static String BasicVerify = baseUrlServices + "api/Register/BasicVerify";
static String BasicComplete = baseUrlServices + "api/Register/BasicComplete"; static String BasicComplete = baseUrlServices + "api/Register/BasicComplete";
static String RefreshToken = baseUrlServices + "api/Account/RefreshToken";
//User //User

@ -16,7 +16,7 @@ class CodegenLoader extends AssetLoader{
static const Map<String,dynamic> ar_SA = { static const Map<String,dynamic> ar_SA = {
"firstTimeLogIn": "تسجيل الدخول لأول مره", "firstTimeLogIn": "تسجيل الدخول لأول مره",
"signUp": "تسجيل دخول", "signUp": "التسجيل",
"changeMobile": "تغيير رقم الجوال", "changeMobile": "تغيير رقم الجوال",
"notifications": "الاشعارات", "notifications": "الاشعارات",
"general": "عام", "general": "عام",
@ -26,6 +26,7 @@ class CodegenLoader extends AssetLoader{
"retrievePassword": "استرجاع كلمة المرور", "retrievePassword": "استرجاع كلمة المرور",
"changeEmail": "تغيير الايميل", "changeEmail": "تغيير الايميل",
"verify": "تحقق", "verify": "تحقق",
"verified": "تم التحقق",
"signOut": "تسجيل خروج", "signOut": "تسجيل خروج",
"enterEmail": "ادخل الايميل", "enterEmail": "ادخل الايميل",
"enterNewEmail": "ادخل ايميل جديد", "enterNewEmail": "ادخل ايميل جديد",
@ -81,6 +82,17 @@ class CodegenLoader extends AssetLoader{
"imageDeleted": "تم حذف الصوره", "imageDeleted": "تم حذف الصوره",
"dashboard": "الصفحه الرئيسيه", "dashboard": "الصفحه الرئيسيه",
"termsOfService": "من خلال إنشاء حساب فإنك توافق على شروط الخدمة و\n سياسة الخصوصية", "termsOfService": "من خلال إنشاء حساب فإنك توافق على شروط الخدمة و\n سياسة الخصوصية",
"userInformation": "معلومات المتسخدم",
"faceRecognition": "تحقق مع بصمة الوجه",
"fingerPrint": "تحقق مع بصمة الاصبع",
"whatsapp": "تحقق مع Whatsapp",
"SMS": "رسائل قصيره",
"selectRole": "حدد الدور",
"userRoleOrTitle": "عنوان المستخدم",
"codeSentToEmail": "تم ارسال الرمز للايميل",
"number": "موبايل",
"arabic": "عربي",
"english": "English",
"title": "Hello", "title": "Hello",
"msg": "Hello {} in the {} world ", "msg": "Hello {} in the {} world ",
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",
@ -130,6 +142,7 @@ static const Map<String,dynamic> en_US = {
"retrievePassword": "Retrieve Password", "retrievePassword": "Retrieve Password",
"changeEmail": "Change Email", "changeEmail": "Change Email",
"verify": "Verify", "verify": "Verify",
"verified": "Verified",
"signOut": "Sign Out", "signOut": "Sign Out",
"enterEmail": "Enter Email", "enterEmail": "Enter Email",
"enterNewEmail": "Enter New Email", "enterNewEmail": "Enter New Email",
@ -185,6 +198,16 @@ static const Map<String,dynamic> en_US = {
"imageDeleted": "Image is Deleted", "imageDeleted": "Image is Deleted",
"dashboard": "Dashboard/Main Page", "dashboard": "Dashboard/Main Page",
"termsOfService": "By creating an account you agree to our Terms of Service and\n Privacy Policy", "termsOfService": "By creating an account you agree to our Terms of Service and\n Privacy Policy",
"userInformation": "User Information",
"faceRecognition": "Face Recognition",
"fingerPrint": "Finger Print",
"whatsapp": "With Whatsapp",
"SMS": "With SMS",
"selectRole": "Select Role",
"userRoleOrTitle": "User role or title",
"codeSentToEmail": "Code is sent to email",
"number": "Number",
"english": "English",
"title": "Hello", "title": "Hello",
"msg": "Hello {} in the {} world ", "msg": "Hello {} in the {} world ",
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",

@ -21,7 +21,8 @@ Future<void> main() async {
Locale('en', 'US') Locale('en', 'US')
], ],
fallbackLocale: Locale('ar', 'SA'), fallbackLocale: Locale('en', 'US'),
startLocale: Locale('ar', 'SA'),
path: 'resources/langs', path: 'resources/langs',
child: MyApp(), child: MyApp(),
), ),

@ -1,12 +1,12 @@
// To parse this JSON data, do // To parse this JSON data, do
// //
// final user = userFromMap(jsonString); // final registerUser = registerUserFromJson(jsonString);
import 'dart:convert'; import 'dart:convert';
RegisterUser userFromMap(String str) => RegisterUser.fromJson(json.decode(str)); RegisterUser registerUserFromJson(String str) => RegisterUser.fromJson(json.decode(str));
String userToMap(RegisterUser data) => json.encode(data.toMap()); String registerUserToJson(RegisterUser data) => json.encode(data.toJson());
class RegisterUser { class RegisterUser {
RegisterUser({ RegisterUser({
@ -16,28 +16,56 @@ class RegisterUser {
this.message, this.message,
}); });
dynamic totalItemsCount; dynamic? totalItemsCount;
Data? data; Data? data;
int? messageStatus; int? messageStatus;
String? message; String? message;
factory RegisterUser.fromJson(Map<String, dynamic> json) => RegisterUser( factory RegisterUser.fromJson(Map<String, dynamic> json) => RegisterUser(
totalItemsCount: json["totalItemsCount"], totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : Data.fromMap(json["data"]), data: Data.fromJson(json["data"]),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], messageStatus: json["messageStatus"],
message: json["message"] == null ? null : json["message"], message: json["message"],
); );
Map<String, dynamic> toMap() => { Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount, "totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toMap(), "data": data!.toJson(),
"messageStatus": messageStatus == null ? null : messageStatus, "messageStatus": messageStatus,
"message": message == null ? null : message, "message": message,
}; };
} }
class Data { class Data {
Data({ Data({
this.accessToken,
this.refreshToken,
this.expiryDate,
this.userInfo,
});
String? accessToken;
String? refreshToken;
DateTime? expiryDate;
UserInfo? userInfo;
factory Data.fromJson(Map<String, dynamic> json) => Data(
accessToken: json["accessToken"],
refreshToken: json["refreshToken"],
expiryDate: DateTime.parse(json["expiryDate"]),
userInfo: UserInfo.fromJson(json["userInfo"]),
);
Map<String, dynamic> toJson() => {
"accessToken": accessToken,
"refreshToken": refreshToken,
"expiryDate": expiryDate!.toIso8601String(),
"userInfo": userInfo!.toJson(),
};
}
class UserInfo {
UserInfo({
this.id, this.id,
this.userId, this.userId,
this.firstName, this.firstName,
@ -52,66 +80,74 @@ class Data {
this.isVerified, this.isVerified,
this.userRoles, this.userRoles,
this.isCustomer, this.isCustomer,
this.isProvider, this.isProviderDealership,
this.isDealershipUser,
this.providerId, this.providerId,
this.customerId, this.customerId,
this.dealershipId,
}); });
int? id; int? id;
String? userId; String? userId;
dynamic? firstName; String? firstName;
dynamic? lastName; String? lastName;
String? mobileNo; String? mobileNo;
String? email; String? email;
dynamic? userImageUrl; String? userImageUrl;
int? roleId; int? roleId;
dynamic? roleName; String? roleName;
bool? isEmailVerified; bool? isEmailVerified;
List<dynamic>? serviceProviderBranch; List<dynamic>? serviceProviderBranch;
bool? isVerified; bool? isVerified;
List<dynamic>? userRoles; List<dynamic>? userRoles;
bool? isCustomer; bool? isCustomer;
bool? isProvider; bool? isProviderDealership;
bool? isDealershipUser;
dynamic? providerId; dynamic? providerId;
dynamic? customerId; int? customerId;
dynamic? dealershipId;
factory Data.fromMap(Map<String, dynamic> json) => Data( factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
id: json["id"] == null ? null : json["id"], id: json["id"],
userId: json["userID"] == null ? null : json["userID"], userId: json["userID"],
firstName: json["firstName"], firstName: json["firstName"],
lastName: json["lastName"], lastName: json["lastName"],
mobileNo: json["mobileNo"] == null ? null : json["mobileNo"], mobileNo: json["mobileNo"],
email: json["email"] == null ? null : json["email"], email: json["email"],
userImageUrl: json["userImageUrl"], userImageUrl: json["userImageUrl"],
roleId: json["roleID"] == null ? null : json["roleID"], roleId: json["roleID"],
roleName: json["roleName"], roleName: json["roleName"],
isEmailVerified: json["isEmailVerified"] == null ? null : json["isEmailVerified"], isEmailVerified: json["isEmailVerified"],
serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)), serviceProviderBranch: List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)),
isVerified: json["isVerified"] == null ? null : json["isVerified"], isVerified: json["isVerified"],
userRoles: json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x)), userRoles: List<dynamic>.from(json["userRoles"].map((x) => x)),
isCustomer: json["isCustomer"] == null ? null : json["isCustomer"], isCustomer: json["isCustomer"],
isProvider: json["isProvider"] == null ? null : json["isProvider"], isProviderDealership: json["isProviderDealership"],
providerId: json["providerID"], isDealershipUser: json["isDealershipUser"],
customerId: json["customerID"], providerId: json["providerID"],
); customerId: json["customerID"],
dealershipId: json["dealershipID"],
);
Map<String, dynamic> toMap() => { Map<String, dynamic> toJson() => {
"id": id == null ? null : id, "id": id,
"userID": userId == null ? null : userId, "userID": userId,
"firstName": firstName, "firstName": firstName,
"lastName": lastName, "lastName": lastName,
"mobileNo": mobileNo == null ? null : mobileNo, "mobileNo": mobileNo,
"email": email == null ? null : email, "email": email,
"userImageUrl": userImageUrl, "userImageUrl": userImageUrl,
"roleID": roleId == null ? null : roleId, "roleID": roleId,
"roleName": roleName, "roleName": roleName,
"isEmailVerified": isEmailVerified == null ? null : isEmailVerified, "isEmailVerified": isEmailVerified,
"serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x)), "serviceProviderBranch": List<dynamic>.from(serviceProviderBranch!.map((x) => x)),
"isVerified": isVerified == null ? null : isVerified, "isVerified": isVerified,
"userRoles": userRoles == null ? null : List<dynamic>.from(userRoles!.map((x) => x)), "userRoles": List<dynamic>.from(userRoles!.map((x) => x)),
"isCustomer": isCustomer == null ? null : isCustomer, "isCustomer": isCustomer,
"isProvider": isProvider == null ? null : isProvider, "isProviderDealership": isProviderDealership,
"providerID": providerId, "isDealershipUser": isDealershipUser,
"customerID": customerId, "providerID": providerId,
}; "customerID": customerId,
"dealershipID": dealershipId,
};
} }

@ -143,7 +143,7 @@ class _DashboardPageState extends State<DashboardPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
userName.toText24(), userName.toText24(),
"User role or title".toText12(), LocaleKeys.userRoleOrTitle.tr().toText12(),
], ],
), ),
), ),

@ -18,6 +18,7 @@ import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/widgets/txt_field.dart'; import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_password_strength/flutter_password_strength.dart';
class CompleteProfilePage extends StatefulWidget { class CompleteProfilePage extends StatefulWidget {
RegisterUser user; RegisterUser user;
@ -29,9 +30,15 @@ class CompleteProfilePage extends StatefulWidget {
} }
class _CompleteProfilePageState extends State<CompleteProfilePage> { class _CompleteProfilePageState extends State<CompleteProfilePage> {
String? firstName = "", lastName = "", email = "", password = "", confirmPassword = ""; String? firstName = "",
lastName = "",
email = "",
confirmPassword = "";
late String password = "";
bool isChecked = false; bool isChecked = false;
double _strength = 0;
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
@ -62,7 +69,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
), ),
12.height, 12.height,
TxtField( TxtField(
hint:LocaleKeys.surname.tr(), hint: LocaleKeys.surname.tr(),
value: lastName, value: lastName,
onChanged: (v) { onChanged: (v) {
lastName = v; lastName = v;
@ -72,7 +79,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
TxtField( TxtField(
hint: LocaleKeys.email.tr(), hint: LocaleKeys.email.tr(),
value: email, value: email,
// isButtonEnable: email!.length > 0 ? true : false, // isButtonEnable: email!.length > 0 ? true : false,
buttonTitle: LocaleKeys.verify.tr(), buttonTitle: LocaleKeys.verify.tr(),
onChanged: (v) { onChanged: (v) {
email = v; email = v;
@ -84,9 +91,29 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
isPasswordEnabled: true, isPasswordEnabled: true,
maxLines: 1, maxLines: 1,
value: password, value: password,
onChanged: (v) { onChanged: (value) => _checkPassword(value),
password = v; // onChanged: (v) {
}, // password = v;
// },
),
password!.isNotEmpty ? 12.height : 0.height,
// The strength indicator bar
password!.isNotEmpty ? LinearProgressIndicator(
value: _strength,
backgroundColor: Colors.grey[300],
color: _strength <= 1 / 4
? Colors.yellow
: _strength == 2 / 4
? Colors.orange
: _strength == 3 / 4
? Colors.deepOrange
: Colors.red,
minHeight: 4,
): Container(),
// The message about the strength of the entered password
Text(
_displayText,
style: const TextStyle(fontSize: 12),
), ),
12.height, 12.height,
TxtField( TxtField(
@ -125,7 +152,8 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
); );
} }
Widget buildCheckbox() => Checkbox( Widget buildCheckbox() =>
Checkbox(
value: isChecked, value: isChecked,
activeColor: Colors.blue, activeColor: Colors.blue,
onChanged: (value) { onChanged: (value) {
@ -162,13 +190,13 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
Future<void> performCompleteProfile() async { Future<void> performCompleteProfile() async {
if (validateStructure(password ?? "")) { if (validateStructure(password ?? "")) {
if (password == confirmPassword) { if (password == confirmPassword) {
print(widget.user.data!.userId ?? "userId"); print(widget.user.data!.userInfo!.userId ?? "userId");
Utils.showLoading(context); Utils.showLoading(context);
RegisterUser user = await UserApiClent().basicComplete(widget.user.data?.userId ?? "", firstName!, lastName!, email!, password!); RegisterUser user = await UserApiClent().basicComplete(widget.user.data?.userInfo!.userId ?? "", firstName!, lastName!, email!, password!);
Utils.hideLoading(context); Utils.hideLoading(context);
if (user.messageStatus == 1) { if (user.messageStatus == 1) {
Utils.showToast(LocaleKeys.successfullyRegistered.tr()); Utils.showToast(LocaleKeys.successfullyRegistered.tr());
//("Successfully Registered, Please login once"); //("Successfully Registered, Please login once");
pop(context); pop(context);
// navigateReplaceWithName(context, AppRoutes.dashboard,arguments: user); // navigateReplaceWithName(context, AppRoutes.dashboard,arguments: user);
} else { } else {
@ -176,11 +204,11 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
} }
} else { } else {
Utils.showToast(LocaleKeys.pleaseEnterSamePassword.tr()); Utils.showToast(LocaleKeys.pleaseEnterSamePassword.tr());
//("Please enter same password"); //("Please enter same password");
} }
} else { } else {
Utils.showToast(LocaleKeys.passwordShouldContains.tr()); Utils.showToast(LocaleKeys.passwordShouldContains.tr());
//("Password Should contains Character, Number, Capital and small letters"); //("Password Should contains Character, Number, Capital and small letters");
} }
} }
@ -190,6 +218,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
return regExp.hasMatch(value); return regExp.hasMatch(value);
} }
bool isEmail(String em) { bool isEmail(String em) {
String p = r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'; String p = r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
RegExp regExp = new RegExp(p); RegExp regExp = new RegExp(p);
@ -200,27 +229,59 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
bool isValid = true; bool isValid = true;
if (firstName!.isEmpty) { if (firstName!.isEmpty) {
Utils.showToast(LocaleKeys.firstNameMandatory.tr()); Utils.showToast(LocaleKeys.firstNameMandatory.tr());
//("First name is mandatory"); //("First name is mandatory");
isValid = false; isValid = false;
} else if (lastName!.isEmpty) { } else if (lastName!.isEmpty) {
Utils.showToast(LocaleKeys.surnameNameMandatory.tr()); Utils.showToast(LocaleKeys.surnameNameMandatory.tr());
//("Surname is mandatory"); //("Surname is mandatory");
isValid = false; isValid = false;
} else if (email!.isNotEmpty) { } else if (email!.isNotEmpty) {
if(!isEmail(email!)){ if (!isEmail(email!)) {
Utils.showToast(LocaleKeys.enterValidEmail.tr()); Utils.showToast(LocaleKeys.enterValidEmail.tr());
//("Enter Valid Email"); //("Enter Valid Email");
isValid = false; isValid = false;
} }
}else if (password!.isEmpty) { } else if (password!.isEmpty) {
Utils.showToast(LocaleKeys.passwordNameMandatory.tr()); Utils.showToast(LocaleKeys.passwordNameMandatory.tr());
//("Password is mandatory"); //("Password is mandatory");
isValid = false; isValid = false;
} else if (!isChecked) { } else if (!isChecked) {
Utils.showToast(LocaleKeys.pleaseAcceptTerms.tr()); Utils.showToast(LocaleKeys.pleaseAcceptTerms.tr());
//("Please accept terms"); //("Please accept terms");
isValid = false; isValid = false;
} }
return isValid; return isValid;
} }
RegExp numReg = RegExp(r".*[0-9].*");
RegExp letterReg = RegExp(r".*[A-Za-z].*");
String _displayText = '';
void _checkPassword(String value) {
password = value.trim();
if (password!.length <= 6) {
setState(() {
_strength = 1 / 4;
_displayText = 'Your password is too short';
});
} else if (password!.length < 8) {
setState(() {
_strength = 2 / 4;
_displayText = 'Your password is acceptable but not strong';
});
} else {
if (!letterReg.hasMatch(password!) || !numReg.hasMatch(password!)) {
setState(() {
_strength = 3 / 4;
_displayText = 'Your password is strong';
});
} else {
setState(() {
_strength = 1;
_displayText = 'Your password is very strong';
});
}
}
}
} }

@ -111,7 +111,7 @@ class _ConfirmNewPasswordPageState extends State<ConfirmNewPasswordPage> {
bool validation() { bool validation() {
bool isValid = true; bool isValid = true;
if (newPassword != confirmPassword) { if (newPassword != confirmPassword) {
Utils.showToast("Confirmation password does not match the entered password"); Utils.showToast(LocaleKeys.pleaseEnterSamePassword.tr());
isValid = false; isValid = false;
} }
return isValid; return isValid;

@ -79,7 +79,7 @@ class _EditAccountPageState extends State<EditAccountPage> {
), ),
LocaleKeys.changeEmail.tr().toText12(), LocaleKeys.changeEmail.tr().toText12(),
InkWell( InkWell(
child: ((AppState().getUser.data!.userInfo!.isEmailVerified ?? false) ? "Verified" : "Verify").toText12(), child: ((AppState().getUser.data!.userInfo!.isEmailVerified ?? false) ? LocaleKeys.verified.tr() : LocaleKeys.verify.tr()).toText12(),
onTap: (AppState().getUser.data!.userInfo!.isEmailVerified ?? false) onTap: (AppState().getUser.data!.userInfo!.isEmailVerified ?? false)
? null ? null
: () { : () {

@ -53,7 +53,7 @@ class _ForgetPasswordMethodPageState extends State<ForgetPasswordMethodPage> {
otpType = 1; otpType = 1;
forgetPasswordOTPMethod(context); forgetPasswordOTPMethod(context);
}, },
title: 'With SMS', title: LocaleKeys.SMS.tr(),
icon: icons + "ic_sms.png", icon: icons + "ic_sms.png",
), ),
), ),
@ -64,7 +64,7 @@ class _ForgetPasswordMethodPageState extends State<ForgetPasswordMethodPage> {
otpType = 1; otpType = 1;
forgetPasswordOTPMethod(context); forgetPasswordOTPMethod(context);
}, },
title: 'With Whatsapp', title: LocaleKeys.whatsapp.tr(),
icon: icons + "ic_whatsapp.png", icon: icons + "ic_whatsapp.png",
), ),
), ),

@ -124,7 +124,7 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
padding: const EdgeInsets.all(2.0), padding: const EdgeInsets.all(2.0),
child: DropdownField((DropValue value) { child: DropdownField((DropValue value) {
countryCode = value.subValue; countryCode = value.subValue;
}, list: dropList, hint: "Chose Country"), }, list: dropList, hint: LocaleKeys.selectCountryCode.tr()),
); );
} else { } else {
return Center( return Center(
@ -152,7 +152,7 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
Utils.hideLoading(context); Utils.hideLoading(context);
PasswordOTPRequest otpRequest = PasswordOTPRequest.fromJson(jsonDecode(response.body)); PasswordOTPRequest otpRequest = PasswordOTPRequest.fromJson(jsonDecode(response.body));
if (otpRequest.messageStatus == 1) { if (otpRequest.messageStatus == 1) {
Utils.showToast("Code is sent to email"); Utils.showToast(LocaleKeys.codeSentToEmail.tr());
showMDialog(context, child: OtpDialog( showMDialog(context, child: OtpDialog(
onClick: (String code) async { onClick: (String code) async {
pop(context); pop(context);

@ -49,7 +49,7 @@ class LoginMethodSelectionPage extends StatelessWidget {
onClick: () { onClick: () {
performBasicOtp(context); performBasicOtp(context);
}, },
title: 'Finger Print', title: LocaleKeys.fingerPrint.tr(),
icon: icons + "ic_fingerprint.png", icon: icons + "ic_fingerprint.png",
), ),
), ),
@ -59,7 +59,7 @@ class LoginMethodSelectionPage extends StatelessWidget {
onClick: () { onClick: () {
performBasicOtp(context); performBasicOtp(context);
}, },
title: 'Face Recognition ', title: LocaleKeys.faceRecognition.tr(),
icon: icons + "ic_face_id.png", icon: icons + "ic_face_id.png",
), ),
), ),
@ -73,7 +73,7 @@ class LoginMethodSelectionPage extends StatelessWidget {
onClick: () { onClick: () {
performBasicOtp(context); performBasicOtp(context);
}, },
title: 'With SMS', title: LocaleKeys.SMS.tr(),
icon: icons + "ic_sms.png", icon: icons + "ic_sms.png",
), ),
), ),
@ -84,7 +84,7 @@ class LoginMethodSelectionPage extends StatelessWidget {
// navigateWithName(context, AppRoutes.dashboard); // navigateWithName(context, AppRoutes.dashboard);
performBasicOtp(context); performBasicOtp(context);
}, },
title: 'With Whatsapp', title: LocaleKeys.whatsapp.tr(),
icon: icons + "ic_whatsapp.png", icon: icons + "ic_whatsapp.png",
), ),
), ),
@ -110,8 +110,10 @@ class LoginMethodSelectionPage extends StatelessWidget {
Response response2 = await UserApiClent().login_V2_OTPVerify(user.data!.userToken??"", code); Response response2 = await UserApiClent().login_V2_OTPVerify(user.data!.userToken??"", code);
Utils.hideLoading(context); Utils.hideLoading(context);
RegisterUser verifiedUser = RegisterUser.fromJson(jsonDecode(response2.body)); RegisterUser verifiedUser = RegisterUser.fromJson(jsonDecode(response2.body));
if (verifiedUser.messageStatus == 1) { if (verifiedUser.messageStatus == 1) {
Utils.showLoading(context);
Response res = await UserApiClent().RefreshToken(verifiedUser.data.toString()??"", verifiedUser.data.toString()??"");
Utils.hideLoading(context);
User user = User.fromJson(jsonDecode(response2.body)); User user = User.fromJson(jsonDecode(response2.body));
if(user.data!.userInfo!.roleId==4){ if(user.data!.userInfo!.roleId==4){

@ -104,7 +104,7 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
onClick: () { onClick: () {
performBasicOtp(context, userToken); performBasicOtp(context, userToken);
}, },
title: 'Finger Print', title: LocaleKeys.fingerPrint.tr(),
icon: icons + "ic_fingerprint.png", icon: icons + "ic_fingerprint.png",
), ),
), ),
@ -114,7 +114,7 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
onClick: () { onClick: () {
performBasicOtp(context, userToken); performBasicOtp(context, userToken);
}, },
title: 'Face Recognition', title: LocaleKeys.faceRecognition.tr(),
icon: icons + "ic_face_id.png", icon: icons + "ic_face_id.png",
), ),
), ),
@ -128,7 +128,7 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
onClick: () { onClick: () {
performBasicOtp(context, userToken); performBasicOtp(context, userToken);
}, },
title: 'With SMS', title: LocaleKeys.SMS.tr(),
icon: icons + "ic_sms.png", icon: icons + "ic_sms.png",
), ),
), ),
@ -138,7 +138,7 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
onClick: () { onClick: () {
performBasicOtp(context, userToken); performBasicOtp(context, userToken);
}, },
title: 'With Whatsapp', title: LocaleKeys.whatsapp.tr(),
icon: icons + "ic_whatsapp.png", icon: icons + "ic_whatsapp.png",
), ),
), ),

@ -69,7 +69,7 @@ class LoginVerifyAccountPage extends StatelessWidget {
// }, // },
// )); // ));
}, },
title: 'With SMS', title: LocaleKeys.SMS.tr(),
icon: icons + "ic_sms.png", icon: icons + "ic_sms.png",
), ),
), ),
@ -98,7 +98,7 @@ class LoginVerifyAccountPage extends StatelessWidget {
// }, // },
// )); // ));
}, },
title: 'With Whatsapp', title: LocaleKeys.whatsapp.tr(),
icon: icons + "ic_whatsapp.png", icon: icons + "ic_whatsapp.png",
), ),
), ),

@ -72,7 +72,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
}, },
), ),
50.height, 50.height,
(type == ClassType.NUMBER ? "Enter Phone" : "Enter Email").toText24(), (type == ClassType.NUMBER ? LocaleKeys.enterPhoneNumber.tr() : LocaleKeys.enterEmail.tr()).toText24(),
mFlex(1), mFlex(1),
Column( Column(
children: [ children: [
@ -80,7 +80,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
getCountry(), getCountry(),
6.height, 6.height,
TxtField( TxtField(
hint: type == ClassType.NUMBER ? "5********" : "Enter Email", hint: type == ClassType.NUMBER ? "5********" : LocaleKeys.enterEmail.tr(),
value: phoneNum, value: phoneNum,
onChanged: (v) { onChanged: (v) {
phoneNum = v; phoneNum = v;
@ -132,7 +132,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
padding: const EdgeInsets.all(2.0), padding: const EdgeInsets.all(2.0),
child: DropdownField((DropValue value) { child: DropdownField((DropValue value) {
countryCode = value.subValue; countryCode = value.subValue;
}, list: dropList, hint: "Chose Country"), }, list: dropList, hint: LocaleKeys.selectCountryCode.tr()),
); );
} else { } else {
return Center( return Center(

@ -66,7 +66,7 @@ class RegisterPage extends StatelessWidget {
return DropdownField((DropValue value) { return DropdownField((DropValue value) {
countryCode = value.subValue; countryCode = value.subValue;
countryId = value.id; countryId = value.id;
}, list: dropList, hint: "Select Country"); }, list: dropList, hint: LocaleKeys.selectCountryCode.tr());
} else { } else {
return CircularProgressIndicator(); return CircularProgressIndicator();
} }

@ -1,11 +1,13 @@
import 'dart:async'; import 'dart:async';
import 'package:car_customer_app/config/routes.dart'; import 'package:car_customer_app/config/routes.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/extensions/string_extensions.dart'; import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/generated/locale_keys.g.dart'; import 'package:car_customer_app/generated/locale_keys.g.dart';
import 'package:car_customer_app/utils/navigator.dart'; import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart'; import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart'; import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -28,6 +30,14 @@ class SplashPage extends StatelessWidget {
LocaleKeys.alreadySigned.tr().toText(fontSize: 18, isBold: true).onPress(() { LocaleKeys.alreadySigned.tr().toText(fontSize: 18, isBold: true).onPress(() {
navigateWithName(context, AppRoutes.loginVerification); navigateWithName(context, AppRoutes.loginVerification);
}), }),
35.height,
TextButton(
style: TextButton.styleFrom(
backgroundColor: Colors.white,
),
onPressed: () { },
child: Text( LocaleKeys.english.tr(), ),
),
mFlex(5), mFlex(5),
], ],
), ),

@ -76,7 +76,7 @@ class VerifyPasswordPage extends StatelessWidget {
}, },
)); ));
}, },
title: 'With SMS', title: LocaleKeys.SMS.tr(),
icon: icons + "ic_sms.png", icon: icons + "ic_sms.png",
), ),
), ),
@ -106,7 +106,7 @@ class VerifyPasswordPage extends StatelessWidget {
}, },
)); ));
}, },
title: 'With Whatsapp', title: LocaleKeys.whatsapp.tr(),
icon: icons + "ic_whatsapp.png", icon: icons + "ic_whatsapp.png",
), ),
), ),

@ -1,3 +1,5 @@
import 'package:car_customer_app/generated/locale_keys.g.dart';
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
enum ClassType { EMAIL, NUMBER } enum ClassType { EMAIL, NUMBER }
@ -32,7 +34,7 @@ class _LoginEmailTabState extends State<LoginEmailTab> {
color: type == ClassType.NUMBER ? Colors.blue : Colors.transparent, color: type == ClassType.NUMBER ? Colors.blue : Colors.transparent,
child: Center( child: Center(
child: Text( child: Text(
"Number", LocaleKeys.number.tr(),
style: TextStyle( style: TextStyle(
color: type == ClassType.NUMBER ? Colors.white : Colors.black, color: type == ClassType.NUMBER ? Colors.white : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -54,7 +56,7 @@ class _LoginEmailTabState extends State<LoginEmailTab> {
color: type == ClassType.EMAIL ? Colors.blue : Colors.transparent, color: type == ClassType.EMAIL ? Colors.blue : Colors.transparent,
child: Center( child: Center(
child: Text( child: Text(
"Email", LocaleKeys.email.tr(),
style: TextStyle( style: TextStyle(
color: type == ClassType.EMAIL ? Colors.white : Colors.black, color: type == ClassType.EMAIL ? Colors.white : Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

@ -123,6 +123,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_password_strength:
dependency: "direct main"
description:
name: flutter_password_strength
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:

@ -36,6 +36,7 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
image_picker: ^0.8.4+4 image_picker: ^0.8.4+4
easy_localization: ^3.0.0 easy_localization: ^3.0.0
flutter_password_strength: ^0.1.6
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -1,6 +1,6 @@
{ {
"firstTimeLogIn": "تسجيل الدخول لأول مره", "firstTimeLogIn": "تسجيل الدخول لأول مره",
"signUp": "تسجيل دخول", "signUp": "التسجيل",
"changeMobile": "تغيير رقم الجوال", "changeMobile": "تغيير رقم الجوال",
"notifications": "الاشعارات", "notifications": "الاشعارات",
"general": "عام", "general": "عام",
@ -10,6 +10,7 @@
"retrievePassword" : "استرجاع كلمة المرور", "retrievePassword" : "استرجاع كلمة المرور",
"changeEmail": "تغيير الايميل", "changeEmail": "تغيير الايميل",
"verify": "تحقق", "verify": "تحقق",
"verified": "تم التحقق",
"signOut": "تسجيل خروج", "signOut": "تسجيل خروج",
"enterEmail": "ادخل الايميل", "enterEmail": "ادخل الايميل",
"enterNewEmail": "ادخل ايميل جديد", "enterNewEmail": "ادخل ايميل جديد",
@ -65,6 +66,16 @@
"imageDeleted" : "تم حذف الصوره", "imageDeleted" : "تم حذف الصوره",
"dashboard" : "الصفحه الرئيسيه", "dashboard" : "الصفحه الرئيسيه",
"termsOfService":"من خلال إنشاء حساب فإنك توافق على شروط الخدمة و\n سياسة الخصوصية", "termsOfService":"من خلال إنشاء حساب فإنك توافق على شروط الخدمة و\n سياسة الخصوصية",
"userInformation": "معلومات المتسخدم",
"faceRecognition": "تحقق مع بصمة الوجه",
"fingerPrint" : "تحقق مع بصمة الاصبع",
"whatsapp": "تحقق مع Whatsapp",
"SMS": "رسائل قصيره",
"selectRole" : "حدد الدور",
"userRoleOrTitle" : "عنوان المستخدم",
"codeSentToEmail": "تم ارسال الرمز للايميل",
"number": "موبايل",
"english": "English",
"title": "Hello", "title": "Hello",
"msg": "Hello {} in the {} world ", "msg": "Hello {} in the {} world ",
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",

@ -10,6 +10,7 @@
"retrievePassword" : "Retrieve Password", "retrievePassword" : "Retrieve Password",
"changeEmail": "Change Email", "changeEmail": "Change Email",
"verify": "Verify", "verify": "Verify",
"verified": "Verified",
"signOut": "Sign Out", "signOut": "Sign Out",
"enterEmail": "Enter Email", "enterEmail": "Enter Email",
"enterNewEmail": "Enter New Email", "enterNewEmail": "Enter New Email",
@ -65,6 +66,16 @@
"imageDeleted" : "Image is Deleted", "imageDeleted" : "Image is Deleted",
"dashboard" : "Dashboard/Main Page", "dashboard" : "Dashboard/Main Page",
"termsOfService":"By creating an account you agree to our Terms of Service and\n Privacy Policy", "termsOfService":"By creating an account you agree to our Terms of Service and\n Privacy Policy",
"userInformation": "User Information",
"faceRecognition": "Face Recognition",
"fingerPrint" : "Finger Print",
"whatsapp": "With Whatsapp",
"SMS": "With SMS",
"selectRole" : "Select Role",
"userRoleOrTitle" : "User role or title",
"codeSentToEmail": "Code is sent to email",
"number": "Number",
"english": "عربي",
"title": "Hello", "title": "Hello",
"msg": "Hello {} in the {} world ", "msg": "Hello {} in the {} world ",
"msg_named": "{} are written in the {lang} language", "msg_named": "{} are written in the {lang} language",

Loading…
Cancel
Save