From e2e92c1c59e96236975120f473d03af63b5df8a3 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 18 Mar 2021 20:37:54 +0200 Subject: [PATCH 1/4] Clinic List widget --- lib/screens/patients/patients_screen.dart | 179 ++++++++++++---------- 1 file changed, 100 insertions(+), 79 deletions(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index ed535b47..ac91050e 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -42,7 +42,7 @@ class _PatientsScreenState extends State { List date; List unFilterDate; - var clinicId; + int clinicId; AuthViewModel authProvider; Color sideColor = Colors.black; @@ -340,10 +340,7 @@ class _PatientsScreenState extends State { children: [ Padding( padding: EdgeInsets.only( - top: MediaQuery.of(context) - .size - .height * - 0.03), + top:0), child: SERVICES_PATIANT2[ int.parse(patientType)] == "List_MyOutPatient" @@ -371,80 +368,10 @@ class _PatientsScreenState extends State { height: 10.0, ), if(int.parse(patientType)==7) - projectsProvider - .doctorClinicsList.length > - 0 - ? FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width *0.8, - child: Center( - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: - Colors.white, - iconEnabledColor: - Colors.black, - isExpanded: true, - value: clinicId == null - ? projectsProvider - .doctorClinicsList[ - 0] - .clinicID - : clinicId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext - context) { - return projectsProvider - .doctorClinicsList - .map((item) { - return Row( - mainAxisSize: - MainAxisSize - .max, - children: [ - AppText( - item.clinicName, - fontSize: SizeConfig - .textMultiplier * - 2.1, - color: Colors - .black, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) { - clinicId = newValue; - changeClinic(newValue, context, model); - }, - items: projectsProvider - .doctorClinicsList - .map((item) { - return DropdownMenuItem( - child: Text( - item.clinicName, - textAlign: - TextAlign.end, - ), - value: item.clinicID, - ); - }).toList(), - )), - ), - ), - ], - ), - ) - : AppText( - TranslationBase - .of(context) - .noClinic), + ClinicList(clinicId: clinicId,onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + },), Divider( thickness: 0.8, color: Color(0xffCCCCCC), @@ -663,3 +590,97 @@ class _PatientsScreenState extends State { ); } } + +// ignore: must_be_immutable +class ClinicList extends StatelessWidget { + + ProjectViewModel projectsProvider; + final int clinicId; + final Function (int value) onClinicChange; + + ClinicList({Key key, this.clinicId, this.onClinicChange}) : super(key: key); + + @override + Widget build(BuildContext context) { + // authProvider = Provider.of(context); + + projectsProvider = Provider.of(context); + return Container( + child: + projectsProvider + .doctorClinicsList.length > + 0 + ? FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width *0.8, + child: Center( + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: + Colors.white, + iconEnabledColor: + Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[ + 0] + .clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item.clinicName, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: Colors + .black, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue){ + onClinicChange(newValue); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: + TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + ), + ), + ], + ), + ) + : AppText( + TranslationBase + .of(context) + .noClinic), + ); + } +} + From 42666e2200f9ceaed32249999c47fef0072000b4 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 21 Mar 2021 09:36:01 +0200 Subject: [PATCH 2/4] move clinic list to its own file --- lib/screens/patients/patients_screen.dart | 111 +++--------------- .../patients/clinic_list_dropdwon.dart | 99 ++++++++++++++++ 2 files changed, 116 insertions(+), 94 deletions(-) create mode 100644 lib/widgets/patients/clinic_list_dropdwon.dart diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index ac91050e..e0f3fe0e 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -13,6 +13,7 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/patients/clinic_list_dropdwon.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -312,9 +313,22 @@ class _PatientsScreenState extends State { : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: - TranslationBase.of(context).youDontHaveAnyPatient) + ? Column( + children: [ + if(int.parse(patientType)==7) + ClinicList(clinicId: clinicId,onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + },), + Divider( + thickness: 0.8, + color: Color(0xffCCCCCC), + ), + DrAppEmbeddedError( + error: + TranslationBase.of(context).youDontHaveAnyPatient), + ], + ) : Container( child: ListView( scrollDirection: Axis.vertical, @@ -591,96 +605,5 @@ class _PatientsScreenState extends State { } } -// ignore: must_be_immutable -class ClinicList extends StatelessWidget { - - ProjectViewModel projectsProvider; - final int clinicId; - final Function (int value) onClinicChange; - - ClinicList({Key key, this.clinicId, this.onClinicChange}) : super(key: key); - - @override - Widget build(BuildContext context) { - // authProvider = Provider.of(context); - projectsProvider = Provider.of(context); - return Container( - child: - projectsProvider - .doctorClinicsList.length > - 0 - ? FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width *0.8, - child: Center( - child: DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: - Colors.white, - iconEnabledColor: - Colors.black, - isExpanded: true, - value: clinicId == null - ? projectsProvider - .doctorClinicsList[ - 0] - .clinicID - : clinicId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext - context) { - return projectsProvider - .doctorClinicsList - .map((item) { - return Row( - mainAxisSize: - MainAxisSize - .max, - children: [ - AppText( - item.clinicName, - fontSize: SizeConfig - .textMultiplier * - 2.1, - color: Colors - .black, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue){ - onClinicChange(newValue); - }, - items: projectsProvider - .doctorClinicsList - .map((item) { - return DropdownMenuItem( - child: Text( - item.clinicName, - textAlign: - TextAlign.end, - ), - value: item.clinicID, - ); - }).toList(), - )), - ), - ), - ], - ), - ) - : AppText( - TranslationBase - .of(context) - .noClinic), - ); - } -} diff --git a/lib/widgets/patients/clinic_list_dropdwon.dart b/lib/widgets/patients/clinic_list_dropdwon.dart new file mode 100644 index 00000000..c903bd7b --- /dev/null +++ b/lib/widgets/patients/clinic_list_dropdwon.dart @@ -0,0 +1,99 @@ +// ignore: must_be_immutable +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class ClinicList extends StatelessWidget { + + ProjectViewModel projectsProvider; + final int clinicId; + final Function (int value) onClinicChange; + + ClinicList({Key key, this.clinicId, this.onClinicChange}) : super(key: key); + + @override + Widget build(BuildContext context) { + // authProvider = Provider.of(context); + + projectsProvider = Provider.of(context); + return Container( + child: + projectsProvider + .doctorClinicsList.length > + 0 + ? FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width *0.8, + child: Center( + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: + Colors.white, + iconEnabledColor: + Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[ + 0] + .clinicID + : clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item.clinicName, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: Colors + .black, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue){ + onClinicChange(newValue); + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: + TextAlign.end, + ), + value: item.clinicID, + ); + }).toList(), + )), + ), + ), + ], + ), + ) + : AppText( + TranslationBase + .of(context) + .noClinic), + ); + } +} \ No newline at end of file From 51c6329517c0e0745fc51d975fc6bfd45c730cde Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 21 Mar 2021 10:23:00 +0200 Subject: [PATCH 3/4] return back my code --- lib/screens/patients/patients_screen.dart | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index f645e33b..5da9f397 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,7 +1,11 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_arrival/get_patient_arrival_list_request_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; @@ -301,9 +305,26 @@ class _PatientsScreenState extends State { : _isError ? DrAppEmbeddedError(error: error) : lItems == null || lItems.length == 0 - ? DrAppEmbeddedError( - error: - TranslationBase.of(context).youDontHaveAnyPatient) + ? Column( + children: [ + + if(int.parse(patientType)==7) + Container( + margin: EdgeInsets.only(top: 70), + child: ClinicList(clinicId: clinicId,onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + },), + ), + Container( + margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.35), + + child: DrAppEmbeddedError( + error: + TranslationBase.of(context).youDontHaveAnyPatient), + ), + ], + ) : Container( color: Colors.grey[200], child: ListView( @@ -347,6 +368,11 @@ class _PatientsScreenState extends State { SizedBox( height: 10.0, ), + if(int.parse(patientType)==7) + ClinicList(clinicId: clinicId,onClinicChange: (newValue) { + clinicId = newValue; + changeClinic(newValue, context, model); + },), Padding( padding: EdgeInsets.only( top: MediaQuery.of(context) From 7d85c8b69268d9901430e7b6727bfddacd9fcb3b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 21 Mar 2021 10:26:23 +0200 Subject: [PATCH 4/4] return back the condition --- .../profile/profile_medical_info_widget.dart | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index ee500957..fb0ef609 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -35,7 +35,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { crossAxisCount: 2, childAspectRatio: 1.5, children: [ - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -54,7 +54,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { }, isLoading: model.state == ViewState.BusyLocal, icon: 'create-episod.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -64,7 +64,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -72,7 +72,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).radiology, nameLine2: TranslationBase.of(context).service, icon: 'radiology-1.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -81,7 +81,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine2: TranslationBase.of(context).service, icon: 'lab.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -94,7 +94,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { */ , icon: 'heartbeat.png'), - // if (selectedPatientType != 7) + if (selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, @@ -109,9 +109,9 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), - // if (selectedPatientType != 0 && - // selectedPatientType != 5 && - // selectedPatientType != 7) + if (selectedPatientType != 0 && + selectedPatientType != 5 && + selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, @@ -119,7 +119,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).progress, nameLine2: TranslationBase.of(context).note, icon: 'heartbeat.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -150,7 +150,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).procedures, icon: 'lab.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -158,7 +158,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).myReferral, nameLine2: TranslationBase.of(context).patient, icon: 'note.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, @@ -166,7 +166,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).patientSick, nameLine2: TranslationBase.of(context).leave, icon: 'sick_leaves_icons.png'), - // if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient,