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.
248 lines
10 KiB
Dart
248 lines
10 KiB
Dart
|
6 years ago
|
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/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';
|
||
|
|
import 'package:flutter/cupertino.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:provider/provider.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: 'Prescription Details',
|
||
|
|
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],
|
||
|
|
);
|
||
|
|
}),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class OutPatientPrescriptionDetailsItem extends StatefulWidget {
|
||
|
|
final PrescriptionReport prescriptionReport;
|
||
|
|
|
||
|
|
OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport});
|
||
|
|
|
||
|
|
@override
|
||
|
|
_OutPatientPrescriptionDetailsItemState createState() =>
|
||
|
|
_OutPatientPrescriptionDetailsItemState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _OutPatientPrescriptionDetailsItemState
|
||
|
|
extends State<OutPatientPrescriptionDetailsItem> {
|
||
|
|
bool _showDetails = false;
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Container(
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: <Widget>[
|
||
|
|
Row(
|
||
|
|
children: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
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: <Widget>[
|
||
|
|
AppText(
|
||
|
|
'Doctor Remarks',
|
||
|
|
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||
|
|
fontWeight: FontWeight.bold,
|
||
|
|
),
|
||
|
|
AppText(
|
||
|
|
'${widget.prescriptionReport.remarks}',
|
||
|
|
fontSize: 1.7 * SizeConfig.textMultiplier,
|
||
|
|
fontWeight: FontWeight.w300,
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
Container()
|
||
|
|
],
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|