You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.8 KiB
Dart
67 lines
2.8 KiB
Dart
import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart';
|
|
import 'package:doctor_app_flutter/models/patient/prescription/request_prescription_report.dart';
|
|
import 'package:doctor_app_flutter/providers/patients_provider.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/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';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
class OutPatientPrescriptionDetailsScreen extends StatefulWidget {
|
|
final PrescriptionResModel prescriptionResModel;
|
|
|
|
OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel});
|
|
|
|
@override
|
|
_OutPatientPrescriptionDetailsScreenState createState() =>
|
|
_OutPatientPrescriptionDetailsScreenState();
|
|
}
|
|
|
|
class _OutPatientPrescriptionDetailsScreenState
|
|
extends State<OutPatientPrescriptionDetailsScreen> {
|
|
bool _isInit = true;
|
|
PatientsProvider patientsProvider;
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
if (_isInit) {
|
|
patientsProvider = Provider.of<PatientsProvider>(context);
|
|
|
|
RequestPrescriptionReport prescriptionReqModel =
|
|
RequestPrescriptionReport(
|
|
appointmentNo: widget.prescriptionResModel.appointmentNo,
|
|
episodeID: widget.prescriptionResModel.episodeID,
|
|
setupID: widget.prescriptionResModel.setupID,
|
|
patientTypeID: widget.prescriptionResModel.patientID);
|
|
patientsProvider.getPrescriptionReport(prescriptionReqModel.toJson());
|
|
}
|
|
_isInit = false;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: TranslationBase.of(context).prescriptionDetails,
|
|
body: patientsProvider.isLoading
|
|
? DrAppCircularProgressIndeicator()
|
|
: patientsProvider.isError
|
|
? DrAppEmbeddedError(error: patientsProvider.error)
|
|
: CardWithBgWidgetNew(
|
|
widget: ListView.builder(
|
|
itemCount: patientsProvider.prescriptionReport.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return OutPatientPrescriptionDetailsItem(
|
|
prescriptionReport:
|
|
patientsProvider.prescriptionReport[index],
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|