From a97a331d87f6f092947f66632339e778526036e3 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 18 May 2021 17:46:32 +0300 Subject: [PATCH] fix bugs in change the clinic, login page when get the projects and add the special Result --- ios/Podfile.lock | 2 +- lib/core/viewModel/dashboard_view_model.dart | 9 +-- lib/screens/auth/login_screen.dart | 15 ++-- .../lab_result/laboratory_result_page.dart | 3 +- .../lab_result/laboratory_result_widget.dart | 73 ++++++++++++++++++- .../profile/lab_result/labs_home_page.dart | 2 +- ..._header_with_appointment_card_app_bar.dart | 23 +----- 7 files changed, 88 insertions(+), 39 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2f4607e0..878a1850 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -322,4 +322,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0.rc.1 +COCOAPODS: 1.10.1 diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index f37a8feb..a1f83293 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -53,14 +53,7 @@ class DashboardViewModel extends BaseViewModel { Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); await getDoctorProfile(); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: clinicId, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); - ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: doctorProfile.clinicID, projectID: doctorProfile.projectID,); + ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: clinicId, projectID: doctorProfile.projectID,); await authProvider.getDoctorProfileBasedOnClinic(clinicModel); if(authProvider.state == ViewState.ErrorLocal) { error = authProvider.error; diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 84517932..f3f03fe8 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -166,14 +166,14 @@ class _LoginScreenState extends State { value .trim(); }); - if(allowCallApi) { + // if(allowCallApi) { this.getProjects( authenticationViewModel.userInfo .userID); - setState(() { - allowCallApi = false; - }); - } + // setState(() { + // allowCallApi = false; + // }); + // } }, onClick: (){ @@ -280,10 +280,11 @@ class _LoginScreenState extends State { primaryFocus.unfocus(); } - + String memberID =""; getProjects(memberID)async { if (memberID != null && memberID != '') { - if (projectsList.length == 0) { + if (this.memberID !=memberID) { + this.memberID = memberID; await authenticationViewModel.getHospitalsList(memberID); if(authenticationViewModel.state == ViewState.Idle) { projectsList = authenticationViewModel.hospitals; diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index 1c5104f8..e54a3782 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -52,7 +52,8 @@ class _LaboratoryResultPageState extends State { invoiceNO: widget.patientLabOrders.invoiceNo, ), baseViewModel: model, - body: Scaffold( + body: AppScaffold( + isShowAppBar: false, body: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 810f025f..bc6fcbcb 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class LaboratoryResultWidget extends StatefulWidget { @@ -37,6 +38,7 @@ class LaboratoryResultWidget extends StatefulWidget { class _LaboratoryResultWidgetState extends State { bool _isShowMoreGeneral = true; + bool _isShowMore = true; ProjectViewModel projectViewModel; @override @@ -141,9 +143,76 @@ class _LaboratoryResultWidgetState extends State { ], ), ), - SizedBox( - height: 10, + SizedBox(height: 15,), + if(widget.details!=null && widget.details.isNotEmpty) + Column( + children: [ + InkWell( + onTap: () { + setState(() { + _isShowMore = !_isShowMore; + }); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .specialResult, + bold: true, + ))), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMore + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), + ), + ), + if (_isShowMore) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + )), + duration: Duration(milliseconds: 7000), + child: Container( + width: double.infinity, + child: Html( + data: widget.details ?? TranslationBase.of(context).noDataAvailable, + )), + ), + SizedBox( + height: 10, + ), + ], ), + + ], ), ], diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index f60e875a..5c65ceb4 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -199,7 +199,7 @@ class _LabsHomePageState extends State { clinic: model .patientLabOrdersList[index].clinicDescription, appointmentDate: - model.patientLabOrdersList[index].orderDate, + model.patientLabOrdersList[index].orderDate.add(Duration(days: 1)), orderNo: model.patientLabOrdersList[index].orderNo, isShowTime: false, ), diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart index 2e47b211..9093566b 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart @@ -103,7 +103,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - launch("tel://" + patient.mobileNumber); + launch("tel://" + patient?.mobileNumber??""); }, child: Icon( Icons.phone, @@ -235,7 +235,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget style: TextStyle( fontSize: 12, fontFamily: 'Poppins')), new TextSpan( - text: patient.patientId.toString(), + text: patient?.patientId?.toString() ?? "", style: TextStyle( fontWeight: FontWeight.w700, fontFamily: 'Poppins', @@ -256,7 +256,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( - patient.nationalityFlagURL, + patient?.nationalityFlagURL??"", height: 25, width: 30, errorBuilder: (BuildContext context, @@ -355,7 +355,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget AppText('Invoice: ', color: Colors.grey[800], fontSize: 12), - AppText(invoiceNO, fontSize: 12) + AppText(invoiceNO??"", fontSize: 12) ], ), if (branch != null) @@ -449,22 +449,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget return newDate.toString(); } - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } @override Size get preferredSize => Size(double.maxFinite, 310);