Medical Perscription 1.0

merge-update-with-lab-changes
Mirza.Shafique 4 years ago
parent 24b7a8a4c4
commit 8c8a9c7ce2

@ -3,13 +3,17 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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';
@ -22,215 +26,327 @@ class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions;
PrescriptionItemsPage({Key key, this.prescriptions});
//TODO
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) =>
model.getPrescriptionReport(prescriptions: prescriptions),
onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescriptions,
appBarTitle: prescriptions.doctorName,
baseViewModel: model,
body: Container(
height: MediaQuery.of(context).size.height * 0.8,
child: Column(
children: [
if (!prescriptions.isInOutPatient)
...List.generate(
model.prescriptionReportListINP.length,
(index) => InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPageINP(
prescriptionReport:
model.prescriptionReportListINP[index],
),
),
),
child: 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),
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true,
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
DoctorHeader(
headerModel: HeaderModel(
prescriptions.doctorName,
prescriptions.doctorImageURL,
prescriptions.speciality,
"",
prescriptions.name,
DateUtil.convertStringToDate(prescriptions.appointmentDate),
prescriptions.nationalityFlagURL,
prescriptions.doctorRate,
prescriptions.actualDoctorRate,
model.user.emailAddress,
),
isNeedToShowButton: projectViewModel.havePrivilege(13),
onTap: () {
showConfirmMessage(context, model);
},
),
if (!prescriptions.isInOutPatient)
ListView.separated(
itemBuilder: (context, index) {
return InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPageINP(
prescriptionReport: model.prescriptionReportListINP[index],
),
),
),
border: Border.all(
color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.prescriptionReportListINP[index]
.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
child: Container(
width: double.infinity,
child: Card(
margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4),
shape: cardRadius(12),
child: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 20, left: 20, right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.prescriptionReportListINP[index].itemDescription.isNotEmpty
? model.prescriptionReportListINP[index].itemDescription
: model.prescriptionReportListINP[index].itemDescriptionN ?? '',
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
mHeight(10),
Row(
children: [
Container(
child: Card(
child: Image.network(
model.prescriptionReportListINP[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 60,
),
margin: EdgeInsets.zero,
clipBehavior: Clip.antiAlias,
shape: cardRadius(2000),
),
clipBehavior: Clip.antiAlias,
decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1),
),
mWidth(12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
TranslationBase.of(context).route + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportListINP[index].route,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
),
Row(
children: [
Text(
TranslationBase.of(context).dailyDoses + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportListINP[index].doseDailyQuantity.toString(),
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
),
mHeight(12),
Text(
model.prescriptionReportListINP[index].remarks,
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
],
)
],
),
],
),
),
),
SizedBox(
width: 10,
),
);
},
separatorBuilder: (context, index) {
return mHeight(8);
},
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: model.prescriptionReportListINP.length)
else
ListView.separated(
itemBuilder: (context, index) {
return InkWell(
onTap: () {
PrescriptionReport prescriptionReport = PrescriptionReport(
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl,
itemDescription: model.prescriptionReportEnhList[index].itemDescription,
itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription,
routeN: model.prescriptionReportEnhList[index].route,
frequency: model.prescriptionReportEnhList[index].frequency,
frequencyN: model.prescriptionReportEnhList[index].frequency,
doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity,
days: model.prescriptionReportEnhList[index].days,
itemID: model.prescriptionReportEnhList[index].itemID,
remarks: model.prescriptionReportEnhList[index].remarks);
Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport: prescriptionReport,
),
),
);
},
child: Card(
margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4),
shape: cardRadius(12),
child: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 20, left: 20, right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.prescriptionReportEnhList[index].itemDescription.isNotEmpty
? model.prescriptionReportEnhList[index].itemDescription
: model.prescriptionReportEnhList[index].itemDescriptionN ?? '',
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
mHeight(10),
Row(
children: [
Container(
child: Card(
child: Image.network(
model.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 60,
),
margin: EdgeInsets.zero,
clipBehavior: Clip.antiAlias,
shape: cardRadius(2000),
),
clipBehavior: Clip.antiAlias,
decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1),
),
mWidth(12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
TranslationBase.of(context).route + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportEnhList[index].route,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
),
Row(
children: [
Text(
TranslationBase.of(context).dailyDoses + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportEnhList[index].doseDailyQuantity.toString(),
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
),
mHeight(12),
Text(
model.prescriptionReportEnhList[index].remarks,
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
],
)
],
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(model
.prescriptionReportListINP[index]
.itemDescription
.isNotEmpty
? model
.prescriptionReportListINP[index]
.itemDescription
: model
.prescriptionReportListINP[
index]
.itemDescriptionN ??
'')),
)),
Icon(
Icons.arrow_forward_ios,
size: 18,
color: Colors.grey[500],
)
],
),
),
))
else
...List.generate(
model.prescriptionReportEnhList.length,
(index) => InkWell(
onTap: () {
PrescriptionReport prescriptionReport =
PrescriptionReport(
imageSRCUrl: model
.prescriptionReportEnhList[index].imageSRCUrl,
itemDescription: model
.prescriptionReportEnhList[index]
.itemDescription,
itemDescriptionN: model
.prescriptionReportEnhList[index]
.itemDescription,
routeN:
model.prescriptionReportEnhList[index].route,
frequency: model
.prescriptionReportEnhList[index].frequency,
frequencyN: model
.prescriptionReportEnhList[index].frequency,
doseDailyQuantity: model
.prescriptionReportEnhList[index]
.doseDailyQuantity,
days: model.prescriptionReportEnhList[index].days,
itemID:
model.prescriptionReportEnhList[index].itemID,
remarks: model
.prescriptionReportEnhList[index].remarks);
Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport: prescriptionReport,
),
),
);
},
child: Container(
margin: EdgeInsets.all(8.0),
color: Colors.white,
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model
.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
SizedBox(
width: 10,
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(model.prescriptionReportEnhList[index]
.itemDescription.isNotEmpty
? model.prescriptionReportEnhList[index]
.itemDescription
: model.prescriptionReportEnhList[index]
.itemDescriptionN ??
''),
],
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 18,
color: Colors.grey[500],
)
],
),
),
),
)
],
),
),
bottomSheet: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.25,
color: Colors.grey[100],
child: Column(
children: <Widget>[
Divider(),
if (projectViewModel.havePrivilege(13))
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
label: TranslationBase.of(context).sendCopy,
onTap: () {
showConfirmMessage(context, model);
},
loading: model.state == ViewState.BusyLocal,
),
);
},
separatorBuilder: (context, index) {
return mHeight(8);
},
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionReportEnhList.length),
],
),
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
label: TranslationBase.of(context).resendOrder,
backgroundColor: Colors.green[800],
onTap: () {
Navigator.push(
context,
FadePage(
page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions,
prescriptionReportList:
model.prescriptionReportList,
prescriptionReportEnhList:
model.prescriptionReportEnhList,
),
),
),
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 2),
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button(
label: TranslationBase.of(context).resendOrder,
backgroundColor: Colors.green[800],
onTap: () {
Navigator.push(
context,
FadePage(
page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions,
prescriptionReportList: model.prescriptionReportList,
prescriptionReportEnhList: model.prescriptionReportEnhList,
),
);
},
))
],
),
),
);
},
),
),
),
],
),
),
);

