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.
288 lines
12 KiB
Dart
288 lines
12 KiB
Dart
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/models/header_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
|
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart';
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class PrescriptionDetailsPage extends StatelessWidget {
|
|
final PrescriptionReport prescriptionReport;
|
|
|
|
PrescriptionDetailsPage({Key key, this.prescriptionReport});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
isShowAppBar: true,
|
|
showNewAppBar: true,
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
showNewAppBarTitle: true,
|
|
appBarTitle: TranslationBase.of(context).prescriptions,
|
|
body: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
DoctorHeader(
|
|
headerModel: HeaderModel(
|
|
prescriptionReport?.doctorName ?? "" + "a",
|
|
"",
|
|
[],
|
|
"",
|
|
"",
|
|
DateUtil.convertStringToDate(prescriptionReport.orderDate),
|
|
DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptionReport.orderDate)),
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
"",
|
|
),
|
|
isNeedToShowButton: false,
|
|
),
|
|
Expanded(
|
|
child: ListView(
|
|
physics: BouncingScrollPhysics(),
|
|
padding: EdgeInsets.all(21),
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.all(14),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
//spreadRadius: 5,
|
|
blurRadius: 27,
|
|
offset: Offset(0, -3),
|
|
),
|
|
],
|
|
),
|
|
child: Table(children: fullData(context)),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
|
|
padding: EdgeInsets.all(8.0),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
border: Border.all(color: Colors.grey[200], width: 0.5),
|
|
),
|
|
child: Row(
|
|
children: <Widget>[
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
child: Image.network(
|
|
prescriptionReport.imageSRCUrl,
|
|
fit: BoxFit.cover,
|
|
width: 60,
|
|
height: 70,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Center(
|
|
child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.white,
|
|
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
|
|
child: Table(
|
|
border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)),
|
|
children: [
|
|
TableRow(
|
|
children: [
|
|
Container(
|
|
color: Colors.white,
|
|
height: 40,
|
|
width: double.infinity,
|
|
child: Center(
|
|
child: Texts(
|
|
TranslationBase.of(context).route,
|
|
fontSize: 14,
|
|
))),
|
|
Container(
|
|
color: Colors.white,
|
|
height: 40,
|
|
width: double.infinity,
|
|
child: Center(
|
|
child: Texts(
|
|
TranslationBase.of(context).frequency,
|
|
fontSize: 14,
|
|
))),
|
|
Container(
|
|
color: Colors.white,
|
|
height: 40,
|
|
width: double.infinity,
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
child: Center(
|
|
child: Texts(
|
|
"${TranslationBase.of(context).dailyDoses}",
|
|
fontSize: 14,
|
|
))),
|
|
Container(
|
|
color: Colors.white,
|
|
height: 40,
|
|
width: double.infinity,
|
|
child: Center(
|
|
child: Texts(
|
|
TranslationBase.of(context).duration,
|
|
fontSize: 14,
|
|
))),
|
|
],
|
|
),
|
|
TableRow(
|
|
children: [
|
|
Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text(prescriptionReport.routeN ?? ''))),
|
|
Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text(prescriptionReport.frequencyN ?? ''))),
|
|
Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))),
|
|
Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text('${prescriptionReport.days}')))
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
|
|
width: double.infinity,
|
|
color: Colors.white,
|
|
padding: EdgeInsets.all(5),
|
|
child: Center(
|
|
child: Column(
|
|
children: <Widget>[
|
|
Texts(TranslationBase.of(context).notes),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Divider(
|
|
height: 0.5,
|
|
color: Colors.grey[300],
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Texts(prescriptionReport.remarks ?? ''),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.white,
|
|
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Expanded(
|
|
child: DefaultButton(
|
|
TranslationBase.of(context).availability,
|
|
() {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: PharmacyForPrescriptionsPage(
|
|
itemID: prescriptionReport.itemID,
|
|
prescriptionReport: prescriptionReport,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
iconData: Icons.location_on,
|
|
color: Color(0xff359846),
|
|
),
|
|
),
|
|
SizedBox(width: 10),
|
|
Expanded(
|
|
child: DefaultButton(
|
|
TranslationBase.of(context).addReminder,
|
|
() {
|
|
DateTime startDate = DateTime.now();
|
|
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
|
|
|
|
print(prescriptionReport);
|
|
showGeneralDialog(
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
transitionBuilder: (context, a1, a2, widget) {
|
|
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
|
|
return Transform(
|
|
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
|
|
child: Opacity(
|
|
opacity: a1.value,
|
|
child: PrescriptionReminderDialog(
|
|
eventId: prescriptionReport.itemID.toString(),
|
|
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
|
|
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
|
|
startDate: startDate,
|
|
endDate: endDate,
|
|
location: prescriptionReport.remarks,
|
|
days: 1,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
transitionDuration: Duration(milliseconds: 500),
|
|
barrierDismissible: true,
|
|
barrierLabel: '',
|
|
context: context,
|
|
pageBuilder: (context, animation1, animation2) {});
|
|
},
|
|
iconData: Icons.notifications_active,
|
|
color: Color(0xffEAEAEA),
|
|
textColor: Color(0xff2B353E),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
List<TableRow> fullData(context) {
|
|
List<TableRow> tableRow = [];
|
|
tableRow.add(
|
|
TableRow(
|
|
children: [
|
|
Utils.tableColumnTitle(TranslationBase.of(context).route),
|
|
Utils.tableColumnTitle(TranslationBase.of(context).frequency),
|
|
Utils.tableColumnTitle(TranslationBase.of(context).dailyDoses),
|
|
Utils.tableColumnTitle(TranslationBase.of(context).duration)
|
|
],
|
|
),
|
|
);
|
|
tableRow.add(
|
|
TableRow(
|
|
children: [
|
|
Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true),
|
|
Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true),
|
|
Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true),
|
|
Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true),
|
|
],
|
|
),
|
|
);
|
|
return tableRow;
|
|
}
|
|
}
|