From 5294948a5826065db9c76c4b89ec59b728f250e9 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Thu, 11 Jun 2020 13:03:26 +0300 Subject: [PATCH 01/14] fix issues --- lib/landing_page.dart | 9 +------ lib/screens/doctor/my_schedule_screen.dart | 3 +-- lib/widgets/doctor/doctor_reply_widget.dart | 24 ++++++++++++++++++- lib/widgets/doctor/my_schedule_widget.dart | 2 ++ .../patients/profile/large_avatar.dart | 2 -- lib/widgets/shared/app_drawer_widget.dart | 17 +++---------- .../shared/app_expandable_notifier.dart | 1 + lib/widgets/shared/app_scaffold_widget.dart | 11 ++++----- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/lib/landing_page.dart b/lib/landing_page.dart index a9f844f8..174a38ab 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -51,14 +51,7 @@ class _LandingPageState extends State { }, ), centerTitle: true, - actions: [ - ProfileImageWidget( - height: 50, - width: 50, - url: - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - ) - ], + ), drawer: Theme( data: Theme.of(context).copyWith( diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index cd0f94a3..f7b9d444 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -15,8 +15,7 @@ class MyScheduleScreen extends StatelessWidget { @override Widget build(BuildContext context) { scheduleProvider = Provider.of(context); - return AppScaffold( - appBarTitle: TranslationBase.of(context).mySchedule, + return Scaffold( body: scheduleProvider.isLoading ? DrAppCircularProgressIndeicator() : scheduleProvider.isError diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 5ec30858..6fc9ec66 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; +import 'package:doctor_app_flutter/presentation/doctor_app_icons.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; @@ -42,7 +43,28 @@ class _DoctorReplyWidgetState extends State { child: Row( children: [ SizedBox(width: 5,), - LargeAvatar(name: widget.reply.patientName,url: '',), + //LargeAvatar(icon: widget.reply.gender == 0 ? DoctorApp.male : DoctorApp.femaleicon ,), + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment(-1, -1), + end: Alignment(1, 1), + colors: [ + Colors.grey[100], + Colors.grey[200], + ]), + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.08), + offset: Offset(0.0, 5.0), + blurRadius: 16.0) + ], + borderRadius: BorderRadius.all(Radius.circular(50.0)), + ), + width: 80, + height: 80, + child: Icon(widget.reply.gender == 1 ? DoctorApp.male : DoctorApp.femaleicon,size: 80,)), + SizedBox(width: 15,), Expanded( child: Container( diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index c37d09ad..48f70d7c 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -45,6 +45,7 @@ class MyScheduleWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText('From',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + SizedBox(height: 5,), AppText(work.from,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) ], ), @@ -56,6 +57,7 @@ class MyScheduleWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText('To',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + SizedBox(height: 5,), AppText(work.to,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) ], ), diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index 3b70f393..845f1ee3 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -54,8 +54,6 @@ class LargeAvatar extends StatelessWidget { @override Widget build(BuildContext context) { - var vlr = name; - var asd; return InkWell( onTap: disableProfileView ? null diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 53228c97..919dc939 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -89,35 +89,24 @@ class _AppDrawerState extends State { }, ), ), - InkWell( - child: DrawerItem("My Schedule", Icons.table_chart), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChangeNotifierProvider( - create: (_) => ScheduleProvider(), - child: MyScheduleScreen(), - ), - ), - ); - }, - ), InkWell( child: DrawerItem("Settings", Icons.settings), onTap: () { + Navigator.pop(context); Navigator.of(context).pushNamed(SETTINGS); }, ), InkWell( child: DrawerItem("QR Reader", Icons.search), onTap: () { + Navigator.pop(context); Navigator.of(context).pushNamed(QR_READER); }, ), InkWell( child: DrawerItem("lOGOUT", Icons.exit_to_app), onTap: () { + Navigator.pop(context); Navigator.of(context).pushNamed(LOGIN); }, ), diff --git a/lib/widgets/shared/app_expandable_notifier.dart b/lib/widgets/shared/app_expandable_notifier.dart index ca3edd09..4ae87e8a 100644 --- a/lib/widgets/shared/app_expandable_notifier.dart +++ b/lib/widgets/shared/app_expandable_notifier.dart @@ -30,6 +30,7 @@ class AppExpandableNotifier extends StatelessWidget { padding: EdgeInsets.all(10), child: Text( "See Graph Details", + style: TextStyle(fontWeight: FontWeight.bold), )), collapsed: Text(''), expanded: bodyWid, diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 1e6da3fc..a390e064 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -37,12 +37,11 @@ class AppScaffold extends StatelessWidget { }), centerTitle: true, actions: [ - ProfileImageWidget( - height: 50, - width: 50, - url: - "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - ) + IconButton( + icon: Icon(DoctorApp.home_icon_active), + color: Colors.white, //Colors.black, + onPressed: () => Navigator.popAndPushNamed(context, HOME), + ), ], ) : null, From c8a3beb5301c29eebbf619ad548de4eb12780019 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Thu, 11 Jun 2020 15:13:08 +0300 Subject: [PATCH 02/14] fix issues in dev --- lib/config/config.dart | 3 +++ lib/widgets/shared/app_scaffold_widget.dart | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d199986c..90b2592f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -68,3 +68,6 @@ const PATIENT_OUT_SA = false; /// Timer Info const TIMER_MIN =10; +class AppGlobal{ + static var CONTEX; +} diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index fdc8611d..a390e064 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,9 +1,13 @@ -import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../config/size_config.dart'; +import '../../presentation/doctor_app_icons.dart'; +import '../../widgets/shared/app_drawer_widget.dart'; import '../../widgets/shared/app_loader_widget.dart'; +import '../../widgets/shared/custom_shape_clipper.dart'; class AppScaffold extends StatelessWidget { String appBarTitle; @@ -14,7 +18,6 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { - AppGlobal.CONTEX = context; return Scaffold( backgroundColor: Hexcolor('#F5F5F5'), appBar: appBarTitle != '' From e545d4992ca5dda2e2c5fe03a815842386350865 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Thu, 11 Jun 2020 16:01:00 +0300 Subject: [PATCH 03/14] fix issues in dev --- lib/client/base_app_client.dart | 2 +- lib/widgets/shared/app_scaffold_widget.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 63ae8fca..a6e14c51 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -73,7 +73,7 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - Navigator.of(AppGlobal.CONTEX).pushNamed(LOGIN); + await helpers.logout(); helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index a390e064..ef8a983b 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -40,7 +40,7 @@ class AppScaffold extends StatelessWidget { IconButton( icon: Icon(DoctorApp.home_icon_active), color: Colors.white, //Colors.black, - onPressed: () => Navigator.popAndPushNamed(context, HOME), + onPressed: () => Navigator.pushReplacementNamed(context, HOME), ), ], ) From fa9e1a344a4a994504bcf2a5bd345a3a5b4160fb Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Fri, 12 Jun 2020 10:03:35 +0300 Subject: [PATCH 04/14] fix issues --- lib/widgets/auth/login_form.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 48769b59..2d2d2bfd 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -69,16 +69,6 @@ class _LoginFormState extends State { _isInit = false; } - @override - void didChangeDependencies() { - super.didChangeDependencies(); - if (_isInit) { - if (projectsList.length == 0) { - getProjectsList(); - } - } - _isInit = false; - } @override Widget build(BuildContext context) { From b758ae8196296ec9eabe8f79c53e2461b437eca9 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Sun, 14 Jun 2020 10:45:44 +0300 Subject: [PATCH 05/14] fix issues --- .../vital_sign/vital_sign_details_screen.dart | 4 +-- .../profile/patient_profile_widget.dart | 5 ++-- .../profile/profile_medical_info_widget.dart | 27 ++++++++----------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index 16466704..68966553 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -99,7 +99,7 @@ class _VitalSignDetailsScreenState extends State { vitalSignDetails.bodyMeasurements }); }, - child: Expanded( + child: Container( child: VitalSignItem( des: 'Body Measurements', url: url + 'heartbeat.png', @@ -118,7 +118,7 @@ class _VitalSignDetailsScreenState extends State { }); }, - child: Expanded( + child: Container( child: VitalSignItem( des: 'Temperature', url: url + 'heartbeat.png', diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 0ef50d81..87990fbf 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -36,8 +36,7 @@ class PatientProfileWidget extends StatelessWidget { SliverList( delegate: SliverChildListDelegate( [ - Expanded( - flex: 1, + Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -78,7 +77,7 @@ class PatientProfileWidget extends StatelessWidget { ), SliverPadding( padding: const EdgeInsets.fromLTRB(20, 30, 15, 10), - sliver: ProfileMedicalInfoWidget()) + sliver: ProfileMedicalInfoWidget(patient: patient,)) ]); // Container( diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index bc92db90..16c9a0bd 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -291,23 +291,18 @@ class PatientProfileButton extends StatelessWidget { navigator(context, this.route); }, child: Column(children: [ - Expanded( - flex: 1, - child: Expanded( - child: Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.all(5), - child: new AppText( - this.name, - color: Colors.red, - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - )), + Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.all(5), + child: new AppText( + this.name, + color: Colors.red, + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), ), - Expanded( - flex: 1, + Container( child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ From b178f0827833ca9b556c563506f82b4e434860f2 Mon Sep 17 00:00:00 2001 From: hussam alhababieh Date: Sun, 14 Jun 2020 11:10:35 +0300 Subject: [PATCH 06/14] 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 07/14] 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 08/14] 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 09/14] 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("/", "-"); } }, ), From 69173e8c46e4d15619d3978d7ff9186269cb7cac Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Sun, 14 Jun 2020 14:16:18 +0300 Subject: [PATCH 10/14] fix issues in login focus --- lib/widgets/auth/login_form.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 2d2d2bfd..17b5520d 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -37,8 +37,8 @@ class _LoginFormState extends State { String uniqueId = "Unknown"; var projectsList = []; bool _isInit = true; - FocusNode focusPass; - FocusNode focusProject; + FocusNode focusPass = FocusNode(); + FocusNode focusProject = FocusNode(); var userInfo = UserModel( UserID: '', @@ -72,8 +72,7 @@ class _LoginFormState extends State { @override Widget build(BuildContext context) { - final focusPass = FocusNode(); - final focusProject = FocusNode(); + AuthProvider authProv = Provider.of(context); @@ -100,7 +99,7 @@ class _LoginFormState extends State { userInfo.UserID = value.trim(); }, onFieldSubmitted: (_) { - FocusScope.of(context).nextFocus(); + focusPass.nextFocus(); }, autofocus: false, ), @@ -121,7 +120,7 @@ class _LoginFormState extends State { userInfo.Password = value; }, onFieldSubmitted: (_) { - FocusScope.of(context).nextFocus(); + focusPass.nextFocus(); helpers.showCupertinoPicker( context, projectsList, 'Name', onSelectProject); }, From 0dad77bfa286216f62d50cf87be3d57299d1aca5 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Sun, 14 Jun 2020 15:12:38 +0300 Subject: [PATCH 11/14] fix issues in login --- lib/providers/auth_provider.dart | 37 ++++++++++++++++++++++ lib/root_page.dart | 38 +++++++++++++++++++++++ lib/routes.dart | 5 ++- lib/util/helpers.dart | 2 +- lib/widgets/shared/app_drawer_widget.dart | 4 ++- 5 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 lib/root_page.dart diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index e79192ae..415b8d39 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import '../models/user_model.dart'; @@ -14,8 +16,41 @@ const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Sentry.svc/REST/MemberCheckActivationCode_New'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } + class AuthProvider with ChangeNotifier { + + bool isLogin= false; + bool isLoading = true; + AuthProvider(){ + getUserAuthentication(); + } + + void getUserAuthentication() async{ + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if(profile != null) + { + isLoading = false; + isLogin = true; + } else { + isLoading = false; + isLogin = false; + } + notifyListeners(); + } + APP_STATUS get stutas { + if (isLoading) { + return APP_STATUS.LOADING; + } else{ + if ( this.isLogin) { + return APP_STATUS.AUTHENTICATED; + } else { + return APP_STATUS.UNAUTHENTICATED; + } + } + } Future login(UserModel userInfo) async { try { dynamic localRes; @@ -131,4 +166,6 @@ class AuthProvider with ChangeNotifier { throw error; } } + + } diff --git a/lib/root_page.dart b/lib/root_page.dart new file mode 100644 index 00000000..a784183b --- /dev/null +++ b/lib/root_page.dart @@ -0,0 +1,38 @@ +import 'package:doctor_app_flutter/providers/auth_provider.dart'; +import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'landing_page.dart'; + +class RootPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + AuthProvider authProvider = Provider.of(context); + + Widget buildRoot() { + switch (authProvider.stutas) { + case APP_STATUS.LOADING: + return Scaffold( + body: Center( + child: DrAppCircularProgressIndeicator(), + ), + ); + break; + case APP_STATUS.UNAUTHENTICATED: + return Loginsreen(); + break; + case APP_STATUS.AUTHENTICATED: + return LandingPage(); + break; + } + } + + return AnimatedSwitcher( + duration: Duration(microseconds: 350), + child: buildRoot(), + ); + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 34d3224d..cd5b3187 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/progress_note_screen.dart'; @@ -38,7 +39,8 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; -const String INIT_ROUTE = LOGIN; +const String INIT_ROUTE = ROOT; +const String ROOT = 'root'; const String HOME = '/'; const String LOGIN = 'login'; const String PROFILE = 'profile'; @@ -71,6 +73,7 @@ const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; var routes = { + ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), LOGIN: (_) => Loginsreen(), PROFILE: (_) => ProfileScreen(), diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index ebcf817c..aa92b253 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -335,7 +335,7 @@ class Helpers { return localMsg; } - clearSharedPref() async { + static clearSharedPref() async { await sharedPref.clear(); } diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 919dc939..b2cd3dd9 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -105,7 +106,8 @@ class _AppDrawerState extends State { ), InkWell( child: DrawerItem("lOGOUT", Icons.exit_to_app), - onTap: () { + onTap: () async { + await Helpers.clearSharedPref(); Navigator.pop(context); Navigator.of(context).pushNamed(LOGIN); }, From 6fd43a281d3a4840e1baa1b0bd33a4d7c2722fa2 Mon Sep 17 00:00:00 2001 From: ibrahim albitar Date: Sun, 14 Jun 2020 16:02:44 +0300 Subject: [PATCH 12/14] fixing --- lib/providers/patients_provider.dart | 84 +++++------- .../profile/refer_patient_screen.dart | 128 ++++++++++++------ lib/widgets/shared/app_text_form_field.dart | 4 +- 3 files changed, 122 insertions(+), 94 deletions(-) diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 6da89e74..2d1f4fe1 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -63,7 +63,7 @@ class PatientsProvider with ChangeNotifier { STPReferralFrequencyRequest(); ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest(); - ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest(); + ReferToDoctorRequest _referToDoctorRequest; PatiantInformtion _selectedPatient; @@ -486,7 +486,7 @@ class PatientsProvider with ChangeNotifier { *@Date:3/6/2020 *@desc: referToDoctor */ - referToDoctor(context, + referToDoctor(context, {String selectedDoctorID, String selectedClinicID, int admissionNo, @@ -500,56 +500,42 @@ class PatientsProvider with ChangeNotifier { int projectID}) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - String token = await sharedPref.getString(TOKEN); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); - int doctorID = doctorProfile.doctorID; - int clinicId = doctorProfile.clinicID; - _referToDoctorRequest = ReferToDoctorRequest( - projectID: projectID, - admissionNo: admissionNo, - roomID: roomID, - referralClinic: selectedClinicID.toString(), - referralDoctor: selectedDoctorID.toString(), - createdBy: doctorID, - editedBy: doctorID, - patientID: patientID, - patientTypeID: patientTypeID, - referringClinic: clinicId, - referringDoctor: doctorID, - referringDoctorRemarks: referringDoctorRemarks, - priority: priority, - frequency: frequency, - extension: extension, - tokenID: token); - - final response = await AppClient.post(PATIENT_REFER_TO_DOCTOR_URL, - body: json.encode(_referToDoctorRequest)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - print('Done : \n $res'); + String token = await sharedPref.getString(TOKEN); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = + new DoctorProfileModel.fromJson(profile); + int doctorID = doctorProfile.doctorID; + int clinicId = doctorProfile.clinicID; + _referToDoctorRequest = ReferToDoctorRequest( + projectID: projectID, + admissionNo: admissionNo, + roomID: roomID, + referralClinic: selectedClinicID.toString(), + referralDoctor: selectedDoctorID.toString(), + createdBy: doctorID, + editedBy: doctorID, + patientID: patientID, + patientTypeID: patientTypeID, + referringClinic: clinicId, + referringDoctor: doctorID, + referringDoctorRemarks: referringDoctorRemarks, + priority: priority, + frequency: frequency, + extension: extension, + tokenID: token); + await BaseAppClient.post(PATIENT_REFER_TO_DOCTOR_URL, + onSuccess: (dynamic response, int statusCode) { + // print('Done : \n $res'); Navigator.pop(context); - } else { + }, + onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, + body: _referToDoctorRequest.toJson()); notifyListeners(); + } catch (err) { handelCatchErrorCase(err); } diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index 24146ca5..1da89f97 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -15,6 +15,7 @@ import '../../../util/dr_app_shared_pref.dart'; import '../../../widgets/shared/app_scaffold_widget.dart'; import '../../../widgets/shared/app_texts_widget.dart'; import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../util/extenstions.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -37,6 +38,7 @@ class _ReferPatientState extends State { final _remarksController = TextEditingController(); final _extController = TextEditingController(); var _isInit = true; + bool isValid; var clinicId; var doctorId; @@ -49,14 +51,17 @@ class _ReferPatientState extends State { List _priorities = ['Very Urgent', 'Urgent', 'Routine']; int _activePriority = 2; + FocusNode myFocusNode; + @override void didChangeDependencies() { super.didChangeDependencies(); if (_isInit) { + myFocusNode = FocusNode(); doctorsList = null; patientsProv = Provider.of(context); patientsProv.getClinicsList(); - patientsProv.getReferralFrequancyList(); + patientsProv.getReferralFrequancyList(); } _isInit = false; } @@ -70,10 +75,9 @@ class _ReferPatientState extends State { : patientsProv.isError ? DrAppEmbeddedError(error: patientsProv.error) : patientsProv.clinicsList == null - ? DrAppEmbeddedError( - error: 'Something Wrong!') + ? DrAppEmbeddedError(error: 'Something Wrong!') : SingleChildScrollView( - child: Column( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -128,13 +132,17 @@ class _ReferPatientState extends State { setState(() { _selectedDoctor = null; _selectedClinic = newValue; - var clinicInfo = patientsProv.clinicsList.where((i) => + var clinicInfo = patientsProv + .clinicsList + .where((i) => i['ClinicDescription'] .toString() - .contains(_selectedClinic)).toList(); - - clinicId = - clinicInfo[0]['ClinicID'].toString(); + .contains( + _selectedClinic)) + .toList(); + + clinicId = clinicInfo[0]['ClinicID'] + .toString(); patientsProv.getDoctorsList(clinicId); }) @@ -208,15 +216,16 @@ class _ReferPatientState extends State { onChanged: (newValue) => { setState(() { _selectedDoctor = newValue; - doctorsList = patientsProv.doctorsList; - - var doctorInfo = - doctorsList.where((i) => - i['DoctorName'] - .toString() - .contains(_selectedDoctor)).toList(); - doctorId = doctorInfo[0]['DoctorID'].toString(); - + doctorsList = + patientsProv.doctorsList; + + var doctorInfo = doctorsList + .where((i) => i['DoctorName'] + .toString() + .contains(_selectedDoctor)) + .toList(); + doctorId = doctorInfo[0]['DoctorID'] + .toString(); }) }, items: patientsProv @@ -320,13 +329,16 @@ class _ReferPatientState extends State { onChanged: (newValue) => { setState(() { _selectedReferralFrequancy = newValue; - var freqInfo = - patientsProv.referalFrequancyList.singleWhere((i) => - i['Description'] - .toString() - .contains(_selectedReferralFrequancy)); - freqId = - freqInfo['ParameterCode'].toString(); + var freqInfo = patientsProv + .referalFrequancyList + .singleWhere((i) => i[ + 'Description'] + .toString() + .contains( + _selectedReferralFrequancy)); + freqId = freqInfo['ParameterCode'] + .toString(); + myFocusNode.requestFocus(); }) }, items: patientsProv @@ -357,6 +369,7 @@ class _ReferPatientState extends State { padding: const EdgeInsets.all(10.0), child: AppTextFormField( hintText: "Remarks", + focusNode: myFocusNode, controller: _remarksController, inputFormatter: ONLY_LETTERS, textInputType: TextInputType.text, @@ -364,14 +377,27 @@ class _ReferPatientState extends State { ), ), Padding( - padding: const EdgeInsets.all(20.0), - child: AppButton(title: "Send", color: Color(PRIMARY_COLOR),onPressed: ()=>{ - referToDoctor(context) - },), - ) + padding: const EdgeInsets.all(20.0), + child: Column( + children: [ + AppText( + "Please fill all fields..!", + color: Colors.red, + fontWeight: FontWeight.bold, + margin: 10, + visibility: + isValid == null ? false : !isValid, + ), + AppButton( + title: "Send", + color: Color(PRIMARY_COLOR), + onPressed: () => {referToDoctor(context)}, + ) + ], + )) ], ), - ), + ), ); } @@ -456,21 +482,35 @@ class _ReferPatientState extends State { return time; } - void referToDoctor(context){ + void referToDoctor(context) { + if (!validation()) { + return; + } + final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; patientsProv.referToDoctor(context, - extension: _extController.value.text, - admissionNo:int.parse( patient.admissionNo), - referringDoctorRemarks: _remarksController.value.text, - frequency: freqId, - patientID: patient.patientId, - patientTypeID: patient.patientType, - priority: (_activePriority + 1).toString(), - roomID: patient.roomId, - selectedClinicID: clinicId.toString(), - selectedDoctorID: doctorId.toString(), - projectID: patient.projectId - ); + extension: _extController.value.text, + admissionNo: int.parse(patient.admissionNo), + referringDoctorRemarks: _remarksController.value.text, + frequency: freqId, + patientID: patient.patientId, + patientTypeID: patient.patientType, + priority: (_activePriority + 1).toString(), + roomID: patient.roomId, + selectedClinicID: clinicId.toString(), + selectedDoctorID: doctorId.toString(), + projectID: patient.projectId); + } + + bool validation() { + setState(() { + isValid = !_extController.value.text.isNullOrEmpty() && + !_remarksController.value.text.isNullOrEmpty() && + freqId != null && + clinicId != null && + doctorId != null; + }); + return isValid; } } diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index fd50ad66..06dfb9e7 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -18,7 +18,8 @@ class AppTextFormField extends FormField { TextEditingController controller, bool autovalidate = true, TextInputType textInputType, - String hintText + String hintText, + FocusNode focusNode }) : super( onSaved: onSaved, validator: validator, @@ -27,6 +28,7 @@ class AppTextFormField extends FormField { return Column( children: [ TextFormField( + focusNode: focusNode, keyboardType: textInputType, inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)),], onChanged: onChanged?? (value){ From 8da67db69fa85a29c10eb11c80c19ed0c268a77b Mon Sep 17 00:00:00 2001 From: ibrahim albitar Date: Sun, 14 Jun 2020 16:38:38 +0300 Subject: [PATCH 13/14] fix patient type dropdown --- lib/config/config.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 2bd1256d..1a4b5694 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -24,7 +24,7 @@ const GET_PATIENT_LAB_OREDERS = const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; -var selectedPatientType = 0; +var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ var SERVICES_PATIANT = [ From 94dbecca4a087215c8e995908cca146988af1fc9 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Sun, 14 Jun 2020 17:03:00 +0300 Subject: [PATCH 14/14] fix issues in login --- lib/main.dart | 2 ++ lib/root_page.dart | 2 +- lib/widgets/shared/app_scaffold_widget.dart | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 470c5d52..d5f65406 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import './providers/auth_provider.dart'; import './providers/patients_provider.dart'; import './providers/hospital_provider.dart'; import './routes.dart'; +import 'config/config.dart'; void main() => runApp(MyApp()); @@ -18,6 +19,7 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { + AppGlobal.CONTEX = context; return LayoutBuilder( builder: (context, constraints) { return OrientationBuilder(builder: (context, orientation) { diff --git a/lib/root_page.dart b/lib/root_page.dart index a784183b..e361e42c 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -5,13 +5,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'config/config.dart'; import 'landing_page.dart'; class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { AuthProvider authProvider = Provider.of(context); - Widget buildRoot() { switch (authProvider.stutas) { case APP_STATUS.LOADING: diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index efdb0521..824ba11b 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -13,6 +14,7 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { + AppGlobal.CONTEX = context; return Scaffold( backgroundColor: Hexcolor('#F5F5F5'), appBar: appBarTitle != ''