@ -47,65 +47,29 @@ class _HomePrescriptionsPageState extends State<HomePrescriptionsPage>
description: TranslationBase.of(context).infoPrescriptions,
infoList: TranslationBase.of(context).infoPrescriptionsPoints,
imagesInfo: imagesInfo,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true,
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(65.0),
child: Stack(
child: Column(
children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
TabBar(
tabs: [
Tab(child: Text(TranslationBase.of(context).prescriptions, style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).history, style: TextStyle(color: Colors.black)),
),
),
],
controller: _tabController,
),
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.92,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.9), //width: 0.7
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: true,
controller: _tabController,
indicatorWeight: 5.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding:
EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0),
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts(TranslationBase.of(context).prescriptions),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.30,
child: Center(
child: Texts(TranslationBase.of(context).history),
),
),
],
),
),
),
Divider(
color: Colors.grey[600],
thickness: 0.5,
),
],
),

@ -1,10 +1,12 @@
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -15,8 +17,7 @@ import 'package:provider/provider.dart';
class PrescriptionsPage extends StatelessWidget {
final PrescriptionsViewModel prescriptionsViewModel;
const PrescriptionsPage({Key key, this.prescriptionsViewModel})
: super(key: key);
const PrescriptionsPage({Key key, this.prescriptionsViewModel}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -29,73 +30,92 @@ class PrescriptionsPage extends StatelessWidget {
physics: BouncingScrollPhysics(),
children: <Widget>[
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () =>
prescriptionsViewModel.setFilterType(FilterType.Clinic),
child: ListTile(
title: Text(TranslationBase.of(context).clinic),
leading: Radio(
value: FilterType.Clinic,
groupValue: prescriptionsViewModel.filterType,
onChanged: (FilterType value) {
prescriptionsViewModel.setFilterType(value);
},
),
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => prescriptionsViewModel
.setFilterType(FilterType.Hospital),
child: ListTile(
title: Text(TranslationBase.of(context).hospital),
leading: Radio(
value: FilterType.Hospital,
groupValue: prescriptionsViewModel.filterType,
onChanged: (FilterType value) {
prescriptionsViewModel.setFilterType(value);
},
),
),
),
)
children: [
MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, prescriptionsViewModel.filterType, () {
prescriptionsViewModel.setFilterType(FilterType.Clinic);
}),
MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, prescriptionsViewModel.filterType, () {
prescriptionsViewModel.setFilterType(FilterType.Hospital);
}),
],
),
...List.generate(
prescriptionsViewModel.prescriptionsOrderList.length,
(index) => AppExpandableNotifier(
title: prescriptionsViewModel
.prescriptionsOrderList[index].filterName,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: prescriptionsViewModel
.prescriptionsOrderList[index].prescriptionsList
.map((prescriptions) {
return InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(prescriptions: prescriptions,),
),
),
child: DoctorCard(
name: prescriptions.doctorName,
profileUrl: prescriptions.doctorImageURL,
rat: prescriptions.actualDoctorRate.toDouble(),
subName: prescriptions.name,
isInOutPatient: prescriptions.isInOutPatient,
isLiveCareAppointment: prescriptions.isLiveCareAppointment,
date:DateUtil.convertStringToDate(prescriptions.appointmentDate)//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)),
),
);
}).toList(),
)),
// ...List.generate(
// prescriptionsViewModel.prescriptionsOrderList.length,
// (index) => AppExpandableNotifier(
// title: prescriptionsViewModel
// .prescriptionsOrderList[index].filterName,
// bodyWidget: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: prescriptionsViewModel
// .prescriptionsOrderList[index].prescriptionsList
// .map((prescriptions) {
// return InkWell(
// onTap: () => Navigator.push(
// context,
// FadePage(
// page: PrescriptionItemsPage(prescriptions: prescriptions,),
// ),
// ),
// child: DoctorCard(
// name: prescriptions.doctorName,
// profileUrl: prescriptions.doctorImageURL,
// rat: prescriptions.actualDoctorRate.toDouble(),
// subName: prescriptions.name,
// isInOutPatient: prescriptions.isInOutPatient,
// isLiveCareAppointment: prescriptions.isLiveCareAppointment,
// date:DateUtil.convertStringToDate(prescriptions.appointmentDate)//projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)),
// ),
// );
// }).toList(),
// )),
// ),
ListView.separated(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
// padding: EdgeInsets.only(left: 21, right: 21),
separatorBuilder: (context, index) {
return Container(
height: 1,
margin: EdgeInsets.only(left: 21, right: 21),
color: Color(0xffD9D9D9),
);
},
itemBuilder: (context, index) {
List<Prescriptions> prescriptionsList = prescriptionsViewModel.prescriptionsOrderList[index].prescriptionsList;
return AppExpandableNotifier(
title: prescriptionsViewModel.prescriptionsOrderList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
Prescriptions prescriptions = prescriptionsList[_index];
return DoctorCard(
onTap: () => Navigator.push(
context,
FadePage(
page: PrescriptionItemsPage(
prescriptions: prescriptions,
),
),
),
name: prescriptions.doctorName,
profileUrl: prescriptions.doctorImageURL,
rat: prescriptions.actualDoctorRate.toDouble(),
subName: prescriptions.name,
isInOutPatient: prescriptions.isInOutPatient,
isLiveCareAppointment: prescriptions.isLiveCareAppointment,
date: DateUtil.convertStringToDate(prescriptions
.appointmentDate) //projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr( DateUtil.convertStringToDate(prescriptions.appointmentDate) ):DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(prescriptions.appointmentDate)),
);
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: prescriptionsList.length),
);
},
itemCount: prescriptionsViewModel.prescriptionsOrderList.length,
)
],
),

