From cbc38940ea57bf3ae3d7328c8180b23ed4013982 Mon Sep 17 00:00:00 2001 From: devamirsaleemahmad Date: Mon, 6 Nov 2023 10:50:16 +0300 Subject: [PATCH] changes --- lib/core/service/client/base_app_client.dart | 4 +- lib/main.dart | 3 + lib/pages/BookAppointment/BookConfirm.dart | 38 +- .../components/DocAvailableAppointments.dart | 3 +- lib/pages/MyAppointments/SchedulePage.dart | 2 +- lib/pages/landing/landing_page.dart | 2 +- lib/pages/login/confirm-login.dart | 17 +- .../medical/labs/laboratory_result_page.dart | 2 +- .../prescription_items_page.dart | 701 +++++++++--------- lib/widgets/avatar/large_avatar.dart | 17 +- .../LabResult/laboratory_result_widget.dart | 7 +- lib/widgets/dialogs/confirm_dialog.dart | 6 +- lib/widgets/new_design/doctor_header.dart | 54 +- lib/widgets/otp_widget.dart | 36 +- 14 files changed, 459 insertions(+), 433 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a64eee6b..fc5a17ed 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -151,8 +151,8 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - body?['PatientID'] = 1231755; //3844083 - body?['TokenID'] = "@dm!n"; + // body?['PatientID'] = 1231755; //3844083 + // body?['TokenID'] = "@dm!n"; // Patient ID: 3027574 // Mobile no.: 0502303285 diff --git a/lib/main.dart b/lib/main.dart index f77f766e..a03e54b4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -69,6 +69,9 @@ class _MyApp extends State { //0537503378 //1231755 + //2466305493 + //0567184134 mobile + // checkForUpdate() { // // todo need to verify 'imp' diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 29408ad1..09170c2c 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -98,7 +98,7 @@ class _BookConfirmState extends State { widget.doctor.projectName!, null, null, - widget.doctor.nationalityFlagURL!, + widget.doctor.nationalityFlagURL ?? "", widget.doctor.doctorRate, null, widget.doctor.noOfPatientsRate, @@ -212,7 +212,7 @@ class _BookConfirmState extends State { disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), elevation: 0, onPressed: () async { - bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false; if (isLiveCareSchedule != null && isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { @@ -257,12 +257,12 @@ class _BookConfirmState extends State { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async { ConfirmDialog.closeAlertDialog(context); GifLoaderDialogUtils.showMyDialog(context); - DoctorsListService service = new DoctorsListService(); - bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + DoctorsListService service = DoctorsListService(); + bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false; service.cancelAppointment(appo, context, isReschedule: true).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () async { + Future.delayed(Duration(milliseconds: 1500), () async { if (isLiveCareSchedule != null && isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { @@ -285,7 +285,7 @@ class _BookConfirmState extends State { getPatientShare(context, appointmentNo, docObject.clinicID!, docObject.projectID!, docObject); getToDoCount(); } else { - ConfirmDialog dialog = new ConfirmDialog( + ConfirmDialog dialog = ConfirmDialog( isDissmissable: false, context: context, confirmMessage: res['ErrorEndUserMessage'], @@ -334,8 +334,7 @@ class _BookConfirmState extends State { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); - Future.delayed(new Duration(milliseconds: 500), () { - + Future.delayed(Duration(milliseconds: 500), () { // checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); getToDoCount(); getPatientShare(context, res['AppointmentNo'], docObject.clinicID!, docObject.projectID!, docObject); @@ -350,7 +349,7 @@ class _BookConfirmState extends State { projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor); } else { GifLoaderDialogUtils.hideDialog(context); - appo = new AppoitmentAllHistoryResultList(); + appo = AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; appo.projectID = res['SameClinicApptList'][0]['ProjectID']; @@ -362,13 +361,14 @@ class _BookConfirmState extends State { appo.originalProjectID = 0; appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: res['ErrorEndUserMessage'], - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {cancelAppointment(docObject, appo, context)}, - cancelFunction: () => {}); + ConfirmDialog dialog = ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}, + ); dialog.showAlertDialog(context); } }).catchError((err) { @@ -382,10 +382,12 @@ class _BookConfirmState extends State { insertLiveCareScheduledAppointment(context, DoctorList docObject) { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; - widget.selectedTime = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); + widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service.insertLiveCareScheduleAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { + widget.service + .insertLiveCareScheduleAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, context) + .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 6ad979fc..791998c4 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -84,7 +84,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); + isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false; if (isLiveCareSchedule != null && isLiveCareSchedule) getDoctorScheduledFreeSlots(context, widget.doctor); else { @@ -471,7 +471,6 @@ class MeetingDataSource extends CalendarDataSource { } return meetingData; } - } class Meeting { diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index fd4e20ea..0731ab0a 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -106,7 +106,7 @@ class _SchedulePageState extends State { Expanded( flex: 1, child: Padding( - padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), + padding: projectViewModel.isArabic ? EdgeInsets.only(right: 17) : EdgeInsets.only(left: 17), child: Row(children: [ Column( children: [ diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index d4208b5a..5bb66735 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -650,7 +650,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); model.setState(model.count, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); - FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); + FlutterAppIconBadge.updateBadge(int.parse(notificationCount.split("+").first)); } }), }); diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index eaafa552..fd4be2a1 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -53,13 +53,13 @@ class ConfirmLogin extends StatefulWidget { class _ConfirmLogin extends State { final LocalAuthentication auth = LocalAuthentication(); var _availableBiometrics; - var sharedPref = new AppSharedPreferences(); - late bool authenticated; - final authService = new AuthProvider(); + var sharedPref = AppSharedPreferences(); + bool authenticated = false; + final authService = AuthProvider(); PharmacyModuleViewModel pharmacyModuleViewModel = locator(); late int mobileNumber; String errorMsg = ''; - late SelectDeviceIMEIRES user; + SelectDeviceIMEIRES user = SelectDeviceIMEIRES(); bool isLoading = false; var registerd_data; bool isMoreOption = false; @@ -84,7 +84,7 @@ class _ConfirmLogin extends State { late bool _loading; - late int fingrePrintBefore; + int fingrePrintBefore = 0; AuthenticatedUserObject authenticatedUserObject = locator(); AppointmentRateViewModel appointmentRateViewModel = locator(); @@ -139,7 +139,7 @@ class _ConfirmLogin extends State { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), Text( - user.name!.toLowerCase().capitalizeFirstofEach, + user.name!.toLowerCase().capitalizeFirstofEach, style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), ), SizedBox(height: 10), @@ -632,7 +632,8 @@ class _ConfirmLogin extends State { sharedPref.remove(FAMILY_FILE), result.list.isFamily = false, userData = result.list, - sharedPref.setString(BLOOD_TYPE, result.patientBloodType), + sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? "O+"), + //Remove o+ from here Added by Aamir authenticatedUserObject.user = result.list, projectViewModel.setPrivilege(privilegeList: res), sharedPref.setObject(MAIN_USER, result.list), @@ -658,9 +659,9 @@ class _ConfirmLogin extends State { } }) .catchError((err) { - print(err); GifLoaderDialogUtils.hideDialog(context); Future.delayed(Duration(seconds: 1), () { + print(err); AppToast.showErrorToast(message: err); startSMSService(tempType); }); diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index c5cea5b2..91543690 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -38,7 +38,7 @@ class _LaboratoryResultPageState extends State { clinicID: widget.patientLabOrders!.clinicID!, projectID: widget.patientLabOrders!.projectID!, orderNo: widget.patientLabOrders!.orderNo!, - setupID: widget.patientLabOrders!.setupID!, + setupID: widget.patientLabOrders!.setupID ?? "0", isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)), ), builder: (_, model, w) => AppScaffold( diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index a7094c3e..432c811b 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; @@ -29,7 +30,7 @@ class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; late ProjectViewModel projectViewModel; - PrescriptionItemsPage({ Key? key, required this.prescriptions}); + PrescriptionItemsPage({Key? key, required this.prescriptions}); @override Widget build(BuildContext context) { @@ -42,373 +43,379 @@ class PrescriptionItemsPage extends StatelessWidget { baseViewModel: model, showNewAppBar: true, showNewAppBarTitle: true, - body: model.state != ViewState.Busy ? Column( - children: [ - Expanded( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - DoctorHeader( - headerModel: HeaderModel( - prescriptions.doctorName!, - prescriptions.doctorID!, - prescriptions.doctorImageURL!, - prescriptions.speciality ?? [""], - "", - prescriptions.name!, - DateUtil.convertStringToDate(prescriptions.appointmentDate!), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!)), - prescriptions.nationalityFlagURL!, - prescriptions.doctorRate, - prescriptions.actualDoctorRate, - prescriptions.noOfPatientsRate, - projectViewModel.user!.emailAddress!, - ), - isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, - showConfirmMessageDialog: false, - onTap: () { - showConfirmMessage(context, model); - }, - ), - if (!prescriptions.isInOutPatient!) - model.prescriptionReportListINP.length > 0 - ? ListView.separated( - itemBuilder: (context, index) { - return InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPageINP( - prescriptionReport: model.prescriptionReportListINP[index], - prescriptions: prescriptions, - ), - ), - ); - }, - child: Container( - width: double.infinity, - child: Container( - margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), - decoration: cardRadius(12), - child: Padding( - padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + body: model.state != ViewState.Busy + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + DoctorHeader( + headerModel: HeaderModel( + prescriptions.doctorName!, + prescriptions.doctorID!, + prescriptions.doctorImageURL!, + prescriptions.speciality ?? [""], + "", + prescriptions.name!, + DateUtil.convertStringToDate(prescriptions.appointmentDate!), + DateUtil.formatDateToTime( + DateUtil.convertStringToDate( + model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!, + ), + ), + prescriptions.nationalityFlagURL!, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, + projectViewModel.user.emailAddress!, + ), + isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, + showConfirmMessageDialog: false, + onTap: () { + showConfirmMessage(context, model); + }, + ), + if (!prescriptions.isInOutPatient!) + model.prescriptionReportListINP.length > 0 + ? ListView.separated( + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPageINP( + prescriptionReport: model.prescriptionReportListINP[index], + prescriptions: prescriptions, + ), + ), + ); + }, + child: Container( + width: double.infinity, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), + decoration: cardRadius(12), + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( children: [ - Text( - model.prescriptionReportListINP[index].itemDescription!.isNotEmpty - ? model.prescriptionReportListINP[index].itemDescription! - : model.prescriptionReportListINP[index].itemDescriptionN ?? '', - style: TextStyle( - fontSize: 16, - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ), - ), - mHeight(10), - Row( - children: [ - // InkWell( - // child: Stack( - // alignment: Alignment.center, - // children: [ - // Container( - // child: Image.network( - // model.prescriptionReportListINP[index].imageSRCUrl, - // fit: BoxFit.cover, - // width: 60, - // height: 60, - // ), - // margin: EdgeInsets.zero, - // clipBehavior: Clip.antiAlias, - // decoration: cardRadius(2000), - // ), - // Container( - // child: Icon( - // Icons.search, - // size: 18, - // color: Colors.white, - // ), - // padding: EdgeInsets.all(6), - // decoration: containerRadius(Colors.black.withOpacity(0.3), 200), - // ) - // ], - // ), - // onTap: () { - // showZoomImageDialog( - // context, - // model.prescriptionReportListINP[index].imageSRCUrl, - // ); - // }, - // ), - // mWidth(12), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - TranslationBase.of(context).route + ": ", - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), - Text( - model.prescriptionReportListINP[index].route!, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.prescriptionReportListINP[index].itemDescription!.isNotEmpty + ? model.prescriptionReportListINP[index].itemDescription! + : model.prescriptionReportListINP[index].itemDescriptionN ?? '', + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), - Row( - children: [ - Text( - TranslationBase.of(context).dailyDoses + ": ", - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, + ), + mHeight(10), + Row( + children: [ + // InkWell( + // child: Stack( + // alignment: Alignment.center, + // children: [ + // Container( + // child: Image.network( + // model.prescriptionReportListINP[index].imageSRCUrl, + // fit: BoxFit.cover, + // width: 60, + // height: 60, + // ), + // margin: EdgeInsets.zero, + // clipBehavior: Clip.antiAlias, + // decoration: cardRadius(2000), + // ), + // Container( + // child: Icon( + // Icons.search, + // size: 18, + // color: Colors.white, + // ), + // padding: EdgeInsets.all(6), + // decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + // ) + // ], + // ), + // onTap: () { + // showZoomImageDialog( + // context, + // model.prescriptionReportListINP[index].imageSRCUrl, + // ); + // }, + // ), + // mWidth(12), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + TranslationBase.of(context).route + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].route!, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), - ), - Text( - model.prescriptionReportListINP[index].doseDailyQuantity.toString(), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, + Row( + children: [ + Text( + TranslationBase.of(context).dailyDoses + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].doseDailyQuantity.toString(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], ), - ), - ], - ), - mHeight(12), - Text( - model.prescriptionReportListINP[index].remarks!, - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), - ], - ) - ], + mHeight(12), + Text( + model.prescriptionReportListINP[index].remarks!, + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ) + ], + ), + ], + ), + ), + Icon( + Icons.arrow_forward, + size: 16, ), ], ), ), - Icon( - Icons.arrow_forward, - size: 16, - ), - ], - ), - ), - ), - ), - ); - }, - separatorBuilder: (context, index) { - return mHeight(8); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: model.prescriptionReportListINP.length) - : Padding( - padding: const EdgeInsets.only(top: 150.0), - child: getNoDataWidget(context), - ) - else - model.prescriptionReportEnhList.length > 0 - ? ListView.separated( - padding: EdgeInsets.all(21), - itemBuilder: (context, index) { - return InkWell( - onTap: () { - PrescriptionReport prescriptionReport = PrescriptionReport( - imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model.prescriptionReportEnhList[index].itemDescription, - itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, - routeN: model.prescriptionReportEnhList[index].route, - frequency: model.prescriptionReportEnhList[index].frequency, - frequencyN: model.prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: model.prescriptionReportEnhList[index].itemID, - orderDate: model.prescriptionReportEnhList[index].orderDate, - startDate: model.prescriptionReportEnhList[index].startDate, - remarks: model.prescriptionReportEnhList[index].remarks); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: prescriptionReport, - prescriptions: prescriptions, - ), - ), - ); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), + ), ), - ], - ), - child: Padding( - padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ); + }, + separatorBuilder: (context, index) { + return mHeight(8); + }, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.prescriptionReportListINP.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), + ) + else + model.prescriptionReportEnhList.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + PrescriptionReport prescriptionReport = PrescriptionReport( + imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model.prescriptionReportEnhList[index].itemDescription, + itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, + routeN: model.prescriptionReportEnhList[index].route, + frequency: model.prescriptionReportEnhList[index].frequency, + frequencyN: model.prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: model.prescriptionReportEnhList[index].itemID, + orderDate: model.prescriptionReportEnhList[index].orderDate, + startDate: model.prescriptionReportEnhList[index].startDate, + remarks: model.prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + prescriptions: prescriptions, + ), + ), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( children: [ - Text( - (model.prescriptionReportEnhList[index].itemDescription!.isNotEmpty - ? model.prescriptionReportEnhList[index].itemDescription - : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') - !.toLowerCase() - .capitalizeFirstofEach, - style: TextStyle( - fontSize: 16, - color: Color(0xff2E303A), - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ), - ), - mHeight(10), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // InkWell( - // child: Stack( - // alignment: Alignment.center, - // children: [ - // Container( - // child: Image.network( - // model.prescriptionReportEnhList[index].imageSRCUrl, - // fit: BoxFit.cover, - // width: 60, - // height: 60, - // ), - // margin: EdgeInsets.zero, - // clipBehavior: Clip.antiAlias, - // decoration: cardRadius(2000), - // ), - // Container( - // child: Icon( - // Icons.search, - // size: 18, - // color: Colors.white, - // ), - // padding: EdgeInsets.all(6), - // decoration: containerRadius(Colors.black.withOpacity(0.3), 200), - // ) - // ], - // ), - // onTap: () { - // showZoomImageDialog( - // context, - // model.prescriptionReportEnhList[index].imageSRCUrl, - // ); - // }, - // ), - // mWidth(12), - Expanded( - child: Column( + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (model.prescriptionReportEnhList[index].itemDescription!.isNotEmpty + ? model.prescriptionReportEnhList[index].itemDescription + : model.prescriptionReportEnhList[index].itemDescriptionN ?? '')! + .toLowerCase() + .capitalizeFirstofEach, + style: TextStyle( + fontSize: 16, + color: Color(0xff2E303A), + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + mHeight(10), + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route!, projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), - projectViewModel.isArabic), - mHeight(9), - Text( - model.prescriptionReportEnhList[index].remarks!, - style: TextStyle( - color: Color(0xff575757), - fontSize: 12, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, + // InkWell( + // child: Stack( + // alignment: Alignment.center, + // children: [ + // Container( + // child: Image.network( + // model.prescriptionReportEnhList[index].imageSRCUrl, + // fit: BoxFit.cover, + // width: 60, + // height: 60, + // ), + // margin: EdgeInsets.zero, + // clipBehavior: Clip.antiAlias, + // decoration: cardRadius(2000), + // ), + // Container( + // child: Icon( + // Icons.search, + // size: 18, + // color: Colors.white, + // ), + // padding: EdgeInsets.all(6), + // decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + // ) + // ], + // ), + // onTap: () { + // showZoomImageDialog( + // context, + // model.prescriptionReportEnhList[index].imageSRCUrl, + // ); + // }, + // ), + // mWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), + projectViewModel.isArabic), + mHeight(9), + Text( + model.prescriptionReportEnhList[index].remarks!, + style: TextStyle( + color: Color(0xff575757), + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], ), - ), + ) ], ), - ) - ], + ], + ), + ), + Icon( + Icons.arrow_forward, + size: 16, ), ], ), ), - Icon( - Icons.arrow_forward, - size: 16, - ), - ], - ), - ), + ), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: model.prescriptionReportEnhList.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), ), - ); - }, - separatorBuilder: (context, index) { - return mHeight(12); - }, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: model.prescriptionReportEnhList.length) - : Padding( - padding: const EdgeInsets.only(top: 150.0), - child: getNoDataWidget(context), - ), - ], - ), - ), - ), - Container( - color: Colors.white, - padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).resendOrder, - () { - if (model.isMedDeliveryAllowed == false) { - AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError); - } else { - Navigator.push( - context, - FadePage( - page: PrescriptionDeliveryAddressPage( - prescriptions: prescriptions, - prescriptionReportList: model.prescriptionReportList, - prescriptionReportEnhList: model.prescriptionReportEnhList, - ), + ], ), - ); - } - }, - color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846), - disabledColor: Color(0xff575757), - ), - ), - ], - ) : Container(), + ), + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).resendOrder, + () { + if (model.isMedDeliveryAllowed == false) { + AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError); + } else { + Navigator.push( + context, + FadePage( + page: PrescriptionDeliveryAddressPage( + prescriptions: prescriptions, + prescriptionReportList: model.prescriptionReportList, + prescriptionReportEnhList: model.prescriptionReportEnhList, + ), + ), + ); + } + }, + color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846), + disabledColor: Color(0xff575757), + ), + ), + ], + ) + : Container(), ), ); } diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index cc308cf8..1bae6ed9 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -14,7 +14,7 @@ import '../show_zoom_image_dialog.dart'; /// [height] the avatar height /// [onTap] on tap function class LargeAvatar extends StatelessWidget { - LargeAvatar({Key? key, this.name, this.url, this.disableProfileView= false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar= false}) : super(key: key); + LargeAvatar({Key? key, this.name, this.url, this.disableProfileView = false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar = false}) : super(key: key); final String? name; final String? url; @@ -41,7 +41,11 @@ class LargeAvatar extends StatelessWidget { ), if (!disableProfileView && !isAppointmentAvatar) Container( - child: Icon(Icons.search,size: 18,color: Colors.white,), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), padding: EdgeInsets.all(6), decoration: containerRadius(Colors.black.withOpacity(0.3), 200), ) @@ -63,10 +67,11 @@ class LargeAvatar extends StatelessWidget { return InkWell( onTap: disableProfileView ? null - : isAppointmentAvatar ? onTap : () { - print("ssssss " + url!.trim()); - showZoomImageDialog(context, url!.trim() ?? ""); - }, + : isAppointmentAvatar + ? onTap + : () { + showZoomImageDialog(context, url!.trim() ?? ""); + }, child: Container( decoration: BoxDecoration( // gradient: LinearGradient( diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index 11c233f4..0234c3e3 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -36,7 +36,8 @@ class _LaboratoryResultWidgetState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!), + onModelReady: (model) => + model.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!), builder: (_, model, w) => NetworkBaseView( baseViewModel: model, child: Column( @@ -45,7 +46,7 @@ class _LaboratoryResultWidgetState extends State { DoctorHeader( headerModel: HeaderModel( widget.patientLabOrder!.doctorName!, - widget.patientLabOrder!.doctorID!, + widget.patientLabOrder!.doctorID ?? 0, widget.patientLabOrder!.doctorImageURL!, widget.patientLabOrder!.speciality ?? [""], widget.billNo!, @@ -56,7 +57,7 @@ class _LaboratoryResultWidgetState extends State { widget.patientLabOrder!.doctorRate!, widget.patientLabOrder!.actualDoctorRate!, widget.patientLabOrder!.noOfPatientsRate!, - projectViewModel.user!.emailAddress!), + projectViewModel.user.emailAddress!), onTap: widget.onTap!, ), SizedBox(height: 10), diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index ddad9084..ce5a1edf 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -16,7 +16,7 @@ class ConfirmDialog { final Function? cancelFunction; final isDissmissable; - ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, required this.okFunction, @required this.cancelFunction, this.isDissmissable = true}); + ConfirmDialog({required this.context, this.title, required this.confirmMessage, required this.okText, required this.cancelText, required this.okFunction, required this.cancelFunction, this.isDissmissable = true}); showAlertDialog(BuildContext context) { Dialog alert = Dialog( @@ -28,8 +28,8 @@ class ConfirmDialog { confirmMessage, okText, cancelText, - cancelFunction: cancelFunction!, - okFunction: okFunction!, + cancelFunction: cancelFunction, + okFunction: okFunction, ), ), ); diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 539ac99d..d0bb9640 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; @@ -41,7 +42,7 @@ class DoctorHeader extends StatelessWidget { @override Widget build(BuildContext context) { - String _speciality = (headerModel?.speciality ?? []).length > 0 ? headerModel!.speciality.first : ""; + String _speciality = (headerModel.speciality ?? []).length > 0 ? headerModel.speciality.first : ""; projectViewModel = Provider.of(context); return Container( color: Colors.white, @@ -53,7 +54,7 @@ class DoctorHeader extends StatelessWidget { Padding( padding: EdgeInsets.only(left: 21, right: 21, bottom: 12), child: Text( - headerModel!.doctorName!, + headerModel.doctorName, maxLines: 1, style: TextStyle( fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), @@ -66,13 +67,15 @@ class DoctorHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ LargeAvatar( - name: headerModel!.doctorName, - url: headerModel!.doctorImageURL, + name: headerModel.doctorName, + url: headerModel.doctorImageURL, width: 51, height: 51, + disableProfileView: headerModel.doctorImageURL.isEmpty && headerModel.doctorImageURL == null ? true : false, ), SizedBox(width: 10), Expanded( + flex: 4, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -101,10 +104,10 @@ class DoctorHeader extends StatelessWidget { headerModel.time ?? DateUtil.formatDateToTime(headerModel.date!), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ), - if (headerModel?.nationalityFlagURL != null) + if (headerModel.nationalityFlagURL != null) Padding( padding: const EdgeInsets.only(top: 8.0), - child: Image.network(headerModel.nationalityFlagURL ?? "", height: 20), + child: headerModel.nationalityFlagURL.isNotEmpty && headerModel.nationalityFlagURL != null ? Image.network(headerModel.nationalityFlagURL, height: 20) : SizedBox(), ), ], ) @@ -291,25 +294,26 @@ class DoctorHeader extends StatelessWidget { // filledIcon: Icons.star, // emptyIcon: Icons.star, // ), - RatingBar( - itemSize: 20.0, - allowHalfRating: true, - initialRating: this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(), - ratingWidget: RatingWidget( - full: Icon( - Icons.star, - color: Color(0XFFD02127), - ), - half: Icon( - Icons.star_half, - color: Color(0XFFD02127), - ), - empty: Icon( - Icons.star_border, - color: Color(0XFFD02127), - ), - ), - onRatingUpdate: (double value) {}), + RatingBar( + itemSize: 20.0, + allowHalfRating: true, + initialRating: + this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(), + ratingWidget: RatingWidget( + full: Icon( + Icons.star, + color: Color(0XFFD02127), + ), + half: Icon( + Icons.star_half, + color: Color(0XFFD02127), + ), + empty: Icon( + Icons.star_border, + color: Color(0XFFD02127), + ), + ), + onRatingUpdate: (double value) {}), // RatingBar( // initialRating: this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(), // //size: 15.0, diff --git a/lib/widgets/otp_widget.dart b/lib/widgets/otp_widget.dart index 99d0f2f5..d606090d 100644 --- a/lib/widgets/otp_widget.dart +++ b/lib/widgets/otp_widget.dart @@ -23,7 +23,7 @@ class ProvidedPinBoxTextAnimation { class OTPWidget extends StatefulWidget { final int maxLength; - late TextEditingController? controller; + late TextEditingController? controller; final Color defaultBorderColor; final Color pinBoxColor; @@ -47,7 +47,7 @@ class OTPWidget extends StatefulWidget { final TextInputType keyboardType; final EdgeInsets pinBoxOuterPadding; - OTPWidget({ + OTPWidget({ Key? key, this.maxLength = 4, this.controller, @@ -58,14 +58,14 @@ class OTPWidget extends StatefulWidget { this.defaultBorderColor = Colors.black, this.textBorderColor = Colors.black, this.pinTextAnimatedSwitcherTransition, - this.pinTextAnimatedSwitcherDuration= const Duration(), - this.hasError= false, - this.errorBorderColor= Colors.red, + this.pinTextAnimatedSwitcherDuration = const Duration(), + this.hasError = false, + this.errorBorderColor = Colors.red, this.onTextChanged, - this.autoFocus= false, + this.autoFocus = false, this.focusNode, - this.textDirection= TextDirection.ltr, - this.keyboardType= TextInputType.number, + this.textDirection = TextDirection.ltr, + this.keyboardType = TextInputType.number, this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0), this.pinBoxColor = Colors.white, this.pinBoxBorderWidth = 2.0, @@ -80,7 +80,7 @@ class OTPWidget extends StatefulWidget { } class OTPWidgetState extends State with SingleTickerProviderStateMixin { - late AnimationController _highlightAnimationController; + late AnimationController _highlightAnimationController; late FocusNode focusNode; String text = ""; int currentIndex = 0; @@ -121,11 +121,11 @@ class OTPWidgetState extends State with SingleTickerProviderStateMixi void initState() { super.initState(); focusNode = widget.focusNode ?? FocusNode(); - + _highlightAnimationController = AnimationController(vsync: this); _initTextController(); _calculateStrList(); - widget.controller?.addListener(_controllerListener); - focusNode?.addListener(_focusListener); + widget.controller!.addListener(_controllerListener); + focusNode.addListener(_focusListener); } void _controllerListener() { @@ -182,11 +182,11 @@ class OTPWidgetState extends State with SingleTickerProviderStateMixi @override void dispose() { if (widget.focusNode == null) { - focusNode?.dispose(); + focusNode.dispose(); } else { - focusNode?.removeListener(_focusListener); + focusNode.removeListener(_focusListener); } - _highlightAnimationController?.dispose(); + _highlightAnimationController.dispose(); widget.controller?.removeListener(_controllerListener); super.dispose(); @@ -295,7 +295,11 @@ class OTPWidgetState extends State with SingleTickerProviderStateMixi List pinCodes = List.generate(widget.maxLength, (int i) { return _buildPinCode(i, context); }); - return Row(children: pinCodes, mainAxisSize: MainAxisSize.min,mainAxisAlignment: MainAxisAlignment.spaceBetween,); + return Row( + children: pinCodes, + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + ); } Widget _buildPinCode(int i, BuildContext context) {