diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 59f8c9c6..9312f255 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -152,7 +152,7 @@ class PatientSearchViewModel extends BaseViewModel{ setState(ViewState.Busy); else setState(ViewState.BusyLocal); - await _inPatientService.getInPatientList(requestModel, isMyInpatient); + await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; setState(ViewState.Error); diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 2a3f3839..7d41b3cb 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -101,32 +101,60 @@ class _PatientInPatientScreenState extends State { // const SizedBox( // height: 16, // ), - ...model.filteredInPatientItems.map((item) { - return PatientCard( - patientInfo: item, - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: _activeTab!=0? false:item.doctorId==model.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + ...List.generate(model.filteredInPatientItems.length, (index) { + if(_activeTab == 0) + return PatientCard( + patientInfo: model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { - "patient": item, - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - }).toList(), + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else if(model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID && _activeTab==1) + return PatientCard( + patientInfo: model.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: model.filteredInPatientItems[index].doctorId==model.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context) + .pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else return SizedBox(); + }), + SizedBox(height: 15,) ], ), ), @@ -173,12 +201,14 @@ class _PatientInPatientScreenState extends State { if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } - GifLoaderDialogUtils.showMyDialog( - context); - await model.getInPatientList(requestModel, - isMyInpatient: _activeTab == 1, isFirstTime: false); - GifLoaderDialogUtils.hideDialog( - context); + if (_activeTab==0) { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getInPatientList(requestModel, + isMyInpatient: _activeTab == 1, isFirstTime: false); + GifLoaderDialogUtils.hideDialog( + context); + } }, child: Center( child: Container( diff --git a/lib/util/dr_app_shared_pref.dart b/lib/util/dr_app_shared_pref.dart index 2f6f3232..bac296bf 100644 --- a/lib/util/dr_app_shared_pref.dart +++ b/lib/util/dr_app_shared_pref.dart @@ -92,7 +92,8 @@ class DrAppSharedPreferances { clear() async { final SharedPreferences prefs = await _prefs; - prefs.clear(); + var vvas= await prefs.clear(); + var asd; } remove(String key) async {