@ -100,7 +100,7 @@ class LineChartCurved extends StatelessWidget {
touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true,horizontalInterval: 10,verticalInterval: 10),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true,horizontalInterval: 14,verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:fl_chart/fl_chart.dart';
@ -10,8 +12,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
final List<TimeSeriesSales2> timeSeries2;
final int indexes;
LineChartCurvedBloodPressure(
{this.title, this.timeSeries1, this.indexes, this.timeSeries2});
LineChartCurvedBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2});
List<int> xAxixs = List();
List<double> yAxixs = List();
@ -32,21 +33,30 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SizedBox(
height: 15,
height: 12,
),
Text(
title,
style: TextStyle(
color: Colors.black, fontSize: 15, letterSpacing: 2),
textAlign: TextAlign.center,
Padding(
padding: const EdgeInsets.only(
left: 20,
right: 20,
),
child: Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.start,
),
),
SizedBox(
height: 10,
),
Expanded(
child: Padding(
padding:
const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15),
child: LineChart(
sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250),
@ -63,32 +73,53 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
Row(
children: [
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Theme.of(context).primaryColor),
width: 16,
height: 16,
decoration: containerRadius(Theme.of(context).primaryColor, 100),
),
SizedBox(
width: 5,
),
Text(
TranslationBase.of(context).systolicLng,
style: TextStyle(
color: Colors.black,
fontSize: 12,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 5,),
Texts(TranslationBase.of(context).systolicLng)
],
),
SizedBox(width: 15,),
SizedBox(
width: 15,
),
Row(
children: [
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.red),
width: 16,
height: 16,
decoration: containerRadius(CustomColors.accentColor, 100),
),
SizedBox(
width: 5,
),
Text(
TranslationBase.of(context).diastolicLng,
style: TextStyle(
color: Colors.black,
fontSize: 12,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
SizedBox(width: 5,),
Texts(TranslationBase.of(context).diastolicLng)
],
),
],
)
),
const SizedBox(
height: 12,
),
],
),
],
@ -115,8 +146,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(
show: true, drawVerticalLine: true, drawHorizontalLine: true),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
@ -133,10 +163,8 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
} else
return '';
} else {
if (value.toInt() == 0)
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == timeSeries1.length - 1)
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == 0) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (value.toInt() == timeSeries1.length - 1) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) {
return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}';
}
@ -151,8 +179,11 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
fontWeight: FontWeight.bold,
fontSize: 10,
),
interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200,
interval: getMaxY() - getMinY() <= 500
? 50
: getMaxY() - getMinY() <= 1000
? 100
: 200,
margin: 12,
),
),
@ -177,7 +208,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
minX: 0,
maxX: (timeSeries1.length - 1).toDouble(),
maxY: getMaxY() + 15,
minY: getMinY()-15,
minY: getMinY() - 15,
lineBarsData: getData(context),
);
}
@ -227,7 +258,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
spots: spots,
isCurved: true,
colors: [Colors.red],
barWidth: 5,
barWidth: 1.5,
isStrokeCapRound: true,
dotData: FlDotData(
show: false,
@ -240,7 +271,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
spots: spots2,
isCurved: true,
colors: [Theme.of(context).primaryColor],
barWidth: 5,
barWidth: 1.5,
isStrokeCapRound: true,
dotData: FlDotData(
show: false,

@ -1,11 +1,17 @@
import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_blood_pressurewideget.dart';
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_wideget.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/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:provider/provider.dart';
import 'LineChartCurved.dart';
import 'LineChartCurvedBloodPressure.dart';
@ -31,31 +37,98 @@ class VitalSingChartBloodPressure extends StatelessWidget {
final String title3;
List<TimeSeriesSales2> timeSeriesData1 = [];
List<TimeSeriesSales2> timeSeriesData2 = [];
ProjectViewModel projectViewModel;
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
generateData();
return Column(
children: <Widget>[
AppExpandableNotifier(
isExpand: true,
headerWidget: LineChartCurvedBloodPressure(
title: name,
timeSeries1: timeSeriesData1,
timeSeries2: timeSeriesData2,
indexes: timeSeriesData1.length ~/ 5.5,
return SingleChildScrollView(
child: Column(
children: <Widget>[
Card(
shape: cardRadius(12),
elevation: 1,
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: LineChartCurvedBloodPressure(
title: name,
timeSeries1: timeSeriesData1,
timeSeries2: timeSeriesData2,
indexes: timeSeriesData1.length ~/ 5.5,
),
),
bodyWidget: VitalSignBloodPressureWidget(
vitalList: vitalList,
title1: title1,
title2: title2,
title3: title3,
viewKey1: viewKey1,
viewKey2: viewKey2,
),
),
],
// VitalSignBloodPressureWidget(
// vitalList: vitalList,
// title1: title1,
// title2: title2,
// title3: title3,
// viewKey1: viewKey1,
// viewKey2: viewKey2,
// ),
Card(
shape: cardRadius(12),
margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).graphDetails,
style: TextStyle(
fontSize: 16,
letterSpacing: -0.64,
fontWeight: FontWeight.w600,
),
),
Table(
columnWidths: {
0: FlexColumnWidth(2),
1: FlexColumnWidth(1),
// 2: FlexColumnWidth(1),
},
children: fullData(vitalList, context),
),
],
),
),
)
],
),
);
}
List<TableRow> fullData(List<VitalSignResModel> labResultList, context) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
children: [
Utils.tableColumnTitle(title1),
Utils.tableColumnTitle(title2),
Utils.tableColumnTitle(title3),
// Utils.tableColumnTitle(TranslationBase.of(context).range),
],
),
);
for (int i = 0; i < labResultList.length; i++) {
var data = labResultList[i].toJson()[viewKey1];
if (data != 0)
tableRow.add(
TableRow(
children: [
Utils.tableColumnValue(
"${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate.weekday)}, ${labResultList[i].vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate.month) : DateUtil.getMonth(labResultList[i].vitalSignDate.month)}, ${labResultList[i].vitalSignDate.year}",
isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue('${labResultList[i].toJson()[viewKey1]}', isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue('${labResultList[i].toJson()[viewKey2]}', isLast: i == (labResultList.length - 1)),
],
),
);
}
return tableRow;
}
generateData() {
@ -65,16 +138,14 @@ class VitalSingChartBloodPressure extends StatelessWidget {
if (element.toJson()[viewKey1]?.toInt() != 0)
timeSeriesData1.add(
TimeSeriesSales2(
new DateTime(element.vitalSignDate.year,
element.vitalSignDate.month, element.vitalSignDate.day),
new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
element.toJson()[viewKey1].toDouble(),
),
);
if (element.toJson()[viewKey2]?.toInt() != 0)
timeSeriesData2.add(
TimeSeriesSales2(
new DateTime(element.vitalSignDate.year,
element.vitalSignDate.month, element.vitalSignDate.day),
new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
element.toJson()[viewKey2].toDouble(),
),
);

@ -53,7 +53,7 @@ class _SplashScreenState extends State<SplashScreen> {
await _privilegeService.getPrivilege();
ProjectViewModel projectProvider = Provider.of<ProjectViewModel>(context, listen: false);
projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList);
var themeNotifier = Provider.of<ThemeNotifier>(context,listen: false);
var themeNotifier = Provider.of<ThemeNotifier>(context, listen: false);
themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins'));
}

@ -49,7 +49,7 @@ class DoctorHeader extends StatelessWidget {
_speciality,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
),
myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo),
headerModel.invoiceNo.isNotEmpty ? myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo) : Container(),
myRichText(TranslationBase.of(context).branch, headerModel.projectName),
],
),

Loading…
Cancel
Save