From 0c94188405aaabec4deda9e9e01c87ef264415d0 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Tue, 9 Jun 2020 14:47:24 +0300 Subject: [PATCH] Done Prescription Details Screen --- lib/providers/doctor_reply_provider.dart | 26 +-- ...t_patient_prescription_details_screen.dart | 182 +----------------- ...n_patient_prescription_details_screen.dart | 26 +-- ...out_patient_prescription_details_item.dart | 138 +++++++++++++ 4 files changed, 161 insertions(+), 211 deletions(-) create mode 100644 lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index c7e48afa..493cb472 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; import 'package:flutter/cupertino.dart'; - class DoctorReplyProvider with ChangeNotifier { List listDoctorWorkingHoursTable = []; @@ -18,20 +17,21 @@ class DoctorReplyProvider with ChangeNotifier { getDoctorReply() async { try { - await BaseAppClient.post('DoctorApplication.svc/REST/GtMyPatientsQuestions', - body: _requestDoctorReply.toJson(), - onSuccess: (dynamic response, int statusCode) { - response['List_GtMyPatientsQuestions'].forEach((v) { - listDoctorWorkingHoursTable.add(ListGtMyPatientsQuestions.fromJson(v)); - isError = false; - isLoading = false; - }); - }, - onFailure: (String error, int statusCode) { - isError = true; + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyPatientsQuestions', + body: _requestDoctorReply.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_GtMyPatientsQuestions'].forEach((v) { + listDoctorWorkingHoursTable + .add(ListGtMyPatientsQuestions.fromJson(v)); + isError = false; isLoading = false; - this.error= error; }); + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }); notifyListeners(); } catch (error) { diff --git a/lib/screens/patients/out_patient_prescription_details_screen.dart b/lib/screens/patients/out_patient_prescription_details_screen.dart index aa61f1fb..a8f97290 100644 --- a/lib/screens/patients/out_patient_prescription_details_screen.dart +++ b/lib/screens/patients/out_patient_prescription_details_screen.dart @@ -1,11 +1,8 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; -import 'package:doctor_app_flutter/models/prescription_report.dart'; import 'package:doctor_app_flutter/models/request_prescription_report.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -67,181 +64,4 @@ class _OutPatientPrescriptionDetailsScreenState } } -class OutPatientPrescriptionDetailsItem extends StatefulWidget { - final PrescriptionReport prescriptionReport; - OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); - - @override - _OutPatientPrescriptionDetailsItemState createState() => - _OutPatientPrescriptionDetailsItemState(); -} - -class _OutPatientPrescriptionDetailsItemState - extends State { - bool _showDetails = false; - @override - Widget build(BuildContext context) { - return Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - flex: 5, - child: AppText( - '${widget.prescriptionReport.itemDescription} ', - fontSize: 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - _showDetails = !_showDetails; - }); - }, - child: Icon(_showDetails - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)), - ), - ], - ), - !_showDetails - ? Container() - : AnimatedContainer( - duration: Duration(milliseconds: 200), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - Divider( - color: Color(0xFF000000), - height: 0.5, - ), - Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 0.5), - ), - children: [ - TableRow(children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Route', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.prescriptionReport.route}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - margin: EdgeInsets.only( - left: 4, top: 2.5, right: 2.5, bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Frequency Timing', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.prescriptionReport.frequency, - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - ]), - TableRow(children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Insurance Covered', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container( - margin: EdgeInsets.only( - left: 4, top: 2.5, right: 2.5, bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Duration Days', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.prescriptionReport.days}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ) - ]), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Doctor Remarks', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.prescriptionReport.remarks}', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - ), - Container() - ], - ), - ], - ), - ], - ), - ) - ], - ), - ); - } -} diff --git a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart index 30a57b15..f4a8a395 100644 --- a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart +++ b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart @@ -1,12 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/my_referral_patient_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription_report_for_in_patient.dart'; -import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; @@ -23,8 +17,6 @@ class InpatientPrescriptionDetailsScreen extends StatefulWidget { class _InpatientPrescriptionDetailsScreenState extends State { bool _showDetails = false; - bool _isLoading = false; - final _formKey = GlobalKey(); String error; TextEditingController answerController; bool _isInit = true; @@ -32,7 +24,6 @@ class _InpatientPrescriptionDetailsScreenState @override void initState() { -// answerController = new TextEditingController(text: widget.myReferralPatientModel.referredDoctorRemarks ?? ''); super.initState(); } @@ -49,7 +40,7 @@ class _InpatientPrescriptionDetailsScreenState @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: 'perscription info', + appBarTitle: 'Prescription info', body: CardWithBgWidgetNew( widget: Container( child: ListView( @@ -99,23 +90,23 @@ class _InpatientPrescriptionDetailsScreenState des: '${prescription.refillID}', key: 'Refill'), buildTableRow( - des: '${prescription.dose}', - key: 'Dose'), + des: '${prescription.dose}', key: 'Dose'), buildTableRow( des: '${prescription.unitofMeasurement}', key: 'UOM'), buildTableRow( - des: '${Helpers.getDate(prescription.startDatetime) }', + des: + '${Helpers.getDate(prescription.startDatetime)}', key: 'Start Date'), buildTableRow( - des: '${Helpers.getDate(prescription.stopDatetime)}', + des: + '${Helpers.getDate(prescription.stopDatetime)}', key: 'Stop Date'), buildTableRow( des: '${prescription.noOfDoses}', key: 'No of Doses'), buildTableRow( - des: '${prescription.route}', - key: 'Route'), + des: '${prescription.route}', key: 'Route'), buildTableRow( des: '${prescription.comments}', key: 'Comments'), @@ -123,7 +114,8 @@ class _InpatientPrescriptionDetailsScreenState des: '${prescription.pharmacyRemarks}', key: 'Pharmacy Remarks'), buildTableRow( - des: '${Helpers.getDate(prescription.prescriptionDatetime)}', + des: + '${Helpers.getDate(prescription.prescriptionDatetime)}', key: 'Prescription Date'), buildTableRow( des: '${prescription.refillID}', diff --git a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart new file mode 100644 index 00000000..fc212afe --- /dev/null +++ b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart @@ -0,0 +1,138 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/prescription_report.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class OutPatientPrescriptionDetailsItem extends StatefulWidget { + final PrescriptionReport prescriptionReport; + + OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); + + @override + _OutPatientPrescriptionDetailsItemState createState() => + _OutPatientPrescriptionDetailsItemState(); +} + +class _OutPatientPrescriptionDetailsItemState + extends State { + bool _showDetails = false; + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + flex: 5, + child: AppText( + '${widget.prescriptionReport.itemDescription} ', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + Table( + border: TableBorder.symmetric( + inside: BorderSide(width: 0.5), + ), + children: [ + buildTableRow( + key: 'Route', + des: widget.prescriptionReport.route), + buildTableRow( + key: 'Frequency Timing', + des: widget.prescriptionReport.frequency), + buildTableRow(key: 'Insurance Covered', des: ''), + buildTableRow( + key: 'Duration Days', + des: widget.prescriptionReport.days), + buildTableRow( + key: 'IDoctor Remarks', + des: widget.prescriptionReport.remarks), + ], + ), + Divider( + color: Color(0xFF000000), + height: 0.5, + ), + ], + ), + ) + ], + ), + ); + } + + TableRow buildTableRow({des, key}) { + print('$key: $des'); + return TableRow(children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Row( + children: [ + Expanded( + child: Container( + child: AppText( + key, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + ), + ), + Expanded( + child: Container( + margin: + EdgeInsets.only(left: 4, top: 2.5, right: 2.5, bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + '${des}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ], + ), + ), + ]); + } +} \ No newline at end of file