From b178f0827833ca9b556c563506f82b4e434860f2 Mon Sep 17 00:00:00 2001 From: hussam alhababieh Date: Sun, 14 Jun 2020 11:10:35 +0300 Subject: [PATCH 1/4] translate dashboard and patient search --- lib/config/localized_values.dart | 77 +++++++++++-------- lib/screens/dashboard_screen.dart | 22 +++--- .../patients/patient_search_screen.dart | 17 ++-- lib/util/translations_delegate_base.dart | 49 ++++++++---- 4 files changed, 100 insertions(+), 65 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 38212262..c5f26c7e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -4,35 +4,50 @@ const Map> localizedValues = { 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'lanEnglish': {'en': 'English', 'ar': 'English'}, 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, - 'doctorReply':{'en': 'Doctor Reply', 'ar': 'رد الطبيب'}, - 'time' :{'en': 'Time','ar':'الوقت'}, - 'fileNo' :{'en':'File No', 'ar':'رقم الملف'}, - 'mobileNo' :{'en':'Mobile No', 'ar':'رقم الموبايل'}, - 'messagesScreenToolbarTitle' : {'en': 'Messages','ar': 'الرسائل' }, - 'mySchedule' : {'en': 'My Schedule', 'ar' : 'جدولي'}, - 'errorNoSchedule' :{'en': 'You don\'t have any Schedule' , 'ar': 'ليس لديك أي جدول زمني'}, - 'verify': {'en': 'Verify', 'ar' : 'تحقق'}, - 'referralDoctor':{'en': 'Referral Doctor', 'ar' : 'الطبيب المُحول إليه'}, - 'referringClinic':{'en': 'Referring Clinic', 'ar' : 'العيادة المُحول إليها'}, - 'frequency':{'en': 'Frequency', 'ar' : 'نوع التحويلا'}, - 'priority':{'en': 'Priority', 'ar' : 'الأولوية'}, - 'maxResponseTime':{'en': 'Max Response Time', 'ar' : 'الوقت الأقصى للرد'}, - 'clinicDetailsandRemarks':{'en': 'Clinic Details and Remarks', 'ar' : 'ملاحضات وتفاصيل العيادة'}, - 'answerSuggestions':{'en': 'Answer/Suggestions', 'ar' : 'ملاحضات وتفاصيل العيادة'}, - 'outPatients':{'en': 'Out-Patients', 'ar' : 'ةالمريض الخارجي'}, - 'searchPatient':{'en': 'Search Patient', 'ar' : 'البحث عن مريض'}, - 'labResult':{'en': 'Lab Result', 'ar' : 'نتيجة المختبر'}, - 'todayStatistics':{'en': 'Today Statistics', 'ar' : 'إحصائيات اليوم'}, - 'arrived':{'en': 'Arrived', 'ar' : 'وصل'}, - 'er':{'en': 'ER', 'ar' : 'حالة طوارئ'}, - 'walkIn':{'en': 'Walk-in', 'ar' : 'ادخل'}, - 'notArrived':{'en': 'Not Arrived', 'ar' : 'لم يصل'}, - 'radiology':{'en': 'Radiology', 'ar' : 'الأشعة'}, - 'referral':{'en': 'Referral', 'ar' : 'االإحالة'}, - 'inPatient':{'en': 'In-Patient', 'ar' : 'االمريض الداخلي'}, - 'operations':{'en': 'Operations', 'ar' : 'عمليات'}, - 'patientServices':{'en': 'Patient Services', 'ar' : 'خدمات المرضى'}, - - - + 'doctorReply': {'en': 'Doctor Reply', 'ar': 'رد الطبيب'}, + 'time': {'en': 'Time', 'ar': 'الوقت'}, + 'fileNo': {'en': 'File No', 'ar': 'رقم الملف'}, + 'mobileNo': {'en': 'Mobile No', 'ar': 'رقم الموبايل'}, + 'messagesScreenToolbarTitle': {'en': 'Messages', 'ar': 'الرسائل'}, + 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, + 'errorNoSchedule': { + 'en': 'You don\'t have any Schedule', + 'ar': 'ليس لديك أي جدول زمني' + }, + 'verify': {'en': 'Verify', 'ar': 'تحقق'}, + 'referralDoctor': {'en': 'Referral Doctor', 'ar': 'الطبيب المُحول إليه'}, + 'referringClinic': {'en': 'Referring Clinic', 'ar': 'العيادة المُحول إليها'}, + 'frequency': {'en': 'Frequency', 'ar': 'نوع التحويلا'}, + 'priority': {'en': 'Priority', 'ar': 'الأولوية'}, + 'maxResponseTime': {'en': 'Max Response Time', 'ar': 'الوقت الأقصى للرد'}, + 'clinicDetailsandRemarks': { + 'en': 'Clinic Details and Remarks', + 'ar': 'ملاحضات وتفاصيل العيادة' + }, + 'answerSuggestions': { + 'en': 'Answer/Suggestions', + 'ar': 'ملاحضات وتفاصيل العيادة' + }, + 'outPatients': {'en': 'Out-Patients', 'ar': 'ةالمريض الخارجي'}, + 'searchPatient': {'en': 'Search Patient', 'ar': 'البحث عن مريض'}, + 'labResult': {'en': 'Lab Result', 'ar': 'نتيجة المختبر'}, + 'todayStatistics': {'en': 'Today Statistics', 'ar': 'إحصائيات اليوم'}, + 'arrived': {'en': 'Arrived', 'ar': 'وصل'}, + 'er': {'en': 'ER', 'ar': 'حالة طوارئ'}, + 'walkIn': {'en': 'Walk-in', 'ar': 'ادخل'}, + 'notArrived': {'en': 'Not Arrived', 'ar': 'لم يصل'}, + 'radiology': {'en': 'Radiology', 'ar': 'الأشعة'}, + 'referral': {'en': 'Referral', 'ar': 'االإحالة'}, + 'inPatient': {'en': 'In-Patient', 'ar': 'االمريض الداخلي'}, + 'operations': {'en': 'Operations', 'ar': 'عمليات'}, + 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, + 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, + 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, + 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, + 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, + 'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'}, + 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, + 'phoneNumber': {'en': 'Phone Number ', 'ar': 'رقم الجوال'}, + 'patientID': {'en': 'Patient ID', 'ar': 'رقم المريض'}, + 'patientFile ': {'en': 'Patient File', 'ar': 'ملف المريض'}, }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index a00471df..18c9ca38 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -42,7 +42,7 @@ class _DashboardScreenState extends State { child: Scaffold( body: SingleChildScrollView( child: SizedBox( - height: MediaQuery.of(context).size.height*1.09, + height: MediaQuery.of(context).size.height * 1.09, // height: MediaQuery.of(context).size.height * 0.2, // width: SizeConfig.screenWidth * 0.9, child: Column( @@ -101,16 +101,17 @@ class _DashboardScreenState extends State { flex: 1, child: Column( crossAxisAlignment: - CrossAxisAlignment.stretch, + CrossAxisAlignment.stretch, children: [ Expanded( child: DashboardItemTexts( - TranslationBase.of(context).arrived, + TranslationBase.of(context).arrived, "23", )), Expanded( child: DashboardItemTexts( - TranslationBase.of(context).notArrived, + TranslationBase.of(context) + .notArrived, "23", ), ), @@ -119,18 +120,17 @@ class _DashboardScreenState extends State { ), Expanded( child: Column( - crossAxisAlignment: + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( child: DashboardItemTexts( - TranslationBase.of(context).er, + TranslationBase.of(context).er, "23", )), Expanded( child: DashboardItemTexts( - - TranslationBase.of(context).walkIn, + TranslationBase.of(context).walkIn, "23", )), ], @@ -286,7 +286,7 @@ class _DashboardScreenState extends State { child: DashboardItemIconText( DoctorApp.home_icon, "", - "Search Medicine", + TranslationBase.of(context).searchMedicine, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, @@ -324,7 +324,7 @@ class _DashboardScreenState extends State { child: DashboardItemIconText( DoctorApp.home_icon, "", - "My Referral Patient", + TranslationBase.of(context).myReferralPatient, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, @@ -359,7 +359,7 @@ class _DashboardScreenState extends State { child: DashboardItemIconText( DoctorApp.home_icon, "", - "My Referred Patient", + TranslationBase.of(context).myReferredPatient, showBorder: true, backgroundColor: Colors.white, valueFontColor: Colors.black, diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index dffe342c..3d906bef 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -18,6 +18,7 @@ import '../../lookups/patient_lookup.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../config/config.dart'; import '../../models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -112,7 +113,7 @@ class _PatientSearchScreenState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "SEARCH FOR PATIENT", + appBarTitle: TranslationBase.of(context).searchPatient, body: ListView( children: [ RoundedContainer( @@ -199,7 +200,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'First Name', + hintText: TranslationBase.of(context).firstName, onSaved: (value) { value == null ? _patientSearchFormValues.setFirstName = @@ -219,7 +220,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'Middle Name', + hintText: TranslationBase.of(context).middleName, onSaved: (value) { value == null ? _patientSearchFormValues.setMiddleName = @@ -238,7 +239,7 @@ class _PatientSearchScreenState extends State { height: 10, ), AppTextFormField( - hintText: 'Last Name', + hintText: TranslationBase.of(context).lastName, onSaved: (value) { value == null ? _patientSearchFormValues.setLastName = "0" @@ -254,7 +255,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Phone Number', + hintText: TranslationBase.of(context).phoneNumber, // validator: (value) { // return TextValidator().validateMobile(value); // }, @@ -277,7 +278,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patient ID', + hintText: TranslationBase.of(context).patientID, // inputFormatter: ONLY_NUMBERS, onSaved: (value) { @@ -296,7 +297,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: 'Patient File', + hintText: TranslationBase.of(context).patientID, // validator: (value) { // return TextValidator().validateIdNumber(value); // }, @@ -399,7 +400,7 @@ class _PatientSearchScreenState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: "Search", + title: TranslationBase.of(context).patientID, color: Color(0xff58434F), onPressed: () { _validateInputs(); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c62f9cb7..4c96593c 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -13,9 +13,8 @@ class TranslationBase { return Localizations.of(context, TranslationBase); } - - - String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; + String get dashboardScreenToolbarTitle => + localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; String get settings => localizedValues['settings'][locale.languageCode]; @@ -33,25 +32,33 @@ class TranslationBase { String get mobileNo => localizedValues['mobileNo'][locale.languageCode]; - String get messagesScreenToolbarTitle => localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; + String get messagesScreenToolbarTitle => + localizedValues['messagesScreenToolbarTitle'][locale.languageCode]; String get mySchedule => localizedValues['mySchedule'][locale.languageCode]; - String get errorNoSchedule => localizedValues['errorNoSchedule'][locale.languageCode]; - + String get errorNoSchedule => + localizedValues['errorNoSchedule'][locale.languageCode]; String get verify => localizedValues['verify'][locale.languageCode]; - String get referralDoctor => localizedValues['referralDoctor'][locale.languageCode]; - String get referringClinic => localizedValues['referringClinic'][locale.languageCode]; + String get referralDoctor => + localizedValues['referralDoctor'][locale.languageCode]; + String get referringClinic => + localizedValues['referringClinic'][locale.languageCode]; String get frequency => localizedValues['frequency'][locale.languageCode]; String get priority => localizedValues['priority'][locale.languageCode]; - String get maxResponseTime => localizedValues['maxResponseTime'][locale.languageCode]; - String get clinicDetailsandRemarks=> localizedValues['clinicDetailsandRemarks'][locale.languageCode]; - String get answerSuggestions => localizedValues['answerSuggestions'][locale.languageCode]; + String get maxResponseTime => + localizedValues['maxResponseTime'][locale.languageCode]; + String get clinicDetailsandRemarks => + localizedValues['clinicDetailsandRemarks'][locale.languageCode]; + String get answerSuggestions => + localizedValues['answerSuggestions'][locale.languageCode]; String get outPatients => localizedValues['outPatients'][locale.languageCode]; - String get searchPatient => localizedValues['searchPatient'][locale.languageCode]; + String get searchPatient => + localizedValues['searchPatient'][locale.languageCode]; String get labResult => localizedValues['labResult'][locale.languageCode]; - String get todayStatistics => localizedValues['todayStatistics'][locale.languageCode]; + String get todayStatistics => + localizedValues['todayStatistics'][locale.languageCode]; String get arrived => localizedValues['arrived'][locale.languageCode]; String get er => localizedValues['er'][locale.languageCode]; String get walkIn => localizedValues['walkIn'][locale.languageCode]; @@ -60,8 +67,20 @@ class TranslationBase { String get referral => localizedValues['referral'][locale.languageCode]; String get inPatient => localizedValues['inPatient'][locale.languageCode]; String get operations => localizedValues['inPatient'][locale.languageCode]; - String get patientServices => localizedValues['patientServices'][locale.languageCode]; - + String get patientServices => + localizedValues['patientServices'][locale.languageCode]; + String get searchMedicine => + localizedValues['searchMedicine'][locale.languageCode]; + String get myReferralPatient => + localizedValues['myReferralPatient'][locale.languageCode]; + String get myReferredPatient => + localizedValues['myReferredPatient'][locale.languageCode]; + String get firstName => localizedValues['firstName'][locale.languageCode]; + String get middleName => localizedValues['middleName'][locale.languageCode]; + String get lastName => localizedValues['lastName'][locale.languageCode]; + String get phoneNumber => localizedValues['phoneNumber'][locale.languageCode]; + String get patientID => localizedValues['patientID'][locale.languageCode]; + String get patientFile => localizedValues['PatientFile'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From dcbf1312b780ba041742cf1dba1f2c1183f67ff5 Mon Sep 17 00:00:00 2001 From: hussam alhababieh Date: Sun, 14 Jun 2020 12:05:43 +0300 Subject: [PATCH 2/4] translate dashboard/patient search --- lib/config/localized_values.dart | 9 +++++++-- lib/screens/patients/patient_search_screen.dart | 8 +++++--- lib/util/translations_delegate_base.dart | 5 ++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1b05b5c6..33f184d2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -49,6 +49,11 @@ const Map> localizedValues = { 'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'}, 'phoneNumber': {'en': 'Phone Number ', 'ar': 'رقم الجوال'}, 'patientID': {'en': 'Patient ID', 'ar': 'رقم المريض'}, - 'patientFile ': {'en': 'Patient File', 'ar': 'ملف المريض'}, - 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'} + 'patientFile': {'en': 'Patient File', 'ar': 'ملف المريض'}, + 'familyMedicine': {'en': 'Family Medicine Clinic', 'ar': 'عيادة طب الأسرة'}, + 'search': {'en': 'Search', 'ar': 'بحث'}, + 'onlyArrivedPatient': { + 'en': 'Only Arrived Patient', + 'ar': 'المريض الذي حضر للموعد' + }, }; diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 924357c6..f020ca2e 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -307,7 +307,7 @@ class _PatientSearchScreenState extends State { ), AppTextFormField( textInputType: TextInputType.number, - hintText: TranslationBase.of(context).patientID, + hintText: TranslationBase.of(context).patientFile, // validator: (value) { // return TextValidator().validateIdNumber(value); // }, @@ -401,7 +401,9 @@ class _PatientSearchScreenState extends State { value: true, activeColor: Color(0xffFFDDD9), onChanged: (bool newValue) {}), - AppText('Only Arrived Patient', + AppText( + TranslationBase.of(context) + .onlyArrivedPatient, fontSize: SizeConfig.textMultiplier * 2), ])), SizedBox( @@ -420,7 +422,7 @@ class _PatientSearchScreenState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: TranslationBase.of(context).patientID, + title: TranslationBase.of(context).search, color: Color(0xff58434F), onPressed: () { _validateInputs(); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 61b1034e..41a923f5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -82,7 +82,10 @@ class TranslationBase { String get lastName => localizedValues['lastName'][locale.languageCode]; String get phoneNumber => localizedValues['phoneNumber'][locale.languageCode]; String get patientID => localizedValues['patientID'][locale.languageCode]; - String get patientFile => localizedValues['PatientFile'][locale.languageCode]; + String get patientFile => localizedValues['patientFile'][locale.languageCode]; + String get search => localizedValues['search'][locale.languageCode]; + String get onlyArrivedPatient => + localizedValues['onlyArrivedPatient'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From d52429564dedf0ef8b2346a046dc3ac971e8a0cb Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Sun, 14 Jun 2020 12:13:43 +0300 Subject: [PATCH 3/4] fix issues in Patient --- lib/screens/patients/patients_screen.dart | 2 ++ lib/widgets/shared/app_scaffold_widget.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 68114a3d..96211046 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -102,8 +102,10 @@ class _PatientsScreenState extends State { } }); }).catchError((error) { + print(error); setState(() { _isError = true; + _isLoading = false; this.error = helpers.generateContactAdminMsg(error); }); }); diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 263e3848..efdb0521 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -35,7 +35,7 @@ class AppScaffold extends StatelessWidget { IconButton( icon: Icon(DoctorApp.home_icon_active), color: Colors.white, //Colors.black, - onPressed: () => Navigator.pushReplacementNamed(context, HOME), + onPressed: () => Navigator.pushNamedAndRemoveUntil(context, HOME,(r) => false ), ), ], ) From 66627534a97ef3c724a26f90e988da43e2ada5c5 Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Sun, 14 Jun 2020 12:46:40 +0300 Subject: [PATCH 4/4] Modify date in time in search patiant --- lib/widgets/patients/dynamic_elements.dart | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index be66e88e..36808cb0 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -29,9 +29,28 @@ class _DynamicElementsState extends State { var selectedDate = DateFormat.yMd().format(pickedDate); if (id == '_selectedFromDate') { - _fromDateController.text = selectedDate; + // _fromDateController.text = selectedDate; + selectedDate = pickedDate.year.toString() + + "-" + + pickedDate.month.toString().padLeft(2, '0') + + "-" + + pickedDate.day.toString().padLeft(2, '0'); + + _fromDateController.text = selectedDate; + + + } else { + + + selectedDate = pickedDate.year.toString() + + "-" + + pickedDate.month.toString().padLeft(2, '0') + + "-" + + pickedDate.day.toString().padLeft(2, '0'); + _toDateController.text = selectedDate; + // _toDateController.text = selectedDate; } }); }); @@ -72,8 +91,11 @@ class _DynamicElementsState extends State { if (_fromDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.From = "0"; } else { - widget._patientSearchFormValues.From = - _fromDateController.text; + widget._patientSearchFormValues.From = _fromDateController.text.replaceAll("/", "-"); + + + + // _fromDateController.text; } }, ), @@ -103,7 +125,7 @@ class _DynamicElementsState extends State { if (_toDateController.text.toString().trim().isEmpty) { widget._patientSearchFormValues.To = "0"; } else { - widget._patientSearchFormValues.To = _toDateController.text; + widget._patientSearchFormValues.To = _toDateController.text.replaceAll("/", "-"); } }, ),