From 5bde14813a3e41efce8dd7289b70ddf3ec2a3f44 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 9 Feb 2021 16:22:22 +0200 Subject: [PATCH 1/2] fixing bugs --- lib/core/viewModel/procedure_View_model.dart | 4 +- .../prescription/prescription_screen.dart | 58 ++++++++++++------- lib/screens/procedures/procedure_screen.dart | 8 +++ lib/screens/procedures/update-procedure.dart | 17 ++++-- lib/widgets/shared/TextFields.dart | 3 +- pubspec.lock | 6 +- 6 files changed, 64 insertions(+), 32 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 6be63be0..440724b7 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -32,7 +32,7 @@ class ProcedureViewModel extends BaseViewModel { Future getProcedureCategory({String categoryName}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _procedureService.getProcedureCategory(categoryName: categoryName); if (_procedureService.hasError) { error = _procedureService.error; @@ -80,6 +80,6 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - // await getProcedure(mrn: mrn); + await getProcedure(mrn: mrn); } } diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 5a212f56..11541e39 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -200,7 +200,7 @@ class _NewPrescriptionScreenState extends State { context) .size .height * - 0.33, + 0.21, width: MediaQuery.of( context) .size @@ -235,11 +235,11 @@ class _NewPrescriptionScreenState extends State { ), ), Container( - height: MediaQuery.of( - context) - .size - .height * - 0.3899, + // height: MediaQuery.of( + // context) + // .size + // .height * + // 0.3499, width: MediaQuery.of( context) .size @@ -348,13 +348,20 @@ class _NewPrescriptionScreenState extends State { 17.0, ), Expanded( - child: AppText( - model - .prescriptionList[0] - .entityList[index] - .indication, - fontSize: 15.0), - ) + child: + RichText( + maxLines: + 3, + overflow: + TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 12.0), + text: TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].indication), + ), + ), ], ), SizedBox( @@ -413,15 +420,24 @@ class _NewPrescriptionScreenState extends State { Expanded( child: Container( - height: - 25, + // height: MediaQuery.of(context).size.height * + // 0.038, child: - AppText( - model.prescriptionList[0].entityList[index].remarks == null - ? "" - : model.prescriptionList[0].entityList[index].remarks, - fontSize: - 12.5, + RichText( + // maxLines: + // 2, + // overflow: + // TextOverflow.ellipsis, + strutStyle: + StrutStyle(fontSize: 10.0), + text: + TextSpan( + style: + TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index].remarks != null + ? model.prescriptionList[0].entityList[index].remarks + : "", + ), ), ), ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index bb897351..28906d07 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -441,6 +441,14 @@ class _ProcedureScreenState extends State { // .updateProcedure(); updateProcedureForm( context, + model: + model, + orderNo: model + .procedureList[ + 0] + .entityList[ + index] + .orderNo, remarks: model .procedureList[ 0] diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index c1dc31f3..3e567c1f 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -14,18 +14,21 @@ import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; void updateProcedureForm(context, {String procedureName, + int orderNo, PatiantInformtion patient, String orderType, String procedureId, String remarks, + ProcedureViewModel model, String categoreId}) { - ProcedureViewModel model = ProcedureViewModel(); + //ProcedureViewModel model2 = ProcedureViewModel(); TextEditingController remarksController = TextEditingController(); TextEditingController orderController = TextEditingController(); showModalBottomSheet( @@ -40,6 +43,7 @@ void updateProcedureForm(context, model: model, procedureId: procedureId, categoryId: categoreId, + orderNo: orderNo, ); }); } @@ -52,6 +56,7 @@ class UpdateProcedureWidget extends StatefulWidget { final TextEditingController remarksController; final String procedureId; final String categoryId; + final int orderNo; UpdateProcedureWidget( {this.model, @@ -60,7 +65,8 @@ class UpdateProcedureWidget extends StatefulWidget { this.remarksController, this.patient, this.procedureId, - this.categoryId}); + this.categoryId, + this.orderNo}); @override _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); } @@ -85,7 +91,7 @@ class _UpdateProcedureWidgetState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => NetworkBaseView( - baseViewModel: model, + baseViewModel: widget.model, child: DraggableScrollableSheet( minChildSize: 0.90, initialChildSize: 0.95, @@ -226,6 +232,7 @@ class _UpdateProcedureWidgetState extends State { controller: widget.remarksController, maxLines: 3, minLines: 2, + onChanged: (value) {}, ), ), SizedBox( @@ -244,6 +251,7 @@ class _UpdateProcedureWidgetState extends State { onPressed: () { Navigator.pop(context); updateProcedure( + orderNo: widget.orderNo, orderType: selectedType.toString(), categorieId: widget.categoryId, procedureId: widget.procedureId, @@ -272,6 +280,7 @@ class _UpdateProcedureWidgetState extends State { updateProcedure( {ProcedureViewModel model, String remarks, + int orderNo, String newProcedureId, String newCategorieId, List entityList, @@ -289,7 +298,7 @@ class _UpdateProcedureWidgetState extends State { updateProcedureReqModel.episodeID = patient.episodeNo; updateProcedureReqModel.patientMRN = patient.patientMRN; updateProcedureReqModel.lineItemNo = 1; - updateProcedureReqModel.orderNo = 0; + updateProcedureReqModel.orderNo = orderNo; controls.add( Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index d2807a26..4972d854 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -246,8 +246,7 @@ class _TextFieldsState extends State { }); } } - - widget.onChanged(value); + if (widget.onChanged != null) widget.onChanged(value); }, focusNode: _focusNode, maxLength: widget.maxLength ?? null, diff --git a/pubspec.lock b/pubspec.lock index 94f07eea..addef845 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -559,7 +559,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -830,7 +830,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: @@ -965,5 +965,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0" From 400f8e25f6fc770132f854bed16f4f55dba056e7 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 9 Feb 2021 21:21:00 +0300 Subject: [PATCH 2/2] bug xis --- lib/config/shared_pref_kay.dart | 1 + lib/screens/dashboard_screen.dart | 9 ++++----- lib/widgets/auth/verification_methods.dart | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 376c8dab..eea2ce76 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -13,3 +13,4 @@ final DASHBOARD_DATA = 'dashboard-data'; final OTP_TYPE = 'otp-type'; final LAST_LOGIN_USER = 'last-login-user'; final PASSWORD = 'password'; +final CLINIC_NAME = 'clinic-name'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 717dbaa6..30dc2700 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -58,6 +58,7 @@ class _DashboardScreenState extends State { DoctorProfileModel profile; bool isExpanded = false; String isInpatient = ""; + var clinicName = []; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -72,7 +73,8 @@ class _DashboardScreenState extends State { .listen((IosNotificationSettings settings) { print("Settings registered: $settings"); }); - + clinicName = await sharedPref.getObj(CLINIC_NAME); + print(clinicName); _firebaseMessaging.getToken().then((String token) async { if (token != '') { DEVICE_TOKEN = token; @@ -721,10 +723,7 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[6]) - : "", + clinicName.length.toString(), fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index b5111704..04a82a80 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -486,7 +486,11 @@ class _VerificationMethodsState extends State { case 3: return InkWell( onTap: () => { - authenticateUser(3, BiometricType.fingerprint.index, authProv) + if (checkIfBiometricAvailable(BiometricType.fingerprint)) + { + authenticateUser( + 3, BiometricType.fingerprint.index, authProv) + } }, child: RoundedContainer( backgroundColor: @@ -518,8 +522,11 @@ class _VerificationMethodsState extends State { break; case 4: return InkWell( - onTap: () => - {authenticateUser(4, BiometricType.face.index, authProv)}, + onTap: () { + if (checkIfBiometricAvailable(BiometricType.face)) { + authenticateUser(4, BiometricType.face.index, authProv); + } + }, child: RoundedContainer( backgroundColor: checkIfBiometricAvailable(BiometricType.face) ? Colors.white @@ -739,7 +746,9 @@ class _VerificationMethodsState extends State { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { loginProcessCompleted(res['List_DoctorProfile'][0], authProv); + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); } else { + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); ClinicModel clinic = ClinicModel.fromJson(res['List_DoctorsClinic'][0]); getDocProfiles(clinic, authProv);