diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index eabd50fc..f483a042 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -113,4 +113,48 @@ const Map> localizedValues = { 'description': {'en': 'Description', 'ar': 'الوصف'}, 'value': {'en': 'Value', 'ar': 'القيمة'}, 'range': {'en': 'range', 'ar': 'النطاق'}, + 'enterId': {'en': 'Enter ID', 'ar': 'الهوية'}, + 'pleaseEnterYourID': { + 'en': 'Please enter your ID', + 'ar': 'الرجاء ادخال الهوية' + }, + 'enterPassword': {'en': 'Enter Password', 'ar': 'الرقم السري'}, + 'pleaseEnterPassword': { + 'en': 'Please Enter Password', + 'ar': 'الرجاء ادخال الرقم السري' + }, + 'selectYourProject': {'en': 'Select Your Project', 'ar': 'اختر المستشفى'}, + 'pleaseEnterYourProject': { + 'en': 'Please Enter Your Project', + 'ar': 'الرجاء ادخال مستشفى' + }, + 'login': {'en': 'LOGIN', 'ar': 'تسجيل دخول'}, + 'drSulaimanAlHabib': {'en': 'Dr Sulaiman Al Habib', 'ar': 'د.سليمان الحبيب'}, + 'welcomeTo': {'en': 'Welcome to', 'ar': 'مرحبا بك'}, + 'welcomeBackTo': {'en': 'Welcome Back to', 'ar': 'مرحبًا بعودتك الى '}, + 'home': {'en': 'Home', 'ar': 'الرئيسية'}, + 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, + 'sms': {'en': 'SMS', 'ar': 'رسالة قصيرة'}, + 'fingerprint': {'en': 'Fingerprint', 'ar': 'بصمة'}, + 'faceId': {'en': 'Face ID', 'ar': 'معرف الوجه'}, + 'whatsApp': {'en': 'WhatsApp', 'ar': 'واتس اب'}, + 'pleaseChoose': { + 'en': 'Please choose one of the Following option to verify', + 'ar': 'يرجى اختيار أحد الخيارات التالية للتحقق' + }, + 'choose': {'en': 'Choose', 'ar': 'اختر'}, + 'verification': {'en': 'Verification', 'ar': 'طريقة التحقق'}, + 'firstStep': { + 'en': 'As a first step, you need to verify by one of those methods', + 'ar': 'كخطوة أولى ، تحتاج إلى التحقق بإحدى هذه الطرق' + }, + 'yourAccount!': {'en': 'Your Account!', 'ar': 'حسابك!'}, + 'verify1': {'en': 'Verify', 'ar': 'ثبت'}, + 'youWillReceiveA': {'en': 'You will receive a', 'ar': 'سوف تتلقى '}, + 'loginCode': {'en': 'Login Code', 'ar': 'رمز تسجيل دخول'}, + 'smsBy': {'en': 'By SMS', 'ar': 'عن طريق رسالة قصيرة'}, + 'pleaseEnterTheCode': { + 'en': 'Please enter the code', + 'ar': 'الرجاء ادخال الرمز' + }, }; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 174a38ab..1f192f49 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -8,7 +8,7 @@ import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; - +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; class LandingPage extends StatefulWidget { @override @@ -39,7 +39,8 @@ class _LandingPageState extends State { elevation: 0, backgroundColor: Hexcolor('#515B5D'), textTheme: TextTheme( - headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), title: Text(getText(currentTab).toUpperCase()), leading: Builder( builder: (BuildContext context) { @@ -51,7 +52,6 @@ class _LandingPageState extends State { }, ), centerTitle: true, - ), drawer: Theme( data: Theme.of(context).copyWith( @@ -71,21 +71,19 @@ class _LandingPageState extends State { ], ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), - ); } getText(currentTab) { switch (currentTab) { case 0: - return "HOME"; + return TranslationBase.of(context).home; case 1: - return "REPLAY"; + return TranslationBase.of(context).replay; case 2: - return "SCHEDULE"; + return TranslationBase.of(context).mySchedule; case 3: - return 'SERVICES'; - + return TranslationBase.of(context).services; } } -} \ No newline at end of file +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index f99d615a..c1544b97 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -141,6 +141,44 @@ class TranslationBase { String get description => localizedValues['description'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode]; + String get enterId => localizedValues['enterId'][locale.languageCode]; + String get pleaseEnterYourID => + localizedValues['pleaseEnterYourID'][locale.languageCode]; + String get enterPassword => + localizedValues['enterPassword'][locale.languageCode]; + String get pleaseEnterPassword => + localizedValues['pleaseEnterPassword'][locale.languageCode]; + String get selectYourProject => + localizedValues['selectYourProject'][locale.languageCode]; + String get pleaseEnterYourProject => + localizedValues['pleaseEnterYourProject'][locale.languageCode]; + String get login => localizedValues['login'][locale.languageCode]; + String get drSulaimanAlHabib => + localizedValues['drSulaimanAlHabib'][locale.languageCode]; + String get welcomeTo => localizedValues['welcomeTo'][locale.languageCode]; + String get welcomeBackTo => + localizedValues['welcomeBackTo'][locale.languageCode]; + String get home => localizedValues['home'][locale.languageCode]; + String get services => localizedValues['services'][locale.languageCode]; + String get sms => localizedValues['sms'][locale.languageCode]; + String get fingerprint => localizedValues['fingerprint'][locale.languageCode]; + String get faceId => localizedValues['faceId'][locale.languageCode]; + String get whatsApp => localizedValues['whatsApp'][locale.languageCode]; + String get pleaseChoose => + localizedValues['pleaseChoose'][locale.languageCode]; + String get choose => localizedValues['choose'][locale.languageCode]; + String get verification => + localizedValues['verification'][locale.languageCode]; + String get firstStep => localizedValues['firstStep'][locale.languageCode]; + String get yourAccount => + localizedValues['yourAccount!'][locale.languageCode]; + String get verify1 => localizedValues['verify1'][locale.languageCode]; + String get youWillReceiveA => + localizedValues['youWillReceiveA'][locale.languageCode]; + String get loginCode => localizedValues['loginCode'][locale.languageCode]; + String get smsBy => localizedValues['smsBy'][locale.languageCode]; + String get pleaseEnterTheCode => + localizedValues['pleaseEnterTheCode'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart index d9cf7f53..e577d8b1 100644 --- a/lib/widgets/auth/auth_header.dart +++ b/lib/widgets/auth/auth_header.dart @@ -4,6 +4,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../config/size_config.dart'; import '../../lookups/auth_lookup.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; class AuthHeader extends StatelessWidget { var userType; @@ -24,7 +25,8 @@ class AuthHeader extends StatelessWidget { children: [ Container( margin: SizeConfig.isMobile - ? EdgeInsetsDirectional.fromSTEB(0, SizeConfig.realScreenHeight*0.03, 0, 0) + ? EdgeInsetsDirectional.fromSTEB( + 0, SizeConfig.realScreenHeight * 0.03, 0, 0) : EdgeInsetsDirectional.fromSTEB( SizeConfig.realScreenWidth * 0.13, 0, 0, 0), child: buildImageLogo(), @@ -42,7 +44,7 @@ class AuthHeader extends StatelessWidget { SizedBox( height: 10, ), - buildWelText(), + buildWelText(context), buildDrSulText(context), ] : [ @@ -52,7 +54,7 @@ class AuthHeader extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - buildWelText(), + buildWelText(context), buildDrSulText(context), ], ), @@ -88,7 +90,7 @@ class AuthHeader extends StatelessWidget { EdgeInsetsDirectional containerMargin; if (userType == loginType.knownUser || userType == loginType.unknownUser) { finalWid = Text( - "LOGIN", + TranslationBase.of(context).login, style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), ); } else { @@ -99,12 +101,12 @@ class AuthHeader extends StatelessWidget { text2 = 'Password!'; } if (userType == loginType.verifyPassword) { - text1 = 'Verify '; - text2 = 'Your Account!'; + text1 = TranslationBase.of(context).verify1; + text2 = TranslationBase.of(context).yourAccount; } if (userType == loginType.verificationMethods) { - text1 = 'Choose '; - text2 = 'Verification'; + text1 = TranslationBase.of(context).choose; + text2 = TranslationBase.of(context).verification; } List childrens = [ Text( @@ -159,7 +161,8 @@ class AuthHeader extends StatelessWidget { child: Text( "Doctor App", style: TextStyle( - fontSize: SizeConfig.isMobile ? 26 : SizeConfig.realScreenWidth * 0.030, + fontSize: + SizeConfig.isMobile ? 26 : SizeConfig.realScreenWidth * 0.030, fontWeight: FontWeight.w800, color: Hexcolor('#B8382C')), ), @@ -173,7 +176,7 @@ class AuthHeader extends StatelessWidget { return Text(''); } return Text( - 'Dr Sulaiman Al Habib', + TranslationBase.of(context).drSulaimanAlHabib, style: TextStyle( fontWeight: FontWeight.w800, fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029, @@ -182,10 +185,10 @@ class AuthHeader extends StatelessWidget { ); } - Widget buildWelText() { - String text = 'Welcome to '; + Widget buildWelText(BuildContext context) { + String text = TranslationBase.of(context).welcomeTo; if (userType == loginType.unknownUser) { - text = 'Welcome Back to '; + text = TranslationBase.of(context).welcomeBackTo; } if (userType == loginType.changePassword || userType == loginType.verifyPassword || @@ -195,7 +198,8 @@ class AuthHeader extends StatelessWidget { return Text( text, style: TextStyle( - fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029), + fontSize: + SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029), ); } } diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 6e6b306d..b575ba98 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -16,6 +16,7 @@ import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_toast_msg.dart'; import '../../util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); DrAppToastMsg toastMsg = DrAppToastMsg(); @@ -60,17 +61,16 @@ class _LoginFormState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - authProv = Provider.of(context); + authProv = Provider.of(context); if (_isInit) { - if (projectsList.length == 0) { - getProjectsList(); - } + if (projectsList.length == 0) { + getProjectsList(); + } } _isInit = false; } - @override Widget build(BuildContext context) { return Form( @@ -85,10 +85,12 @@ class _LoginFormState extends State { keyboardType: TextInputType.number, textInputAction: TextInputAction.next, decoration: buildInputDecoration( - context, 'Enter ID', 'assets/images/user_id_icon.png'), + context, + TranslationBase.of(context).enterId, + 'assets/images/user_id_icon.png'), validator: (value) { if (value.isEmpty) { - return 'Please enter your ID'; + return TranslationBase.of(context).pleaseEnterYourID; } return null; }, @@ -106,10 +108,12 @@ class _LoginFormState extends State { obscureText: true, textInputAction: TextInputAction.next, decoration: buildInputDecoration( - context, 'Enter Password', 'assets/images/password_icon.png'), + context, + TranslationBase.of(context).enterPassword, + 'assets/images/password_icon.png'), validator: (value) { if (value.isEmpty) { - return 'Please enter your Password'; + return TranslationBase.of(context).pleaseEnterPassword; } return null; }, @@ -132,11 +136,13 @@ class _LoginFormState extends State { }, showCursor: false, readOnly: true, - decoration: buildInputDecoration(context, 'Select your porject', + decoration: buildInputDecoration( + context, + TranslationBase.of(context).selectYourProject, 'assets/images/password_icon.png'), validator: (value) { if (value.isEmpty) { - return 'Please enter your porject'; + return TranslationBase.of(context).pleaseEnterYourProject; } return null; }), @@ -157,11 +163,11 @@ class _LoginFormState extends State { child: Container( padding: const EdgeInsets.all(10.0), height: 50, - width: SizeConfig.realScreenWidth * 0.30, + width: SizeConfig.realScreenWidth * 0.35, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('LOGIN', + Text(TranslationBase.of(context).login, style: TextStyle( fontSize: SizeConfig.isMobilePortrait ? 2.3 * SizeConfig.textMultiplier @@ -293,7 +299,7 @@ class _LoginFormState extends State { // Platform messages may fail, so we use a try/catch PlatformException. try { platformImei = - await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); + await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); idunique = await ImeiPlugin.getId(); } on PlatformException { platformImei = 'Failed to get platform version.'; diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index a801fec9..0689da6b 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -15,6 +15,7 @@ import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_toast_msg.dart'; import '../../util/helpers.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -289,10 +290,10 @@ class _VerifyAccountState extends State { String medthodName; switch (model['OTP_SendType']) { case 1: - medthodName = 'SMS'; + medthodName = TranslationBase.of(context).smsBy; break; case 2: - medthodName = 'WhatsApp'; + medthodName = TranslationBase.of(context).whatsApp; break; default: } @@ -301,11 +302,12 @@ class _VerifyAccountState extends State { style: new TextStyle( fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black), children: [ - new TextSpan(text: 'You will receive a '), + new TextSpan(text: TranslationBase.of(context).youWillReceiveA), new TextSpan( - text: 'Login Code ', + text: TranslationBase.of(context).loginCode, style: TextStyle(fontWeight: FontWeight.w700)), - new TextSpan(text: 'By ${medthodName}, Please enter the code') + new TextSpan(text: ' ${medthodName},'), + TextSpan(text: TranslationBase.of(context).pleaseEnterTheCode) ])); return text; } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 8c996556..835acbf9 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -10,6 +10,7 @@ import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/helpers.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -50,7 +51,7 @@ class _VerificationMethodsState extends State { super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; verificationMethod = - routeArgs != null ? routeArgs['verificationMethod'] : null; + routeArgs != null ? routeArgs['verificationMethod'] : null; } @override @@ -74,8 +75,8 @@ class _VerificationMethodsState extends State { children: [ Text( hideSilentMethods() - ? 'As a first step, you need to verify by one of those methods' - : 'Please choose one of the Following option to verify', + ? TranslationBase.of(context).firstStep + : TranslationBase.of(context).pleaseChoose, style: TextStyle( fontSize: 3.5 * SizeConfig.textMultiplier, ), @@ -101,17 +102,17 @@ class _VerificationMethodsState extends State { child: buildFingerprintMethod( context, authProv), replacement: - buildWhatsAppMethod(context, authProv), + buildWhatsAppMethod(context, authProv), ), Visibility( visible: hideSilentMethods() ? false : true, child: buildFaceIDMethod(context, authProv), replacement: - buildSMSMethod(context, authProv), + buildSMSMethod(context, authProv), ), Visibility( visible: - hideSilentMethods() ? false : true, + hideSilentMethods() ? false : true, child: buildWhatsAppMethod( context, authProv)), Visibility( @@ -126,8 +127,8 @@ class _VerificationMethodsState extends State { // height: 500, ), SizedBox( - // height: 20, - ) + // height: 20, + ) ], ), ); @@ -137,7 +138,7 @@ class _VerificationMethodsState extends State { } /* - *@author: Elham Rababah + *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv *@return: Center widget @@ -145,12 +146,15 @@ class _VerificationMethodsState extends State { */ Center buildSMSMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod( - context, 'assets/images/verification_sms_icon.png', 'SMS', () { + context, + 'assets/images/verification_sms_icon.png', + TranslationBase.of(context).sms, () { sendActivationCodeByOtpNotificationType(1, authProv); }); } + /* - *@author: Elham Rababah + *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv *@return: Center widget @@ -158,13 +162,15 @@ class _VerificationMethodsState extends State { */ Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod( - context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp', - () { - sendActivationCodeByOtpNotificationType(2, authProv); - }); + context, + 'assets/images/verification_whatsapp_icon.png', + TranslationBase.of(context).whatsApp, () { + sendActivationCodeByOtpNotificationType(2, authProv); + }); } -/* - *@author: Elham Rababah + +/* + *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv *@return: Center widget @@ -172,26 +178,31 @@ class _VerificationMethodsState extends State { */ Center buildFaceIDMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod( - context, 'assets/images/verification_faceid_icon.png', 'Face ID', () { + context, + 'assets/images/verification_faceid_icon.png', + TranslationBase.of(context).faceId, () { sendActivationCodeByOtpNotificationType(3, authProv); }); } -/* - *@author: Elham Rababah + +/* + *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv *@return: Center widget *@desc: build Fingerprint Methods widget */ Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) { - return buildVerificationMethod(context, - 'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () { - sendActivationCodeByOtpNotificationType(4, authProv); - }); + return buildVerificationMethod( + context, + 'assets/images/verification_fingerprint_icon.png', + TranslationBase.of(context).fingerprint, () { + sendActivationCodeByOtpNotificationType(4, authProv); + }); } - /* - *@author: Elham Rababah + /* + *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv *@return: Center widget @@ -212,7 +223,7 @@ class _VerificationMethodsState extends State { width: 1, color: Hexcolor( '#CCCCCC') // <--- border width here - ), + ), borderRadius: BorderRadius.all(Radius.circular(10))), child: Column( children: [ @@ -243,20 +254,19 @@ class _VerificationMethodsState extends State { return verificationMethod == 4 || verificationMethod == 3 ? true : false; } -/* - *@author: Elham Rababah - *@Date:15/4/2020 +/* + *@author: Elham Rababah + *@Date:15/4/2020 *@param: oTPSendType *@return: *@desc: send Activation Code By Otp Notification Type */ sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { - // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); - Map model = { + Map model = { "LogInTokenID": _loggedUser['LogInTokenID'], "Channel": 9, "MobileNumber": _loggedUser['MobileNumber'], @@ -271,7 +281,8 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { - Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model}); + Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, + arguments: {'model': model}); } else { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 8cad6daf..d3034c86 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -60,7 +60,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { key: key, patient: patient, route: PROGRESS_NOTE, - name: 'Progress Notes', + name: TranslationBase.of(context).progressNote, icon: 'heartbeat.png')), PatientProfileButton( key: key,