From 84b83b672d1f5e39d7b289f83b19c20e34d9141f Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 14 Apr 2022 13:07:11 +0300 Subject: [PATCH] fix issues --- lib/api/client/user_api_client.dart | 9 + lib/classes/consts.dart | 2 +- lib/generated/codegen_loader.g.dart | 31 +++- lib/main.dart | 3 +- lib/models/user/register_user.dart | 156 +++++++++++------- lib/pages/dashboard/dashboard_page.dart | 2 +- lib/pages/user/change_email_page.dart | 10 +- lib/pages/user/complete_profile_page.dart | 66 +++++++- lib/pages/user/edit_account_page.dart | 2 +- lib/pages/user/forget_password_page.dart | 4 +- .../user/login_method_selection_page.dart | 12 +- lib/pages/user/login_verification_page.dart | 8 +- lib/pages/user/login_verify_account_page.dart | 4 +- lib/pages/user/login_with_password_page.dart | 4 +- lib/pages/user/register_page.dart | 4 +- lib/pages/user/splash_page.dart | 10 ++ lib/pages/user/vertify_password_page.dart | 4 +- lib/widgets/tab/login_email_tab.dart | 6 +- resources/langs/ar-SA.json | 12 +- resources/langs/en-US.json | 14 +- 20 files changed, 260 insertions(+), 103 deletions(-) diff --git a/lib/api/client/user_api_client.dart b/lib/api/client/user_api_client.dart index abf1fc3..c1bb73e 100644 --- a/lib/api/client/user_api_client.dart +++ b/lib/api/client/user_api_client.dart @@ -79,6 +79,15 @@ class UserApiClent { return await ApiClient().postJsonForResponse(ApiConsts.Login_V2_OTPVerify, postParams); } + Future 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 getAllCountries() async { var postParams = {}; return await ApiClient().getJsonForObject((json) => Country.fromJson(json), ApiConsts.GetAllCountry); diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 16a90ca..73c7549 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -5,7 +5,7 @@ class ApiConsts { static String BasicOTP = baseUrlServices + "api/Register/BasicOTP"; static String BasicVerify = baseUrlServices + "api/Register/BasicVerify"; static String BasicComplete = baseUrlServices + "api/Register/BasicComplete"; - + static String RefreshToken = baseUrlServices + "api/Account/RefreshToken"; //User static String Login_V1 = baseUrlServices + "api/Account/Login_V1"; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index e22918e..1b7da82 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -16,7 +16,7 @@ class CodegenLoader extends AssetLoader{ static const Map ar_SA = { "firstTimeLogIn": "تسجيل الدخول لأول مره", - "signUp": "تسجيل دخول", + "signUp": "التسجيل", "changeMobile": "تغيير رقم الجوال", "notifications": "الاشعارات", "general": "عام", @@ -26,6 +26,7 @@ class CodegenLoader extends AssetLoader{ "retrievePassword": "استرجاع كلمة المرور", "changeEmail": "تغيير الايميل", "verify": "تحقق", + "verified": "تم التحقق", "signOut": "تسجيل خروج", "enterEmail": "ادخل الايميل", "enterNewEmail": "ادخل ايميل جديد", @@ -107,7 +108,17 @@ class CodegenLoader extends AssetLoader{ "completeProfile1": "اكمل الملف الشخصي 1/3", "completeProfile2": "اكمل الملف الشخصي 2/3", "completeProfile3": "اكمل الملف الشخصي 3/3", - "userInformation": "User Information", + "userInformation": "معلومات المتسخدم", + "faceRecognition": "تحقق مع بصمة الوجه", + "fingerPrint": "تحقق مع بصمة الاصبع", + "whatsapp": "تحقق مع Whatsapp", + "SMS": "رسائل قصيره", + "selectRole": "حدد الدور", + "userRoleOrTitle": "عنوان المستخدم", + "codeSentToEmail": "تم ارسال الرمز للايميل", + "number": "موبايل", + "arabic": "عربي", + "english": "English", "provider": "Provider", "title": "Hello", "msg": "Hello {} in the {} world ", @@ -158,6 +169,7 @@ static const Map en_US = { "retrievePassword": "Retrieve Password", "changeEmail": "Change Email", "verify": "Verify", + "verified": "Verified", "signOut": "Sign Out", "enterEmail": "Enter Email", "enterNewEmail": "Enter New Email", @@ -225,15 +237,15 @@ static const Map en_US = { "address": "Address", "branchDescription": "Branch Description", "branchName": "Branch Name", - "chooseCity": "Choose City", - "chooseCountry": "Choose Country", + "chooseCity": "Select City", + "chooseCountry": "Select Country", "selectAttachment": "Select Attachment", "somethingWrong": "Something went wrong", "documentsUploaded": "Documents uploaded successfully", "update": "Update", "termsOfService": "By creating an account you agree to our Terms of Service and\n Privacy Policy", "branchInfo": "Branch Info and Services", - "profileCompleted": "Profile Completed", + "profileCompleted": "Profile is Completed", "selectLocationMap": "Select Location Map", "licensesAndCertifications": "licenses & certifications", "completeProfile1": "Complete Profile 1/3", @@ -241,6 +253,15 @@ static const Map en_US = { "completeProfile3": "Complete Profile 3/3", "userInformation": "User Information", "provider": "Provider", + "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", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", diff --git a/lib/main.dart b/lib/main.dart index f84595c..b451b06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,7 +19,8 @@ Future main() async { Locale('en', 'US') ], - fallbackLocale: Locale('ar', 'SA'), + fallbackLocale: Locale('en', 'US'), + startLocale: Locale('ar', 'SA'), path: 'resources/langs', child: MyApp(), ), diff --git a/lib/models/user/register_user.dart b/lib/models/user/register_user.dart index fef636f..9edee72 100644 --- a/lib/models/user/register_user.dart +++ b/lib/models/user/register_user.dart @@ -1,12 +1,12 @@ // To parse this JSON data, do // -// final user = userFromMap(jsonString); +// final registerUser = registerUserFromJson(jsonString); 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 { RegisterUser({ @@ -16,28 +16,56 @@ class RegisterUser { this.message, }); - dynamic totalItemsCount; + dynamic? totalItemsCount; Data? data; int? messageStatus; String? message; factory RegisterUser.fromJson(Map json) => RegisterUser( - totalItemsCount: json["totalItemsCount"], - data: json["data"] == null ? null : Data.fromMap(json["data"]), - messageStatus: json["messageStatus"] == null ? null : json["messageStatus"], - message: json["message"] == null ? null : json["message"], - ); + totalItemsCount: json["totalItemsCount"], + data: Data.fromJson(json["data"]), + messageStatus: json["messageStatus"], + message: json["message"], + ); - Map toMap() => { - "totalItemsCount": totalItemsCount, - "data": data == null ? null : data!.toMap(), - "messageStatus": messageStatus == null ? null : messageStatus, - "message": message == null ? null : message, - }; + Map toJson() => { + "totalItemsCount": totalItemsCount, + "data": data!.toJson(), + "messageStatus": messageStatus, + "message": message, + }; } class Data { Data({ + this.accessToken, + this.refreshToken, + this.expiryDate, + this.userInfo, + }); + + String? accessToken; + String? refreshToken; + DateTime? expiryDate; + UserInfo? userInfo; + + factory Data.fromJson(Map json) => Data( + accessToken: json["accessToken"], + refreshToken: json["refreshToken"], + expiryDate: DateTime.parse(json["expiryDate"]), + userInfo: UserInfo.fromJson(json["userInfo"]), + ); + + Map toJson() => { + "accessToken": accessToken, + "refreshToken": refreshToken, + "expiryDate": expiryDate!.toIso8601String(), + "userInfo": userInfo!.toJson(), + }; +} + +class UserInfo { + UserInfo({ this.id, this.userId, this.firstName, @@ -52,66 +80,74 @@ class Data { this.isVerified, this.userRoles, this.isCustomer, - this.isProvider, + this.isProviderDealership, + this.isDealershipUser, this.providerId, this.customerId, + this.dealershipId, }); int? id; String? userId; - dynamic? firstName; - dynamic? lastName; + String? firstName; + String? lastName; String? mobileNo; String? email; - dynamic? userImageUrl; + String? userImageUrl; int? roleId; - dynamic? roleName; + String? roleName; bool? isEmailVerified; List? serviceProviderBranch; bool? isVerified; List? userRoles; bool? isCustomer; - bool? isProvider; + bool? isProviderDealership; + bool? isDealershipUser; dynamic? providerId; - dynamic? customerId; + int? customerId; + dynamic? dealershipId; - factory Data.fromMap(Map json) => Data( - id: json["id"] == null ? null : json["id"], - userId: json["userID"] == null ? null : json["userID"], - firstName: json["firstName"], - lastName: json["lastName"], - mobileNo: json["mobileNo"] == null ? null : json["mobileNo"], - email: json["email"] == null ? null : json["email"], - userImageUrl: json["userImageUrl"], - roleId: json["roleID"] == null ? null : json["roleID"], - roleName: json["roleName"], - isEmailVerified: json["isEmailVerified"] == null ? null : json["isEmailVerified"], - serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List.from(json["serviceProviderBranch"].map((x) => x)), - isVerified: json["isVerified"] == null ? null : json["isVerified"], - userRoles: json["userRoles"] == null ? null : List.from(json["userRoles"].map((x) => x)), - isCustomer: json["isCustomer"] == null ? null : json["isCustomer"], - isProvider: json["isProvider"] == null ? null : json["isProvider"], - providerId: json["providerID"], - customerId: json["customerID"], - ); + factory UserInfo.fromJson(Map json) => UserInfo( + id: json["id"], + userId: json["userID"], + firstName: json["firstName"], + lastName: json["lastName"], + mobileNo: json["mobileNo"], + email: json["email"], + userImageUrl: json["userImageUrl"], + roleId: json["roleID"], + roleName: json["roleName"], + isEmailVerified: json["isEmailVerified"], + serviceProviderBranch: List.from(json["serviceProviderBranch"].map((x) => x)), + isVerified: json["isVerified"], + userRoles: List.from(json["userRoles"].map((x) => x)), + isCustomer: json["isCustomer"], + isProviderDealership: json["isProviderDealership"], + isDealershipUser: json["isDealershipUser"], + providerId: json["providerID"], + customerId: json["customerID"], + dealershipId: json["dealershipID"], + ); - Map toMap() => { - "id": id == null ? null : id, - "userID": userId == null ? null : userId, - "firstName": firstName, - "lastName": lastName, - "mobileNo": mobileNo == null ? null : mobileNo, - "email": email == null ? null : email, - "userImageUrl": userImageUrl, - "roleID": roleId == null ? null : roleId, - "roleName": roleName, - "isEmailVerified": isEmailVerified == null ? null : isEmailVerified, - "serviceProviderBranch": serviceProviderBranch == null ? null : List.from(serviceProviderBranch!.map((x) => x)), - "isVerified": isVerified == null ? null : isVerified, - "userRoles": userRoles == null ? null : List.from(userRoles!.map((x) => x)), - "isCustomer": isCustomer == null ? null : isCustomer, - "isProvider": isProvider == null ? null : isProvider, - "providerID": providerId, - "customerID": customerId, - }; + Map toJson() => { + "id": id, + "userID": userId, + "firstName": firstName, + "lastName": lastName, + "mobileNo": mobileNo, + "email": email, + "userImageUrl": userImageUrl, + "roleID": roleId, + "roleName": roleName, + "isEmailVerified": isEmailVerified, + "serviceProviderBranch": List.from(serviceProviderBranch!.map((x) => x)), + "isVerified": isVerified, + "userRoles": List.from(userRoles!.map((x) => x)), + "isCustomer": isCustomer, + "isProviderDealership": isProviderDealership, + "isDealershipUser": isDealershipUser, + "providerID": providerId, + "customerID": customerId, + "dealershipID": dealershipId, + }; } diff --git a/lib/pages/dashboard/dashboard_page.dart b/lib/pages/dashboard/dashboard_page.dart index 7b1a0bc..2bd60dc 100644 --- a/lib/pages/dashboard/dashboard_page.dart +++ b/lib/pages/dashboard/dashboard_page.dart @@ -126,7 +126,7 @@ class _DashboardPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ userName.toText24(), - "User role or title".toText12(), + LocaleKeys.userRoleOrTitle.tr().toText12(), ], ), ), diff --git a/lib/pages/user/change_email_page.dart b/lib/pages/user/change_email_page.dart index 8a381c4..67514f2 100644 --- a/lib/pages/user/change_email_page.dart +++ b/lib/pages/user/change_email_page.dart @@ -32,7 +32,7 @@ class _ChangeEmailPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: appBar(title: "Change Email"), + appBar: appBar(title: LocaleKeys.changeEmail.tr()), body: SingleChildScrollView( child: Container( // width: double.infinity, @@ -40,11 +40,11 @@ class _ChangeEmailPageState extends State { padding: EdgeInsets.all(40), child: Column( children: [ - "Enter Email".toText24(), + LocaleKeys.enterEmail.tr().toText24(), 12.height, TextFormField( decoration: InputDecoration( - hintText: "Enter New Email", + hintText: LocaleKeys.enterNewEmail.tr(), hintStyle: TextStyle(color: Colors.grey), border: OutlineInputBorder( borderRadius: const BorderRadius.all( @@ -58,7 +58,7 @@ class _ChangeEmailPageState extends State { 12.height, TextFormField( decoration: InputDecoration( - hintText: "Enter Current Password", + hintText: LocaleKeys.enterCurrentPassword.tr(), hintStyle: TextStyle(color: Colors.grey), border: OutlineInputBorder( borderRadius: const BorderRadius.all( @@ -71,7 +71,7 @@ class _ChangeEmailPageState extends State { ), 40.height, ShowFillButton( - title: "Confirm", + title: LocaleKeys.confirm.tr(), width: double.infinity, onPressed: () { changeEmail(context); diff --git a/lib/pages/user/complete_profile_page.dart b/lib/pages/user/complete_profile_page.dart index 7885e35..321298d 100644 --- a/lib/pages/user/complete_profile_page.dart +++ b/lib/pages/user/complete_profile_page.dart @@ -29,8 +29,10 @@ class CompleteProfilePage extends StatefulWidget { } class _CompleteProfilePageState extends State { - String? firstName = "", lastName = "", email = "", password = "", confirmPassword = ""; + String? firstName = "", lastName = "", email = "", confirmPassword = ""; bool isChecked = false; + late String password = ""; + double _strength = 0; @override void initState() { @@ -84,9 +86,29 @@ class _CompleteProfilePageState extends State { isPasswordEnabled: true, maxLines: 1, value: password, - onChanged: (v) { - password = v; - }, + onChanged: (value) => _checkPassword(value), + // 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, TxtField( @@ -162,9 +184,9 @@ class _CompleteProfilePageState extends State { Future performCompleteProfile() async { if (validateStructure(password ?? "")) { if (password == confirmPassword) { - print(widget.user.data!.userId ?? "userId"); + print(widget.user.data!.userInfo!.userId ?? "userId"); 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); if (user.messageStatus == 1) { Utils.showToast(LocaleKeys.successfullyRegistered.tr(),); @@ -224,4 +246,36 @@ class _CompleteProfilePageState extends State { 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'; + }); + } + } + } + } diff --git a/lib/pages/user/edit_account_page.dart b/lib/pages/user/edit_account_page.dart index dee4c29..d9b2633 100644 --- a/lib/pages/user/edit_account_page.dart +++ b/lib/pages/user/edit_account_page.dart @@ -76,7 +76,7 @@ class _EditAccountPageState extends State { Icon(Icons.email, color: Colors.blue,), LocaleKeys.changeEmail.tr().toText12(), 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) ? null diff --git a/lib/pages/user/forget_password_page.dart b/lib/pages/user/forget_password_page.dart index 4e59ecf..3a679e6 100644 --- a/lib/pages/user/forget_password_page.dart +++ b/lib/pages/user/forget_password_page.dart @@ -125,7 +125,7 @@ class _ForgetPasswordPageState extends State { padding: const EdgeInsets.all(2.0), child: DropdownField((DropValue value) { countryCode = value.subValue; - }, list: dropList, hint: "Chose Country"), + }, list: dropList, hint: LocaleKeys.chooseCountry.tr()), ); } else { return Center( @@ -153,7 +153,7 @@ class _ForgetPasswordPageState extends State { Utils.hideLoading(context); PasswordOTPRequest otpRequest = PasswordOTPRequest.fromJson(jsonDecode(response.body)); if (otpRequest.messageStatus == 1) { - Utils.showToast("Code is sent to email"); + Utils.showToast(LocaleKeys.codeSentToEmail.tr()); showMDialog(context, child: OtpDialog( onClick: (String code) async { pop(context); diff --git a/lib/pages/user/login_method_selection_page.dart b/lib/pages/user/login_method_selection_page.dart index cc4d6b5..8848ff2 100644 --- a/lib/pages/user/login_method_selection_page.dart +++ b/lib/pages/user/login_method_selection_page.dart @@ -49,7 +49,7 @@ class LoginMethodSelectionPage extends StatelessWidget { onClick: () { performBasicOtp(context); }, - title: 'Finger Print', + title: LocaleKeys.fingerPrint.tr(), icon: icons + "ic_fingerprint.png", ), ), @@ -59,7 +59,7 @@ class LoginMethodSelectionPage extends StatelessWidget { onClick: () { performBasicOtp(context); }, - title: 'Face Recognition', + title: LocaleKeys.faceRecognition.tr(), icon: icons + "ic_face_id.png", ), ), @@ -73,7 +73,7 @@ class LoginMethodSelectionPage extends StatelessWidget { onClick: () { performBasicOtp(context); }, - title: 'With SMS', + title: LocaleKeys.SMS.tr(), icon: icons + "ic_sms.png", ), ), @@ -84,7 +84,7 @@ class LoginMethodSelectionPage extends StatelessWidget { // navigateWithName(context, AppRoutes.dashboard); performBasicOtp(context); }, - title: 'With Whatsapp', + title: LocaleKeys.whatsapp.tr(), icon: icons + "ic_whatsapp.png", ), ), @@ -111,6 +111,10 @@ class LoginMethodSelectionPage extends StatelessWidget { Utils.hideLoading(context); RegisterUser verifiedUser = RegisterUser.fromJson(jsonDecode(response2.body)); 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)); AppState().setUser = user; SharedPrefManager.setUserToken(user.data!.accessToken ?? ""); diff --git a/lib/pages/user/login_verification_page.dart b/lib/pages/user/login_verification_page.dart index 389f203..36e231b 100644 --- a/lib/pages/user/login_verification_page.dart +++ b/lib/pages/user/login_verification_page.dart @@ -104,7 +104,7 @@ class _LoginVerificationPageState extends State { onClick: () { performBasicOtp(context, userToken); }, - title: 'Finger Print', + title: LocaleKeys.fingerPrint.tr(), icon: icons + "ic_fingerprint.png", ), ), @@ -114,7 +114,7 @@ class _LoginVerificationPageState extends State { onClick: () { performBasicOtp(context, userToken); }, - title: 'Face Recognition', + title: LocaleKeys.faceRecognition.tr(), icon: icons + "ic_face_id.png", ), ), @@ -128,7 +128,7 @@ class _LoginVerificationPageState extends State { onClick: () { performBasicOtp(context, userToken); }, - title: 'With SMS', + title: LocaleKeys.SMS.tr(), icon: icons + "ic_sms.png", ), ), @@ -138,7 +138,7 @@ class _LoginVerificationPageState extends State { onClick: () { performBasicOtp(context, userToken); }, - title: 'With Whatsapp', + title:LocaleKeys.whatsapp.tr(), icon: icons + "ic_whatsapp.png", ), ), diff --git a/lib/pages/user/login_verify_account_page.dart b/lib/pages/user/login_verify_account_page.dart index b99203a..06d61c3 100644 --- a/lib/pages/user/login_verify_account_page.dart +++ b/lib/pages/user/login_verify_account_page.dart @@ -69,7 +69,7 @@ class LoginVerifyAccountPage extends StatelessWidget { // }, // )); }, - title: 'With SMS', + title: LocaleKeys.SMS.tr(), 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", ), ), diff --git a/lib/pages/user/login_with_password_page.dart b/lib/pages/user/login_with_password_page.dart index 5ea3274..672e152 100644 --- a/lib/pages/user/login_with_password_page.dart +++ b/lib/pages/user/login_with_password_page.dart @@ -58,12 +58,12 @@ class _LoginWithPasswordState extends State { }, ), 50.height, - (type == ClassType.NUMBER ? "Enter Phone" : "Enter Email").toText24(), + (type == ClassType.NUMBER ? LocaleKeys.enterPhoneNumber.tr() : LocaleKeys.enterEmail.tr()).toText24(), mFlex(1), Column( children: [ TxtField( - hint: type == ClassType.NUMBER ? "Enter phone number" : "Enter Email", + hint: type == ClassType.NUMBER ? LocaleKeys.enterPhoneNumber.tr() : LocaleKeys.enterEmail.tr(), value: phoneNum, onChanged: (v) { phoneNum = v; diff --git a/lib/pages/user/register_page.dart b/lib/pages/user/register_page.dart index d3c6af6..d5626f7 100644 --- a/lib/pages/user/register_page.dart +++ b/lib/pages/user/register_page.dart @@ -48,7 +48,7 @@ class RegisterPage extends StatelessWidget { }); return DropdownField((DropValue value) { role = value.id; - }, list: dropList, hint: "Select Role"); + }, list: dropList, hint: LocaleKeys.selectRole.tr()); } else { return CircularProgressIndicator(); } @@ -66,7 +66,7 @@ class RegisterPage extends StatelessWidget { return DropdownField((DropValue value) { countryCode = value.subValue; countryId = value.id; - }, list: dropList, hint: "Select Country"); + }, list: dropList, hint: LocaleKeys.chooseCountry.tr()); } else { return CircularProgressIndicator(); } diff --git a/lib/pages/user/splash_page.dart b/lib/pages/user/splash_page.dart index 3dc39f7..06658ba 100644 --- a/lib/pages/user/splash_page.dart +++ b/lib/pages/user/splash_page.dart @@ -1,11 +1,13 @@ import 'dart:async'; import 'package:car_provider_app/config/routes.dart'; +import 'package:car_provider_app/extensions/int_extensions.dart'; import 'package:car_provider_app/extensions/string_extensions.dart'; import 'package:car_provider_app/generated/locale_keys.g.dart'; import 'package:car_provider_app/utils/navigator.dart'; import 'package:car_provider_app/utils/utils.dart'; import 'package:car_provider_app/extensions/widget_extensions.dart'; +import 'package:car_provider_app/widgets/show_fill_button.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; @@ -28,6 +30,14 @@ class SplashPage extends StatelessWidget { LocaleKeys.alreadySigned.tr().toText(fontSize: 18, isBold: true).onPress(() { navigateWithName(context, AppRoutes.loginVerification); }), + 35.height, + TextButton( + style: TextButton.styleFrom( + backgroundColor: Colors.white, + ), + onPressed: () { }, + child: Text( LocaleKeys.english.tr(), ), + ), mFlex(5), ], ), diff --git a/lib/pages/user/vertify_password_page.dart b/lib/pages/user/vertify_password_page.dart index 9f72965..6ea2030 100644 --- a/lib/pages/user/vertify_password_page.dart +++ b/lib/pages/user/vertify_password_page.dart @@ -76,7 +76,7 @@ class VerifyPasswordPage extends StatelessWidget { }, )); }, - title: 'With SMS', + title: LocaleKeys.SMS.tr(), icon: icons + "ic_sms.png", ), ), @@ -105,7 +105,7 @@ class VerifyPasswordPage extends StatelessWidget { }, )); }, - title: 'With Whatsapp', + title: LocaleKeys.whatsapp.tr(), icon: icons + "ic_whatsapp.png", ), ), diff --git a/lib/widgets/tab/login_email_tab.dart b/lib/widgets/tab/login_email_tab.dart index 7c29b63..fab1bb2 100644 --- a/lib/widgets/tab/login_email_tab.dart +++ b/lib/widgets/tab/login_email_tab.dart @@ -1,3 +1,5 @@ +import 'package:car_provider_app/generated/locale_keys.g.dart'; +import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; enum ClassType { EMAIL, NUMBER } @@ -32,7 +34,7 @@ class _LoginEmailTabState extends State { color: type == ClassType.NUMBER ? Colors.blue : Colors.transparent, child: Center( child: Text( - "Number", + LocaleKeys.number.tr(), style: TextStyle( color: type == ClassType.NUMBER ? Colors.white : Colors.black, fontWeight: FontWeight.bold, @@ -54,7 +56,7 @@ class _LoginEmailTabState extends State { color: type == ClassType.EMAIL ? Colors.blue : Colors.transparent, child: Center( child: Text( - "Email", + LocaleKeys.email.tr(), style: TextStyle( color: type == ClassType.EMAIL ? Colors.white : Colors.black, fontWeight: FontWeight.bold, diff --git a/resources/langs/ar-SA.json b/resources/langs/ar-SA.json index 1931ef9..9373c83 100644 --- a/resources/langs/ar-SA.json +++ b/resources/langs/ar-SA.json @@ -1,6 +1,6 @@ { "firstTimeLogIn": "تسجيل الدخول لأول مره", - "signUp": "تسجيل دخول", + "signUp": "التسجيل", "changeMobile": "تغيير رقم الجوال", "notifications": "الاشعارات", "general": "عام", @@ -10,6 +10,7 @@ "retrievePassword" : "استرجاع كلمة المرور", "changeEmail": "تغيير الايميل", "verify": "تحقق", + "verified": "تم التحقق", "signOut": "تسجيل خروج", "enterEmail": "ادخل الايميل", "enterNewEmail": "ادخل ايميل جديد", @@ -92,6 +93,15 @@ "completeProfile2" : "اكمل الملف الشخصي 2/3", "completeProfile3" : "اكمل الملف الشخصي 3/3", "userInformation": "معلومات المتسخدم", + "faceRecognition": "تحقق مع بصمة الوجه", + "fingerPrint" : "تحقق مع بصمة الاصبع", + "whatsapp": "تحقق مع Whatsapp", + "SMS": "رسائل قصيره", + "selectRole" : "حدد الدور", + "userRoleOrTitle" : "عنوان المستخدم", + "codeSentToEmail": "تم ارسال الرمز للايميل", + "number": "موبايل", + "english": "English", "provider": "Provider", "title": "Hello", "msg": "Hello {} in the {} world ", diff --git a/resources/langs/en-US.json b/resources/langs/en-US.json index 780b026..ae9a7b3 100644 --- a/resources/langs/en-US.json +++ b/resources/langs/en-US.json @@ -10,6 +10,7 @@ "retrievePassword" : "Retrieve Password", "changeEmail": "Change Email", "verify": "Verify", + "verified": "Verified", "signOut": "Sign Out", "enterEmail": "Enter Email", "enterNewEmail": "Enter New Email", @@ -77,8 +78,8 @@ "address": "Address", "branchDescription": "Branch Description", "branchName": "Branch Name", - "chooseCity": "Choose City", - "chooseCountry": "Choose Country", + "chooseCity": "Select City", + "chooseCountry": "Select Country", "selectAttachment":"Select Attachment", "somethingWrong" : "Something went wrong", "documentsUploaded" : "Documents uploaded successfully", @@ -93,6 +94,15 @@ "completeProfile3" : "Complete Profile 3/3", "userInformation": "User Information", "provider": "Provider", + "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", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language",