import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; import 'package:doctor_app_flutter/core/viewModel/prescriptions_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_details_page.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; final PatiantInformtion patient; final String patientType; final String arrivalType; PrescriptionItemsPage({Key key, this.prescriptions, this.patient, this.patientType, this.arrivalType}); @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions,patient: patient), builder: (_, model, widget) => AppScaffold( isShowAppBar: false, baseViewModel: model, body: SingleChildScrollView( child: Container( child: Column( children: [ PatientProfileHeaderWhitAppointment(patient: patient, patientType: patientType??"0", arrivalType: arrivalType??"0", branch: '', clinic: prescriptions.clinicDescription, isPrescriptions: true, appointmentDate: DateUtils.getDateTimeFromServerFormat(prescriptions.appointmentDate), doctorName: prescriptions.doctorName, profileUrl: prescriptions.doctorImageURL, // invoiceNO: widget.patientLabOrders.invoiceNo, ), if (!prescriptions.isInOutPatient) ...List.generate( model.prescriptionReportList.length, (index) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.white, ), margin: EdgeInsets.all(12), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(left: 18,right: 18), child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty ? model.prescriptionReportList[index].itemDescription : model.prescriptionReportList[index].itemDescriptionN,bold: true,)), SizedBox(height: 12,), Row( children: [ SizedBox(width: 18,), Container( decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all(width: 0.5,color: Colors.grey) ), height: 55, width: 55, child: Padding( padding: const EdgeInsets.all(8.0), child: Image.network( model.prescriptionReportList[index].imageSRCUrl, fit: BoxFit.cover, ), ), ), SizedBox(width: 10,), Expanded(child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Texts(TranslationBase.of(context).route,color: Colors.grey,), Expanded(child: Texts(model.prescriptionReportList[index].routeN)), ], ), Row( children: [ Texts(TranslationBase.of(context).frequency,color: Colors.grey,), Texts(model.prescriptionReportList[index].frequencyN ?? ''), ], ), SizedBox(height: 12,), Texts(model.prescriptionReportList[index].remarks ?? ''), ], ),) ], ) ], ), ), )) else ...List.generate( model.prescriptionReportEnhList.length, (index) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), color: Colors.white, ), margin: EdgeInsets.all(12), child: Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(left: 18,right: 18), child: Texts(model.prescriptionReportEnhList[index].itemDescription,bold: true,),), SizedBox(height: 12,), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(width: 18,), Container( decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all(width: 0.5,color: Colors.grey) ), height: 55, width: 55, child: Padding( padding: const EdgeInsets.all(8.0), child: Image.network( model.prescriptionReportEnhList[index].imageSRCUrl, fit: BoxFit.cover, ), ), ), SizedBox(width: 10,), Expanded(child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Texts(TranslationBase.of(context).route,color: Colors.grey,), Expanded(child: Texts(model.prescriptionReportEnhList[index].route??'')), ], ), Row( children: [ Texts(TranslationBase.of(context).frequency,color: Colors.grey,), Texts(model.prescriptionReportEnhList[index].frequency ?? ''), ], ), SizedBox(height: 12,), Texts(model.prescriptionReportEnhList[index].remarks?? ''), ], ),) ], ) ], ), ), ), ), ], ), ), ), ), ); } }