done my trackers
parent
0122cc8914
commit
c01e6095f2
@ -0,0 +1,90 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class BloodPressureResult {
|
||||||
|
int patientID;
|
||||||
|
int lineItemNo;
|
||||||
|
DateTime bloodPressureDate;
|
||||||
|
int measuredArm;
|
||||||
|
int systolicePressure;
|
||||||
|
int diastolicPressure;
|
||||||
|
dynamic remark;
|
||||||
|
bool isActive;
|
||||||
|
int chartYear;
|
||||||
|
String chartMonth;
|
||||||
|
dynamic yearSystolicePressureAverageResult;
|
||||||
|
dynamic monthSystolicePressureResult;
|
||||||
|
dynamic weekSystolicePressureResult;
|
||||||
|
int yearDiastolicPressureAverageResult;
|
||||||
|
dynamic monthDiastolicPressureResult;
|
||||||
|
dynamic weekDiastolicPressureResult;
|
||||||
|
String measuredArmDesc;
|
||||||
|
dynamic weekDesc;
|
||||||
|
|
||||||
|
BloodPressureResult(
|
||||||
|
{this.patientID,
|
||||||
|
this.lineItemNo,
|
||||||
|
this.bloodPressureDate,
|
||||||
|
this.measuredArm,
|
||||||
|
this.systolicePressure,
|
||||||
|
this.diastolicPressure,
|
||||||
|
this.remark,
|
||||||
|
this.isActive,
|
||||||
|
this.chartYear,
|
||||||
|
this.chartMonth,
|
||||||
|
this.yearSystolicePressureAverageResult,
|
||||||
|
this.monthSystolicePressureResult,
|
||||||
|
this.weekSystolicePressureResult,
|
||||||
|
this.yearDiastolicPressureAverageResult,
|
||||||
|
this.monthDiastolicPressureResult,
|
||||||
|
this.weekDiastolicPressureResult,
|
||||||
|
this.measuredArmDesc,
|
||||||
|
this.weekDesc});
|
||||||
|
|
||||||
|
BloodPressureResult.fromJson(Map<String, dynamic> json) {
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
lineItemNo = json['LineItemNo'];
|
||||||
|
bloodPressureDate =DateUtil.convertStringToDate(json['BloodPressureDate']);
|
||||||
|
measuredArm = json['MeasuredArm'];
|
||||||
|
systolicePressure = json['SystolicePressure'];
|
||||||
|
diastolicPressure = json['DiastolicPressure'];
|
||||||
|
remark = json['Remark'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
chartYear = json['ChartYear'];
|
||||||
|
chartMonth = json['ChartMonth'];
|
||||||
|
yearSystolicePressureAverageResult =
|
||||||
|
json['YearSystolicePressureAverageResult'];
|
||||||
|
monthSystolicePressureResult = json['MonthSystolicePressureResult'];
|
||||||
|
weekSystolicePressureResult = json['WeekSystolicePressureResult'];
|
||||||
|
yearDiastolicPressureAverageResult =
|
||||||
|
json['YearDiastolicPressureAverageResult'];
|
||||||
|
monthDiastolicPressureResult = json['MonthDiastolicPressureResult'];
|
||||||
|
weekDiastolicPressureResult = json['WeekDiastolicPressureResult'];
|
||||||
|
measuredArmDesc = json['MeasuredArmDesc'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['LineItemNo'] = this.lineItemNo;
|
||||||
|
data['BloodPressureDate'] = this.bloodPressureDate;
|
||||||
|
data['MeasuredArm'] = this.measuredArm;
|
||||||
|
data['SystolicePressure'] = this.systolicePressure;
|
||||||
|
data['DiastolicPressure'] = this.diastolicPressure;
|
||||||
|
data['Remark'] = this.remark;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['ChartYear'] = this.chartYear;
|
||||||
|
data['ChartMonth'] = this.chartMonth;
|
||||||
|
data['YearSystolicePressureAverageResult'] =
|
||||||
|
this.yearSystolicePressureAverageResult;
|
||||||
|
data['MonthSystolicePressureResult'] = this.monthSystolicePressureResult;
|
||||||
|
data['WeekSystolicePressureResult'] = this.weekSystolicePressureResult;
|
||||||
|
data['YearDiastolicPressureAverageResult'] =
|
||||||
|
this.yearDiastolicPressureAverageResult;
|
||||||
|
data['MonthDiastolicPressureResult'] = this.monthDiastolicPressureResult;
|
||||||
|
data['WeekDiastolicPressureResult'] = this.weekDiastolicPressureResult;
|
||||||
|
data['MeasuredArmDesc'] = this.measuredArmDesc;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
class MonthBloodPressureResultAverage {
|
||||||
|
dynamic weekfourSystolicePressureAverageResult;
|
||||||
|
dynamic weekfourDiastolicPressureAverageResult;
|
||||||
|
dynamic weekthreeSystolicePressureAverageResult;
|
||||||
|
dynamic weekthreeDiastolicPressureAverageResult;
|
||||||
|
dynamic weektwoSystolicePressureAverageResult;
|
||||||
|
dynamic weektwoDiastolicPressureAverageResult;
|
||||||
|
dynamic weekoneSystolicePressureAverageResult;
|
||||||
|
dynamic weekoneDiastolicPressureAverageResult;
|
||||||
|
String weekDesc;
|
||||||
|
int weekDiastolicPressureAverageResult;
|
||||||
|
int weekSystolicePressureAverageResult;
|
||||||
|
|
||||||
|
MonthBloodPressureResultAverage(
|
||||||
|
{this.weekfourSystolicePressureAverageResult,
|
||||||
|
this.weekfourDiastolicPressureAverageResult,
|
||||||
|
this.weekthreeSystolicePressureAverageResult,
|
||||||
|
this.weekthreeDiastolicPressureAverageResult,
|
||||||
|
this.weektwoSystolicePressureAverageResult,
|
||||||
|
this.weektwoDiastolicPressureAverageResult,
|
||||||
|
this.weekoneSystolicePressureAverageResult,
|
||||||
|
this.weekoneDiastolicPressureAverageResult,
|
||||||
|
this.weekDesc,
|
||||||
|
this.weekDiastolicPressureAverageResult,
|
||||||
|
this.weekSystolicePressureAverageResult});
|
||||||
|
|
||||||
|
MonthBloodPressureResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
weekfourSystolicePressureAverageResult =
|
||||||
|
json['weekfourSystolicePressureAverageResult'];
|
||||||
|
weekfourDiastolicPressureAverageResult =
|
||||||
|
json['weekfourDiastolicPressureAverageResult'];
|
||||||
|
weekthreeSystolicePressureAverageResult =
|
||||||
|
json['weekthreeSystolicePressureAverageResult'];
|
||||||
|
weekthreeDiastolicPressureAverageResult =
|
||||||
|
json['weekthreeDiastolicPressureAverageResult'];
|
||||||
|
weektwoSystolicePressureAverageResult =
|
||||||
|
json['weektwoSystolicePressureAverageResult'];
|
||||||
|
weektwoDiastolicPressureAverageResult =
|
||||||
|
json['weektwoDiastolicPressureAverageResult'];
|
||||||
|
weekoneSystolicePressureAverageResult =
|
||||||
|
json['weekoneSystolicePressureAverageResult'];
|
||||||
|
weekoneDiastolicPressureAverageResult =
|
||||||
|
json['weekoneDiastolicPressureAverageResult'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
weekDiastolicPressureAverageResult =
|
||||||
|
json['WeekDiastolicPressureAverageResult'];
|
||||||
|
weekSystolicePressureAverageResult =
|
||||||
|
json['WeekSystolicePressureAverageResult'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['weekfourSystolicePressureAverageResult'] =
|
||||||
|
this.weekfourSystolicePressureAverageResult;
|
||||||
|
data['weekfourDiastolicPressureAverageResult'] =
|
||||||
|
this.weekfourDiastolicPressureAverageResult;
|
||||||
|
data['weekthreeSystolicePressureAverageResult'] =
|
||||||
|
this.weekthreeSystolicePressureAverageResult;
|
||||||
|
data['weekthreeDiastolicPressureAverageResult'] =
|
||||||
|
this.weekthreeDiastolicPressureAverageResult;
|
||||||
|
data['weektwoSystolicePressureAverageResult'] =
|
||||||
|
this.weektwoSystolicePressureAverageResult;
|
||||||
|
data['weektwoDiastolicPressureAverageResult'] =
|
||||||
|
this.weektwoDiastolicPressureAverageResult;
|
||||||
|
data['weekoneSystolicePressureAverageResult'] =
|
||||||
|
this.weekoneSystolicePressureAverageResult;
|
||||||
|
data['weekoneDiastolicPressureAverageResult'] =
|
||||||
|
this.weekoneDiastolicPressureAverageResult;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
data['WeekDiastolicPressureAverageResult'] =
|
||||||
|
this.weekDiastolicPressureAverageResult;
|
||||||
|
data['WeekSystolicePressureAverageResult'] =
|
||||||
|
this.weekSystolicePressureAverageResult;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class WeekBloodPressureResultAverage {
|
||||||
|
int dailySystolicePressureAverageResult;
|
||||||
|
int dailyDiastolicPressureAverageResult;
|
||||||
|
DateTime bloodPressureDate;
|
||||||
|
|
||||||
|
WeekBloodPressureResultAverage(
|
||||||
|
{this.dailySystolicePressureAverageResult,
|
||||||
|
this.dailyDiastolicPressureAverageResult,
|
||||||
|
this.bloodPressureDate});
|
||||||
|
|
||||||
|
WeekBloodPressureResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
dailySystolicePressureAverageResult =
|
||||||
|
json['DailySystolicePressureAverageResult'];
|
||||||
|
dailyDiastolicPressureAverageResult =
|
||||||
|
json['DailyDiastolicPressureAverageResult'];
|
||||||
|
bloodPressureDate = DateUtil.convertStringToDate(json['BloodPressureDate']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DailySystolicePressureAverageResult'] =
|
||||||
|
this.dailySystolicePressureAverageResult;
|
||||||
|
data['DailyDiastolicPressureAverageResult'] =
|
||||||
|
this.dailyDiastolicPressureAverageResult;
|
||||||
|
data['BloodPressureDate'] = this.bloodPressureDate;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class YearBloodPressureResultAverage {
|
||||||
|
int monthSystolicePressureAverageResult;
|
||||||
|
int monthDiastolicPressureAverageResult;
|
||||||
|
dynamic monthNumber;
|
||||||
|
String monthName;
|
||||||
|
String yearName;
|
||||||
|
DateTime date;
|
||||||
|
|
||||||
|
YearBloodPressureResultAverage(
|
||||||
|
{this.monthSystolicePressureAverageResult,
|
||||||
|
this.monthDiastolicPressureAverageResult,
|
||||||
|
this.monthNumber,
|
||||||
|
this.monthName,
|
||||||
|
this.yearName});
|
||||||
|
|
||||||
|
YearBloodPressureResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
monthSystolicePressureAverageResult =
|
||||||
|
json['monthSystolicePressureAverageResult'];
|
||||||
|
monthDiastolicPressureAverageResult =
|
||||||
|
json['monthDiastolicPressureAverageResult'];
|
||||||
|
monthNumber = json['monthNumber'];
|
||||||
|
monthName = json['monthName'];
|
||||||
|
yearName = json['yearName'];
|
||||||
|
date = DateUtil.getMonthDateTime(monthName,yearName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['monthSystolicePressureAverageResult'] =
|
||||||
|
this.monthSystolicePressureAverageResult;
|
||||||
|
data['monthDiastolicPressureAverageResult'] =
|
||||||
|
this.monthDiastolicPressureAverageResult;
|
||||||
|
data['monthNumber'] = this.monthNumber;
|
||||||
|
data['monthName'] = this.monthName;
|
||||||
|
data['yearName'] = this.yearName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class DiabtecPatientResult {
|
||||||
|
String chartMonth;
|
||||||
|
var chartYear;
|
||||||
|
DateTime dateChart;
|
||||||
|
var description;
|
||||||
|
var descriptionN;
|
||||||
|
int diabtecAvarage;
|
||||||
|
bool isActive;
|
||||||
|
int lineItemNo;
|
||||||
|
var listMonth;
|
||||||
|
var listWeek;
|
||||||
|
int measured;
|
||||||
|
String measuredDesc;
|
||||||
|
var monthAverageResult;
|
||||||
|
int patientID;
|
||||||
|
var remark;
|
||||||
|
var resultDesc;
|
||||||
|
int resultValue;
|
||||||
|
String unit;
|
||||||
|
var weekAverageResult;
|
||||||
|
String weekDesc;
|
||||||
|
var yearAverageResult;
|
||||||
|
|
||||||
|
DiabtecPatientResult(
|
||||||
|
{this.chartMonth,
|
||||||
|
this.chartYear,
|
||||||
|
this.dateChart,
|
||||||
|
this.description,
|
||||||
|
this.descriptionN,
|
||||||
|
this.diabtecAvarage,
|
||||||
|
this.isActive,
|
||||||
|
this.lineItemNo,
|
||||||
|
this.listMonth,
|
||||||
|
this.listWeek,
|
||||||
|
this.measured,
|
||||||
|
this.measuredDesc,
|
||||||
|
this.monthAverageResult,
|
||||||
|
this.patientID,
|
||||||
|
this.remark,
|
||||||
|
this.resultDesc,
|
||||||
|
this.resultValue,
|
||||||
|
this.unit,
|
||||||
|
this.weekAverageResult,
|
||||||
|
this.weekDesc,
|
||||||
|
this.yearAverageResult});
|
||||||
|
|
||||||
|
DiabtecPatientResult.fromJson(Map<String, dynamic> json) {
|
||||||
|
chartMonth = json['ChartMonth'];
|
||||||
|
chartYear = json['ChartYear'];
|
||||||
|
dateChart = DateUtil.convertStringToDate(json['DateChart']);
|
||||||
|
description = json['Description'];
|
||||||
|
descriptionN = json['DescriptionN'];
|
||||||
|
diabtecAvarage = json['DiabtecAvarage'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
lineItemNo = json['LineItemNo'];
|
||||||
|
listMonth = json['List_Month'];
|
||||||
|
listWeek = json['List_Week'];
|
||||||
|
measured = json['Measured'];
|
||||||
|
measuredDesc = json['MeasuredDesc'];
|
||||||
|
monthAverageResult = json['MonthAverageResult'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
remark = json['Remark'];
|
||||||
|
resultDesc = json['ResultDesc'];
|
||||||
|
resultValue = json['ResultValue'];
|
||||||
|
unit = json['Unit'];
|
||||||
|
weekAverageResult = json['WeekAverageResult'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
yearAverageResult = json['YearAverageResult'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ChartMonth'] = this.chartMonth;
|
||||||
|
data['ChartYear'] = this.chartYear;
|
||||||
|
data['DateChart'] = DateUtil.convertDateToString(this.dateChart);
|
||||||
|
data['Description'] = this.description;
|
||||||
|
data['DescriptionN'] = this.descriptionN;
|
||||||
|
data['DiabtecAvarage'] = this.diabtecAvarage;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['LineItemNo'] = this.lineItemNo;
|
||||||
|
data['List_Month'] = this.listMonth;
|
||||||
|
data['List_Week'] = this.listWeek;
|
||||||
|
data['Measured'] = this.measured;
|
||||||
|
data['MeasuredDesc'] = this.measuredDesc;
|
||||||
|
data['MonthAverageResult'] = this.monthAverageResult;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['Remark'] = this.remark;
|
||||||
|
data['ResultDesc'] = this.resultDesc;
|
||||||
|
data['ResultValue'] = this.resultValue;
|
||||||
|
data['Unit'] = this.unit;
|
||||||
|
data['WeekAverageResult'] = this.weekAverageResult;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
data['YearAverageResult'] = this.yearAverageResult;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
class MonthDiabtectResultAverage {
|
||||||
|
var weekfourAverageResult;
|
||||||
|
var weekthreeAverageResult;
|
||||||
|
var weektwoAverageResult;
|
||||||
|
var weekoneAverageResult;
|
||||||
|
dynamic weekAverageResult;
|
||||||
|
String weekDesc;
|
||||||
|
|
||||||
|
MonthDiabtectResultAverage(
|
||||||
|
{this.weekfourAverageResult,
|
||||||
|
this.weekthreeAverageResult,
|
||||||
|
this.weektwoAverageResult,
|
||||||
|
this.weekoneAverageResult,
|
||||||
|
this.weekAverageResult,
|
||||||
|
this.weekDesc});
|
||||||
|
|
||||||
|
MonthDiabtectResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
weekfourAverageResult = json['weekfourAverageResult'];
|
||||||
|
weekthreeAverageResult = json['weekthreeAverageResult'];
|
||||||
|
weektwoAverageResult = json['weektwoAverageResult'];
|
||||||
|
weekoneAverageResult = json['weekoneAverageResult'];
|
||||||
|
weekAverageResult = json['WeekAverageResult'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['weekfourAverageResult'] = this.weekfourAverageResult;
|
||||||
|
data['weekthreeAverageResult'] = this.weekthreeAverageResult;
|
||||||
|
data['weektwoAverageResult'] = this.weektwoAverageResult;
|
||||||
|
data['weekoneAverageResult'] = this.weekoneAverageResult;
|
||||||
|
data['WeekAverageResult'] = this.weekAverageResult;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class WeekDiabtectResultAverage {
|
||||||
|
int dailyAverageResult;
|
||||||
|
DateTime dateChart;
|
||||||
|
|
||||||
|
WeekDiabtectResultAverage({this.dailyAverageResult, this.dateChart});
|
||||||
|
|
||||||
|
WeekDiabtectResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
dailyAverageResult = json['DailyAverageResult'];
|
||||||
|
dateChart = DateUtil.convertStringToDate(json['DateChart']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DailyAverageResult'] = this.dailyAverageResult;
|
||||||
|
data['DateChart'] = DateUtil.convertDateToString(this.dateChart);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class YearDiabtecResultAverage {
|
||||||
|
dynamic monthAverageResult;
|
||||||
|
var monthNumber;
|
||||||
|
String monthName;
|
||||||
|
String yearName;
|
||||||
|
DateTime date;
|
||||||
|
|
||||||
|
YearDiabtecResultAverage(
|
||||||
|
{this.monthAverageResult,
|
||||||
|
this.monthNumber,
|
||||||
|
this.monthName,
|
||||||
|
this.yearName});
|
||||||
|
|
||||||
|
YearDiabtecResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
try {
|
||||||
|
monthAverageResult = json['monthAverageResult'];
|
||||||
|
monthNumber = json['monthNumber'];
|
||||||
|
monthName = json['monthName'];
|
||||||
|
yearName = json['yearName'];
|
||||||
|
date = DateUtil.getMonthDateTime(monthName,yearName);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['monthAverageResult'] = this.monthAverageResult;
|
||||||
|
data['monthNumber'] = this.monthNumber;
|
||||||
|
data['monthName'] = this.monthName;
|
||||||
|
data['yearName'] = this.yearName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
class WeekChartDate {
|
||||||
|
final DateTime x;
|
||||||
|
final dynamic y;
|
||||||
|
|
||||||
|
WeekChartDate({this.x, this.y});
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
class YearMonthlyChartDate {
|
||||||
|
final dynamic x;
|
||||||
|
final dynamic y;
|
||||||
|
|
||||||
|
YearMonthlyChartDate({this.x, this.y});
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
class MonthWeightMeasurementResultAverage {
|
||||||
|
dynamic weekfourAverageResult;
|
||||||
|
dynamic weekthreeAverageResult;
|
||||||
|
dynamic weektwoAverageResult;
|
||||||
|
dynamic weekoneAverageResult;
|
||||||
|
dynamic weekAverageResult;
|
||||||
|
String weekDesc;
|
||||||
|
|
||||||
|
MonthWeightMeasurementResultAverage(
|
||||||
|
{this.weekfourAverageResult,
|
||||||
|
this.weekthreeAverageResult,
|
||||||
|
this.weektwoAverageResult,
|
||||||
|
this.weekoneAverageResult,
|
||||||
|
this.weekAverageResult,
|
||||||
|
this.weekDesc});
|
||||||
|
|
||||||
|
MonthWeightMeasurementResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
weekfourAverageResult = json['weekfourAverageResult'];
|
||||||
|
weekthreeAverageResult = json['weekthreeAverageResult'];
|
||||||
|
weektwoAverageResult = json['weektwoAverageResult'];
|
||||||
|
weekoneAverageResult = json['weekoneAverageResult'];
|
||||||
|
weekAverageResult = json['WeekAverageResult'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['weekfourAverageResult'] = this.weekfourAverageResult;
|
||||||
|
data['weekthreeAverageResult'] = this.weekthreeAverageResult;
|
||||||
|
data['weektwoAverageResult'] = this.weektwoAverageResult;
|
||||||
|
data['weekoneAverageResult'] = this.weekoneAverageResult;
|
||||||
|
data['WeekAverageResult'] = this.weekAverageResult;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class WeekWeightMeasurementResultAverage {
|
||||||
|
dynamic dailyAverageResult;
|
||||||
|
DateTime weightDate;
|
||||||
|
|
||||||
|
WeekWeightMeasurementResultAverage(
|
||||||
|
{this.dailyAverageResult, this.weightDate});
|
||||||
|
|
||||||
|
WeekWeightMeasurementResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
dailyAverageResult = json['DailyAverageResult'];
|
||||||
|
weightDate = DateUtil.convertStringToDate(json['WeightDate']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DailyAverageResult'] = this.dailyAverageResult;
|
||||||
|
data['WeightDate'] = this.weightDate;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class WeightMeasurementResult {
|
||||||
|
int patientID;
|
||||||
|
int lineItemNo;
|
||||||
|
int weightMeasured;
|
||||||
|
DateTime weightDate;
|
||||||
|
dynamic remark;
|
||||||
|
bool isActive;
|
||||||
|
int measured;
|
||||||
|
dynamic unit;
|
||||||
|
int chartYear;
|
||||||
|
dynamic chartMonth;
|
||||||
|
double yearAverageResult;
|
||||||
|
dynamic monthAverageResult;
|
||||||
|
dynamic weekAverageResult;
|
||||||
|
dynamic weekDesc;
|
||||||
|
|
||||||
|
WeightMeasurementResult(
|
||||||
|
{this.patientID,
|
||||||
|
this.lineItemNo,
|
||||||
|
this.weightMeasured,
|
||||||
|
this.weightDate,
|
||||||
|
this.remark,
|
||||||
|
this.isActive,
|
||||||
|
this.measured,
|
||||||
|
this.unit,
|
||||||
|
this.chartYear,
|
||||||
|
this.chartMonth,
|
||||||
|
this.yearAverageResult,
|
||||||
|
this.monthAverageResult,
|
||||||
|
this.weekAverageResult,
|
||||||
|
this.weekDesc});
|
||||||
|
|
||||||
|
WeightMeasurementResult.fromJson(Map<String, dynamic> json) {
|
||||||
|
try {
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
lineItemNo = json['LineItemNo'];
|
||||||
|
weightMeasured = json['WeightMeasured'];
|
||||||
|
weightDate = DateUtil.convertStringToDate(json['WeightDate']);
|
||||||
|
remark = json['Remark'];
|
||||||
|
isActive = json['IsActive'];
|
||||||
|
measured = json['Measured'];
|
||||||
|
unit = json['Unit'];
|
||||||
|
chartYear = json['ChartYear'];
|
||||||
|
chartMonth = json['ChartMonth'];
|
||||||
|
yearAverageResult = json['YearAverageResult'];
|
||||||
|
monthAverageResult = json['MonthAverageResult'];
|
||||||
|
weekAverageResult = json['WeekAverageResult'];
|
||||||
|
weekDesc = json['WeekDesc'];
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['LineItemNo'] = this.lineItemNo;
|
||||||
|
data['WeightMeasured'] = this.weightMeasured;
|
||||||
|
data['WeightDate'] = this.weightDate;
|
||||||
|
data['Remark'] = this.remark;
|
||||||
|
data['IsActive'] = this.isActive;
|
||||||
|
data['Measured'] = this.measured;
|
||||||
|
data['Unit'] = this.unit;
|
||||||
|
data['ChartYear'] = this.chartYear;
|
||||||
|
data['ChartMonth'] = this.chartMonth;
|
||||||
|
data['YearAverageResult'] = this.yearAverageResult;
|
||||||
|
data['MonthAverageResult'] = this.monthAverageResult;
|
||||||
|
data['WeekAverageResult'] = this.weekAverageResult;
|
||||||
|
data['WeekDesc'] = this.weekDesc;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
|
||||||
|
class YearWeightMeasurementResultAverage {
|
||||||
|
dynamic monthAverageResult;
|
||||||
|
int monthNumber;
|
||||||
|
String monthName;
|
||||||
|
String yearName;
|
||||||
|
DateTime date;
|
||||||
|
|
||||||
|
YearWeightMeasurementResultAverage(
|
||||||
|
{this.monthAverageResult,
|
||||||
|
this.monthNumber,
|
||||||
|
this.monthName,
|
||||||
|
this.yearName});
|
||||||
|
|
||||||
|
YearWeightMeasurementResultAverage.fromJson(Map<String, dynamic> json) {
|
||||||
|
monthAverageResult = json['monthAverageResult'];
|
||||||
|
monthNumber = json['monthNumber'];
|
||||||
|
monthName = json['monthName'];
|
||||||
|
yearName = json['yearName'];
|
||||||
|
date = DateUtil.getMonthDateTime(monthName,yearName);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['monthAverageResult'] = this.monthAverageResult;
|
||||||
|
data['monthNumber'] = this.monthNumber;
|
||||||
|
data['monthName'] = this.monthName;
|
||||||
|
data['yearName'] = this.yearName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/MonthBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/WeekBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/YearBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/MonthDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/YearDiabtecResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
|
||||||
|
class BloodPressureService extends BaseService {
|
||||||
|
List<MonthBloodPressureResultAverage> monthDiabtectResultAverageList = List();
|
||||||
|
List<WeekBloodPressureResultAverage> weekDiabtectResultAverageList = List();
|
||||||
|
List<YearBloodPressureResultAverage> yearDiabtecResultAverageList = List();
|
||||||
|
|
||||||
|
///Result
|
||||||
|
List<BloodPressureResult> monthDiabtecPatientResult = List();
|
||||||
|
List<BloodPressureResult> weekDiabtecPatientResult = List();
|
||||||
|
List<BloodPressureResult> yearDiabtecPatientResult = List();
|
||||||
|
|
||||||
|
Future getBloodSugar() async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
await baseAppClient.post(GET_BLOOD_PRESSURE_RESULT_AVERAGE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthDiabtectResultAverageList.clear();
|
||||||
|
weekDiabtectResultAverageList.clear();
|
||||||
|
yearDiabtecResultAverageList.clear();
|
||||||
|
response['List_MonthBloodPressureResultAverage'].forEach((item) {
|
||||||
|
monthDiabtectResultAverageList
|
||||||
|
.add(MonthBloodPressureResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_WeekBloodPressureResultAverage'].forEach((item) {
|
||||||
|
weekDiabtectResultAverageList
|
||||||
|
.add(WeekBloodPressureResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearBloodPressureResultAverage'].forEach((item) {
|
||||||
|
yearDiabtecResultAverageList
|
||||||
|
.add(YearBloodPressureResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getDiabtecResults() async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(GET_BLOOD_PRESSURE_RESULT,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthDiabtecPatientResult.clear();
|
||||||
|
weekDiabtecPatientResult.clear();
|
||||||
|
yearDiabtecPatientResult.clear();
|
||||||
|
|
||||||
|
response['List_WeekBloodPressureResult'].forEach((item) {
|
||||||
|
weekDiabtecPatientResult.add(BloodPressureResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_MonthBloodPressureResult'].forEach((item) {
|
||||||
|
monthDiabtecPatientResult.add(BloodPressureResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearBloodPressureResult'].forEach((item) {
|
||||||
|
yearDiabtecPatientResult.add(BloodPressureResult.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: Map());
|
||||||
|
}
|
||||||
|
|
||||||
|
addDiabtecResult(
|
||||||
|
{String bloodPressureDate,
|
||||||
|
String diastolicPressure,
|
||||||
|
String systolicePressure,
|
||||||
|
int measuredArm}) async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['BloodPressureDate'] = bloodPressureDate;
|
||||||
|
body['DiastolicPressure'] = diastolicPressure;
|
||||||
|
body['SystolicePressure'] = systolicePressure;
|
||||||
|
body['MeasuredArm'] = measuredArm;
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
|
||||||
|
await baseAppClient.post(ADD_BLOOD_PRESSURE_RESULT,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/MonthDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/YearDiabtecResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
|
||||||
|
class BloodSugarService extends BaseService {
|
||||||
|
List<MonthDiabtectResultAverage> monthDiabtectResultAverageList = List();
|
||||||
|
List<WeekDiabtectResultAverage> weekDiabtectResultAverageList = List();
|
||||||
|
List<YearDiabtecResultAverage> yearDiabtecResultAverageList = List();
|
||||||
|
|
||||||
|
///Result
|
||||||
|
List<DiabtecPatientResult> monthDiabtecPatientResult = List();
|
||||||
|
List<DiabtecPatientResult> weekDiabtecPatientResult = List();
|
||||||
|
List<DiabtecPatientResult> yearDiabtecPatientResult = List();
|
||||||
|
|
||||||
|
Future getBloodSugar() async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
await baseAppClient.post(GET_DIABETIC_RESULT_AVERAGE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthDiabtectResultAverageList.clear();
|
||||||
|
weekDiabtectResultAverageList.clear();
|
||||||
|
yearDiabtecResultAverageList.clear();
|
||||||
|
response['List_MonthDiabtectResultAverage'].forEach((item) {
|
||||||
|
monthDiabtectResultAverageList
|
||||||
|
.add(MonthDiabtectResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_WeekDiabtectResultAverage'].forEach((item) {
|
||||||
|
weekDiabtectResultAverageList
|
||||||
|
.add(WeekDiabtectResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearDiabtecResultAverage'].forEach((item) {
|
||||||
|
yearDiabtecResultAverageList
|
||||||
|
.add(YearDiabtecResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getDiabtecResults() async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(GET_DIABTEC_RESULT,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthDiabtecPatientResult.clear();
|
||||||
|
weekDiabtecPatientResult.clear();
|
||||||
|
yearDiabtecPatientResult.clear();
|
||||||
|
|
||||||
|
response['List_MonthDiabtecPatientResult'].forEach((item) {
|
||||||
|
monthDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_WeekDiabtecPatientResult'].forEach((item) {
|
||||||
|
weekDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearDiabtecPatientResult'].forEach((item) {
|
||||||
|
yearDiabtecPatientResult.add(DiabtecPatientResult.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: Map());
|
||||||
|
}
|
||||||
|
|
||||||
|
addDiabtecResult(
|
||||||
|
{String bloodSugerDateChart,
|
||||||
|
String bloodSugerResult,
|
||||||
|
String diabtecUnit,
|
||||||
|
int measuredTime}) async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['BloodSugerDateChart'] = bloodSugerDateChart;
|
||||||
|
body['BloodSugerResult'] = bloodSugerResult;
|
||||||
|
body['DiabtecUnit'] = diabtecUnit;
|
||||||
|
body['MeasuredTime'] =2;// measuredTime;
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
|
||||||
|
await baseAppClient.post(ADD_BLOOD_PRESSURE_RESULT,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
var asd ="";
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/MonthBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/WeekBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/YearBloodPressureResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/MonthDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/WeekDiabtectResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/YearDiabtecResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/MonthWeightMeasurementResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeekWeightMeasurementResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/YearWeightMeasurementResultAverage.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
|
||||||
|
class WeightService extends BaseService {
|
||||||
|
|
||||||
|
///Average
|
||||||
|
List<MonthWeightMeasurementResultAverage> monthWeightMeasurementResultAverage = List();
|
||||||
|
List<WeekWeightMeasurementResultAverage> weekWeightMeasurementResultAverage = List();
|
||||||
|
List<YearWeightMeasurementResultAverage> yearWeightMeasurementResultAverage = List();
|
||||||
|
|
||||||
|
///Result
|
||||||
|
List<WeightMeasurementResult> monthWeightMeasurementResult = List();
|
||||||
|
List<WeightMeasurementResult> weekWeightMeasurementResult = List();
|
||||||
|
List<WeightMeasurementResult> yearWeightMeasurementResult = List();
|
||||||
|
|
||||||
|
Future getWeightAverage() async {
|
||||||
|
hasError = false;
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT_AVERAGE,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthWeightMeasurementResultAverage.clear();
|
||||||
|
weekWeightMeasurementResultAverage.clear();
|
||||||
|
yearWeightMeasurementResultAverage.clear();
|
||||||
|
response['List_MonthWeightMeasurementResultAverage'].forEach((item) {
|
||||||
|
monthWeightMeasurementResultAverage
|
||||||
|
.add(MonthWeightMeasurementResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_WeekWeightMeasurementResultAverage'].forEach((item) {
|
||||||
|
weekWeightMeasurementResultAverage
|
||||||
|
.add(WeekWeightMeasurementResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearWeightMeasurementResultAverage'].forEach((item) {
|
||||||
|
yearWeightMeasurementResultAverage
|
||||||
|
.add(YearWeightMeasurementResultAverage.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getWeightMeasurementResult() async {
|
||||||
|
hasError = false;
|
||||||
|
await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
monthWeightMeasurementResult.clear();
|
||||||
|
weekWeightMeasurementResult.clear();
|
||||||
|
yearWeightMeasurementResult.clear();
|
||||||
|
|
||||||
|
response['List_WeekWeightMeasurementResult'].forEach((item) {
|
||||||
|
weekWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_MonthWeightMeasurementResult'].forEach((item) {
|
||||||
|
monthWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item));
|
||||||
|
});
|
||||||
|
|
||||||
|
response['List_YearWeightMeasurementResult'].forEach((item) {
|
||||||
|
yearWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: Map());
|
||||||
|
}
|
||||||
|
|
||||||
|
addWeightResult(
|
||||||
|
{String weightDate,
|
||||||
|
String weightMeasured,
|
||||||
|
int weightUnit}) async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
body['WeightDate'] = weightDate;
|
||||||
|
body['WeightMeasured'] = weightMeasured;
|
||||||
|
body['weightUnit'] = weightUnit;
|
||||||
|
body['isDentalAllowedBackend'] = false;
|
||||||
|
|
||||||
|
await baseAppClient.post(ADD_WEIGHT_PRESSURE_RESULT,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
|
||||||
|
},
|
||||||
|
onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/BloodPressureService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/locator.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
|
||||||
|
import '../../../core/viewModels/base_view_model.dart';
|
||||||
|
|
||||||
|
class BloodPressureViewMode extends BaseViewModel {
|
||||||
|
BloodPressureService bloodPressureService = locator<BloodPressureService>();
|
||||||
|
|
||||||
|
///BLOOD
|
||||||
|
List<WeekChartDate> _bloodDiastolicPressureWeeklyTimeSeriesSalesList = List();
|
||||||
|
List<WeekChartDate> _bloodSystolicePressureWeeklyTimeSeriesSalesList = List();
|
||||||
|
|
||||||
|
List<YearMonthlyChartDate> _bloodDiastolicMonthlyTimeSeriesSalesList = List();
|
||||||
|
List<YearMonthlyChartDate> _bloodSystolicMonthlyTimeSeriesSalesList = List();
|
||||||
|
|
||||||
|
List<WeekChartDate> _bloodSystoliceYearTimeSeriesSalesList = List();
|
||||||
|
List<WeekChartDate> _bloodDiastolicYearTimeSeriesSalesList = List();
|
||||||
|
|
||||||
|
List<BloodPressureResult> get monthDiabtecPatientResult => bloodPressureService.monthDiabtecPatientResult;
|
||||||
|
|
||||||
|
List<BloodPressureResult> get weekDiabtecPatientResult => bloodPressureService.weekDiabtecPatientResult;
|
||||||
|
|
||||||
|
List<BloodPressureResult> get yearDiabtecPatientResult => bloodPressureService.yearDiabtecPatientResult;
|
||||||
|
|
||||||
|
Future getBloodPressure() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await bloodPressureService.getBloodSugar();
|
||||||
|
await bloodPressureService.getDiabtecResults();
|
||||||
|
if (bloodPressureService.hasError) {
|
||||||
|
error = bloodPressureService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
bloodPressureService.weekDiabtectResultAverageList.forEach((element) {
|
||||||
|
_bloodDiastolicPressureWeeklyTimeSeriesSalesList.add(WeekChartDate(
|
||||||
|
x: element.bloodPressureDate,
|
||||||
|
y: element.dailyDiastolicPressureAverageResult));
|
||||||
|
_bloodSystolicePressureWeeklyTimeSeriesSalesList.add(WeekChartDate(
|
||||||
|
x: element.bloodPressureDate,
|
||||||
|
y: element.dailySystolicePressureAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int index = 0;
|
||||||
|
index < bloodPressureService.monthDiabtectResultAverageList.length;
|
||||||
|
index++) {
|
||||||
|
_bloodDiastolicMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate(
|
||||||
|
x: index,
|
||||||
|
y: bloodPressureService.monthDiabtectResultAverageList[index]
|
||||||
|
.weekDiastolicPressureAverageResult));
|
||||||
|
_bloodSystolicMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate(
|
||||||
|
x: index,
|
||||||
|
y: bloodPressureService.monthDiabtectResultAverageList[index]
|
||||||
|
.weekSystolicePressureAverageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
bloodPressureService.yearDiabtecResultAverageList.forEach((element) {
|
||||||
|
_bloodSystoliceYearTimeSeriesSalesList
|
||||||
|
.add(WeekChartDate(x: element.date, y: element.monthSystolicePressureAverageResult));
|
||||||
|
|
||||||
|
_bloodDiastolicYearTimeSeriesSalesList
|
||||||
|
.add(WeekChartDate(x: element.date, y: element.monthDiastolicPressureAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getBloodWeeklySeries() {
|
||||||
|
return [
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Diastolic',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodDiastolicPressureWeeklyTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Systolice',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodSystolicePressureWeeklyTimeSeriesSalesList,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<YearMonthlyChartDate, int>>
|
||||||
|
getBloodMonthlyTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
charts.Series<YearMonthlyChartDate, int>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (YearMonthlyChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (YearMonthlyChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodDiastolicMonthlyTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
charts.Series<YearMonthlyChartDate, int>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
|
||||||
|
domainFn: (YearMonthlyChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (YearMonthlyChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodSystolicMonthlyTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getBloodYearTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodSystoliceYearTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodDiastolicYearTimeSeriesSalesList,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
addDiabtecResult(
|
||||||
|
{String bloodPressureDate,
|
||||||
|
String diastolicPressure,
|
||||||
|
String systolicePressure,
|
||||||
|
int measuredArm}) async {
|
||||||
|
setState(ViewState.BusyLocal);
|
||||||
|
await bloodPressureService.addDiabtecResult(
|
||||||
|
bloodPressureDate: bloodPressureDate,
|
||||||
|
diastolicPressure: diastolicPressure,
|
||||||
|
systolicePressure: systolicePressure,
|
||||||
|
measuredArm: measuredArm);
|
||||||
|
if (bloodPressureService.hasError) {
|
||||||
|
error = bloodPressureService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
await getBloodPressure();
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/locator.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
|
||||||
|
import '../../../core/viewModels/base_view_model.dart';
|
||||||
|
|
||||||
|
class BloodSugarViewMode extends BaseViewModel {
|
||||||
|
BloodSugarService bloodSugarService = locator<BloodSugarService>();
|
||||||
|
|
||||||
|
///BLOOD
|
||||||
|
List<WeekChartDate> _bloodWeeklyTimeSeriesSalesList = List();
|
||||||
|
List<YearMonthlyChartDate> _bloodMonthlyTimeSeriesSalesList = List();
|
||||||
|
List<WeekChartDate> _bloodYearTimeSeriesSalesList = List();
|
||||||
|
|
||||||
|
List<DiabtecPatientResult> get monthDiabtecPatientResult =>
|
||||||
|
bloodSugarService.monthDiabtecPatientResult;
|
||||||
|
|
||||||
|
List<DiabtecPatientResult> get weekDiabtecPatientResult =>
|
||||||
|
bloodSugarService.weekDiabtecPatientResult;
|
||||||
|
|
||||||
|
List<DiabtecPatientResult> get yearDiabtecPatientResult =>
|
||||||
|
bloodSugarService.yearDiabtecPatientResult;
|
||||||
|
|
||||||
|
Future getBloodSugar() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await bloodSugarService.getBloodSugar();
|
||||||
|
await bloodSugarService.getDiabtecResults();
|
||||||
|
if (bloodSugarService.hasError) {
|
||||||
|
error = bloodSugarService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
bloodSugarService.weekDiabtectResultAverageList.forEach((element) {
|
||||||
|
_bloodWeeklyTimeSeriesSalesList.add(
|
||||||
|
WeekChartDate(x: element.dateChart, y: element.dailyAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int index = 0;
|
||||||
|
index < bloodSugarService.monthDiabtectResultAverageList.length;
|
||||||
|
index++) {
|
||||||
|
_bloodMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate(
|
||||||
|
x: index,
|
||||||
|
y: bloodSugarService
|
||||||
|
.monthDiabtectResultAverageList[index].weekAverageResult));
|
||||||
|
var asd="";
|
||||||
|
}
|
||||||
|
|
||||||
|
bloodSugarService.yearDiabtecResultAverageList.forEach((element) {
|
||||||
|
_bloodYearTimeSeriesSalesList
|
||||||
|
.add(WeekChartDate(x: element.date, y: element.monthAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getBloodWeeklySeries() {
|
||||||
|
return [
|
||||||
|
new charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodWeeklyTimeSeriesSalesList,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<YearMonthlyChartDate, int>>
|
||||||
|
getBloodMonthlyTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
new charts.Series<YearMonthlyChartDate, int>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (YearMonthlyChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (YearMonthlyChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodMonthlyTimeSeriesSalesList,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getBloodYearTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
new charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _bloodYearTimeSeriesSalesList,
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
addDiabtecResult(
|
||||||
|
{String bloodSugerDateChart,
|
||||||
|
String bloodSugerResult,
|
||||||
|
String diabtecUnit,
|
||||||
|
int measuredTime}) async {
|
||||||
|
setState(ViewState.BusyLocal);
|
||||||
|
await bloodSugarService.addDiabtecResult(
|
||||||
|
bloodSugerDateChart: bloodSugerDateChart,
|
||||||
|
bloodSugerResult: bloodSugerResult ,
|
||||||
|
diabtecUnit: diabtecUnit,
|
||||||
|
measuredTime: measuredTime);
|
||||||
|
if (bloodSugarService.hasError) {
|
||||||
|
error = bloodSugarService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
await getBloodSugar();
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/BloodPressureService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/BloodSugarService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/medical/WeightPressureService.dart';
|
||||||
|
import 'package:diplomaticquarterapp/locator.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
|
||||||
|
import '../../../core/viewModels/base_view_model.dart';
|
||||||
|
|
||||||
|
class WeightPressureViewMode extends BaseViewModel {
|
||||||
|
WeightService weightService = locator<WeightService>();
|
||||||
|
|
||||||
|
List<WeekChartDate> _weightWeeklyTimeSeriesSalesList = List();
|
||||||
|
List<YearMonthlyChartDate> _weightMonthlyTimeSeriesSalesList = List();
|
||||||
|
List<WeekChartDate> _weightYearTimeSeriesSalesList = List();
|
||||||
|
|
||||||
|
List<WeightMeasurementResult> get monthWeightMeasurementResult =>
|
||||||
|
weightService.monthWeightMeasurementResult;
|
||||||
|
|
||||||
|
List<WeightMeasurementResult> get weekWeightMeasurementResult =>
|
||||||
|
weightService.weekWeightMeasurementResult;
|
||||||
|
|
||||||
|
List<WeightMeasurementResult> get yearWeightMeasurementResult =>
|
||||||
|
weightService.yearWeightMeasurementResult;
|
||||||
|
|
||||||
|
Future getWeight() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await weightService.getWeightAverage();
|
||||||
|
await weightService.getWeightMeasurementResult();
|
||||||
|
if (weightService.hasError) {
|
||||||
|
error = weightService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
weightService.weekWeightMeasurementResultAverage.forEach((element) {
|
||||||
|
_weightWeeklyTimeSeriesSalesList.add(WeekChartDate(
|
||||||
|
x: element.weightDate, y: element.dailyAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int index = 0;
|
||||||
|
index < weightService.monthWeightMeasurementResultAverage.length;
|
||||||
|
index++) {
|
||||||
|
_weightMonthlyTimeSeriesSalesList.add(YearMonthlyChartDate(
|
||||||
|
x: index,
|
||||||
|
y: weightService.monthWeightMeasurementResultAverage[index].weekAverageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
weightService.yearWeightMeasurementResultAverage.forEach((element) {
|
||||||
|
_weightYearTimeSeriesSalesList
|
||||||
|
.add(WeekChartDate(x: element.date, y: element.monthAverageResult));
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getWeightWeeklySeries() {
|
||||||
|
return [
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Diastolic',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _weightWeeklyTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<YearMonthlyChartDate, int>>
|
||||||
|
getWeightMonthlyTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
charts.Series<YearMonthlyChartDate, int>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (YearMonthlyChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (YearMonthlyChartDate sales, _) => sales.y,
|
||||||
|
data: _weightMonthlyTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<charts.Series<WeekChartDate, DateTime>> getWeightYearTimeSeriesSales() {
|
||||||
|
return [
|
||||||
|
charts.Series<WeekChartDate, DateTime>(
|
||||||
|
id: 'Sales',
|
||||||
|
colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault,
|
||||||
|
domainFn: (WeekChartDate sales, _) => sales.x,
|
||||||
|
measureFn: (WeekChartDate sales, _) => sales.y,
|
||||||
|
data: _weightYearTimeSeriesSalesList,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
addWeightResult(
|
||||||
|
{String weightDate, String weightMeasured, int weightUnit}) async {
|
||||||
|
setState(ViewState.BusyLocal);
|
||||||
|
await weightService.addWeightResult(
|
||||||
|
weightDate: weightDate,
|
||||||
|
weightMeasured: weightMeasured,
|
||||||
|
weightUnit: weightUnit,);
|
||||||
|
if (weightService.hasError) {
|
||||||
|
error = weightService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
await getWeight();
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:feather_icons_flutter/feather_icons_flutter.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AddWeightPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_AddWeightPageState createState() => _AddWeightPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddWeightPageState extends State<AddWeightPage> {
|
||||||
|
TextEditingController _weightValueController = TextEditingController();
|
||||||
|
DateTime bloodSugarDate = DateTime.now();
|
||||||
|
DateTime timeSugarDate = DateTime.now();
|
||||||
|
int weightUnit = 1;
|
||||||
|
final List<String> measureUnitEnList = [
|
||||||
|
'Kg',
|
||||||
|
'Pound',
|
||||||
|
];
|
||||||
|
final List<String> measureUnitArList = [
|
||||||
|
'Kg',
|
||||||
|
'Pound',
|
||||||
|
];
|
||||||
|
String measureTimeSelectedType = 'Kg';
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
|
||||||
|
return BaseView<WeightPressureViewMode>(
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Add',
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(15),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: 'Enter Weight Value',
|
||||||
|
controller: _weightValueController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
|
||||||
|
? measureUnitEnList
|
||||||
|
: measureUnitArList);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(measureTimeSelectedType),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.grey,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showDatePicker(context,
|
||||||
|
showTitleActions: true,
|
||||||
|
minTime: DateTime(DateTime.now().year - 1, 1, 1),
|
||||||
|
maxTime: DateTime.now(), onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
bloodSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: bloodSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts('Date'),
|
||||||
|
Texts(getDate()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showTimePicker(context, showTitleActions: true,
|
||||||
|
onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
timeSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: timeSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [Texts('Time'), Texts(getTime())],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: double.infinity,
|
||||||
|
height: MediaQuery.of(context).size.width * 0.2,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: SecondaryButton(
|
||||||
|
loading: model.state == ViewState.BusyLocal,
|
||||||
|
label: 'SAVE',
|
||||||
|
textColor: Colors.white,
|
||||||
|
onTap: () {
|
||||||
|
if (_weightValueController.text.isNotEmpty ) {
|
||||||
|
model.addWeightResult(
|
||||||
|
weightDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
||||||
|
weightMeasured: _weightValueController.text.toString(),
|
||||||
|
weightUnit: weightUnit,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDate() {
|
||||||
|
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}";
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTime() {
|
||||||
|
return " ${timeSugarDate.hour}:${timeSugarDate.minute}";
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectMeasureTimeDialog(List<String> list) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: RadioStringDialog(
|
||||||
|
radioList: list,
|
||||||
|
title: 'Measure unit',
|
||||||
|
selectedValue: measureTimeSelectedType,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
measureTimeSelectedType = value;
|
||||||
|
weightUnit = list.indexOf(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.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:hexcolor/hexcolor.dart';
|
||||||
|
import 'AddWeightPage.dart';
|
||||||
|
import 'WeightMonthlyPage.dart';
|
||||||
|
import 'WeightYeaPage.dart';
|
||||||
|
import 'WeightWeeklyPage.dart';
|
||||||
|
|
||||||
|
class WeightHomePage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_WeightHomePageState createState() => _WeightHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WeightHomePageState extends State<WeightHomePage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_tabController.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<WeightPressureViewMode>(
|
||||||
|
onModelReady: (model) => model.getWeight(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Weight',
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Scaffold(
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(60.0),
|
||||||
|
child: Stack(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
height: 55.0,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: TabBar(
|
||||||
|
isScrollable: true,
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorWeight: 5.0,
|
||||||
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
|
indicatorColor: Colors.red[800],
|
||||||
|
labelColor: Theme.of(context).primaryColor,
|
||||||
|
labelPadding:
|
||||||
|
EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0),
|
||||||
|
unselectedLabelColor: Colors.grey[800],
|
||||||
|
tabs: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Weekly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Monthly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Yearly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
controller: _tabController,
|
||||||
|
children: <Widget>[
|
||||||
|
WeightWeeklyPage(
|
||||||
|
data: model.getWeightWeeklySeries(),
|
||||||
|
diabtecPatientResult: model.weekWeightMeasurementResult,
|
||||||
|
),
|
||||||
|
WeightMonthlyPage(
|
||||||
|
data: model.getWeightMonthlyTimeSeriesSales(),
|
||||||
|
diabtecPatientResult: model.monthWeightMeasurementResult,
|
||||||
|
),
|
||||||
|
WeightYearPage(
|
||||||
|
data: model.getWeightYearTimeSeriesSales(),
|
||||||
|
diabtecPatientResult: model.yearWeightMeasurementResult,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
floatingActionButton: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context, FadePage(page: AddWeightPage()));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle, color: Hexcolor('515B5D')),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class WeightMonthlyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<YearMonthlyChartDate, int>> data;
|
||||||
|
final List<WeightMeasurementResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const WeightMonthlyPage(
|
||||||
|
{Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.LineChart(data,
|
||||||
|
//animate: animate,
|
||||||
|
defaultRenderer:
|
||||||
|
new charts.LineRendererConfig(includePoints: true)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach(
|
||||||
|
(diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightDate.hour}:${diabtec.weightDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightMeasured}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class WeightWeeklyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<WeightMeasurementResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const WeightWeeklyPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12,),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Edit', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach((diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightDate.hour}:${diabtec.weightDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightMeasured}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/weight/WeightMeasurementResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class WeightYearPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<WeightMeasurementResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const WeightYearPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach(
|
||||||
|
(diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightDate.hour}:${diabtec.weightDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.weightMeasured}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,215 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:feather_icons_flutter/feather_icons_flutter.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AddBloodPressurePage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_AddBloodPressurePageState createState() => _AddBloodPressurePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
||||||
|
TextEditingController _bloodSystolicValueController = TextEditingController();
|
||||||
|
TextEditingController _bloodDiastolicValueController =
|
||||||
|
TextEditingController();
|
||||||
|
DateTime bloodSugarDate = DateTime.now();
|
||||||
|
DateTime timeSugarDate = DateTime.now();
|
||||||
|
int measuredArm = 1;
|
||||||
|
final List<String> measureTimeEnList = [
|
||||||
|
'Left Arm',
|
||||||
|
'Right Arm',
|
||||||
|
];
|
||||||
|
final List<String> measureTimeArList = [
|
||||||
|
'الذراع الأيسر',
|
||||||
|
'الذراع الأيمن',
|
||||||
|
];
|
||||||
|
String measureTimeSelectedType = 'Left Arm';
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
|
||||||
|
return BaseView<BloodPressureViewMode>(
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Add',
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(15),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: 'Enter Systolic Value',
|
||||||
|
controller: _bloodSystolicValueController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: 'Blood Diastolic Value',
|
||||||
|
controller: _bloodDiastolicValueController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
|
||||||
|
? measureTimeEnList
|
||||||
|
: measureTimeArList);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(measureTimeSelectedType),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.grey,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showDatePicker(context,
|
||||||
|
showTitleActions: true,
|
||||||
|
minTime: DateTime(DateTime.now().year - 1, 1, 1),
|
||||||
|
maxTime: DateTime.now(), onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
bloodSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: bloodSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts('Date'),
|
||||||
|
Texts(getDate()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showTimePicker(context, showTitleActions: true,
|
||||||
|
onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
timeSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: timeSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [Texts('Time'), Texts(getTime())],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: double.infinity,
|
||||||
|
height: MediaQuery.of(context).size.width * 0.2,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: SecondaryButton(
|
||||||
|
loading: model.state == ViewState.BusyLocal,
|
||||||
|
label: 'SAVE',
|
||||||
|
textColor: Colors.white,
|
||||||
|
onTap: () {
|
||||||
|
if (_bloodSystolicValueController.text.isNotEmpty &&
|
||||||
|
_bloodDiastolicValueController.text.isNotEmpty) {
|
||||||
|
model.addDiabtecResult(
|
||||||
|
bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
||||||
|
diastolicPressure: _bloodDiastolicValueController.text.toString(),
|
||||||
|
systolicePressure: _bloodSystolicValueController.text.toString(),
|
||||||
|
measuredArm: measuredArm,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDate() {
|
||||||
|
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}";
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTime() {
|
||||||
|
return " ${timeSugarDate.hour}:${timeSugarDate.minute}";
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectMeasureTimeDialog(List<String> list) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: RadioStringDialog(
|
||||||
|
radioList: list,
|
||||||
|
title: 'Select the Arm',
|
||||||
|
selectedValue: measureTimeSelectedType,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
measureTimeSelectedType = value;
|
||||||
|
measuredArm = list.indexOf(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.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:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
import 'AddBloodPressurePage.dart';
|
||||||
|
import 'BloodPressureMonthly.dart';
|
||||||
|
import 'BloodPressureYeaPage.dart';
|
||||||
|
import 'bloodPressureWeeklyPage.dart';
|
||||||
|
|
||||||
|
class BloodPressureHomePage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_BloodPressureHomePageState createState() => _BloodPressureHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BloodPressureHomePageState extends State<BloodPressureHomePage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_tabController.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<BloodPressureViewMode>(
|
||||||
|
onModelReady: (model) => model.getBloodPressure(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Blood Pressure',
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Scaffold(
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(60.0),
|
||||||
|
child: Stack(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
height: 55.0,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: TabBar(
|
||||||
|
isScrollable: true,
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorWeight: 5.0,
|
||||||
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
|
indicatorColor: Colors.red[800],
|
||||||
|
labelColor: Theme.of(context).primaryColor,
|
||||||
|
labelPadding:
|
||||||
|
EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0),
|
||||||
|
unselectedLabelColor: Colors.grey[800],
|
||||||
|
tabs: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Weekly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Monthly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Yearly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
controller: _tabController,
|
||||||
|
children: <Widget>[
|
||||||
|
BloodPressureWeeklyPage(
|
||||||
|
data: model.getBloodWeeklySeries(),
|
||||||
|
diabtecPatientResult: model.weekDiabtecPatientResult,
|
||||||
|
),
|
||||||
|
BloodPressureMonthlyPage(
|
||||||
|
data: model.getBloodMonthlyTimeSeriesSales(),
|
||||||
|
diabtecPatientResult: model.monthDiabtecPatientResult,
|
||||||
|
),
|
||||||
|
BloodPressureYearPage(
|
||||||
|
data: model.getBloodYearTimeSeriesSales(),
|
||||||
|
diabtecPatientResult: model.yearDiabtecPatientResult,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
floatingActionButton: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(context, FadePage(page: AddBloodPressurePage()));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle, color: Hexcolor('515B5D')),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodPressureMonthlyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<YearMonthlyChartDate, int>> data;
|
||||||
|
final List<BloodPressureResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodPressureMonthlyPage(
|
||||||
|
{Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.LineChart(data,
|
||||||
|
//animate: animate,
|
||||||
|
defaultRenderer:
|
||||||
|
new charts.LineRendererConfig(includePoints: true)),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Time',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Measured',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Value',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach(
|
||||||
|
(diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredArmDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.systolicePressure}/${diabtec.diastolicPressure}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodPressureYearPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<BloodPressureResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodPressureYearPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Time',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Measured',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Value',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach(
|
||||||
|
(diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredArmDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.systolicePressure}/${diabtec.diastolicPressure}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_pressur/BloodPressureResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodPressureWeeklyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<BloodPressureResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodPressureWeeklyPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12,),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Measured', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Edit', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach((diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredArmDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.systolicePressure}/${diabtec.diastolicPressure}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,344 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:feather_icons_flutter/feather_icons_flutter.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AddBloodSugarPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_AddBloodSugarPageState createState() => _AddBloodSugarPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
|
||||||
|
TextEditingController _bloodSugarValueController = TextEditingController();
|
||||||
|
DateTime bloodSugarDate = DateTime.now();
|
||||||
|
DateTime timeSugarDate = DateTime.now();
|
||||||
|
String measureUnitSelectedType = 'mg/dlt';
|
||||||
|
int measuredTime=1;
|
||||||
|
final List<String> measureUnitList = ['mg/dlt', 'mol/L'];
|
||||||
|
final List<String> measureTimeEnList = [
|
||||||
|
'Before Breakfast',
|
||||||
|
'After Breakfast',
|
||||||
|
'Before Lunch',
|
||||||
|
'After Lunch',
|
||||||
|
'Before Dinner',
|
||||||
|
'After Dinner',
|
||||||
|
'Before Sleep',
|
||||||
|
'After Sleep',
|
||||||
|
'Fasting',
|
||||||
|
'Other',
|
||||||
|
];
|
||||||
|
final List<String> measureTimeArList = [
|
||||||
|
'Before Breakfast',
|
||||||
|
'After Breakfast',
|
||||||
|
'Before Lunch',
|
||||||
|
'After Lunch',
|
||||||
|
'Before Dinner',
|
||||||
|
'After Dinner',
|
||||||
|
'Before Sleep',
|
||||||
|
'After Sleep',
|
||||||
|
'Fasting',
|
||||||
|
'Other',
|
||||||
|
];
|
||||||
|
String measureTimeSelectedType;
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
showTaskOptions() {
|
||||||
|
showModalBottomSheet(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(16.0),
|
||||||
|
topRight: Radius.circular(16.0))),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey[200],
|
||||||
|
borderRadius: BorderRadius.circular(3.0)),
|
||||||
|
width: 40.0,
|
||||||
|
height: 6.0,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 18.0, vertical: 18.0),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
FeatherIcons.share,
|
||||||
|
color: Theme
|
||||||
|
.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
size: 18.0,
|
||||||
|
),
|
||||||
|
SizedBox(width: 24.0),
|
||||||
|
Texts('Share Task',
|
||||||
|
variant: "body2Link", color: Colors.grey[800]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
// Navigator.of(context).push(SlideUpPageRoute(widget: PostTaskIndex(task: new Task(category: task?.category, description: task?.description, title: task?.title))));
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 18.0, vertical: 18.0),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
FeatherIcons.copy,
|
||||||
|
color: Theme
|
||||||
|
.of(context)
|
||||||
|
.primaryColor,
|
||||||
|
size: 18.0,
|
||||||
|
),
|
||||||
|
SizedBox(width: 24.0),
|
||||||
|
Texts('Post Similar Task',
|
||||||
|
variant: "body2Link", color: Colors.grey[800]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return BaseView<BloodSugarViewMode>(
|
||||||
|
builder: (_, model, w) =>
|
||||||
|
AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Add',
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(15),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
NewTextFields(
|
||||||
|
hintText: 'Enter Blood Sugar Value',
|
||||||
|
controller: _bloodSugarValueController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
confirmSelectMeasureUnitDialog();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(measureUnitSelectedType),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.grey,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showDatePicker(context,
|
||||||
|
showTitleActions: true,
|
||||||
|
minTime: DateTime(DateTime
|
||||||
|
.now()
|
||||||
|
.year - 1, 1, 1),
|
||||||
|
maxTime: DateTime.now(),
|
||||||
|
onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
bloodSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: bloodSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts('Date'),
|
||||||
|
Texts(getDate()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
DatePicker.showTimePicker(
|
||||||
|
context, showTitleActions: true,
|
||||||
|
onConfirm: (date) {
|
||||||
|
print('confirm $date');
|
||||||
|
setState(() {
|
||||||
|
timeSugarDate = date;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentTime: timeSugarDate,
|
||||||
|
locale: projectViewModel.localeType);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [Texts('Time'), Texts(getTime())],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
|
||||||
|
? measureTimeEnList
|
||||||
|
: measureTimeArList);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 65,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Texts(measureTimeSelectedType ?? 'Others'),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
color: Colors.grey,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomSheet: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: double.infinity,
|
||||||
|
height: MediaQuery
|
||||||
|
.of(context)
|
||||||
|
.size
|
||||||
|
.width * 0.2,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(15.0),
|
||||||
|
child: SecondaryButton(
|
||||||
|
loading: model.state == ViewState.BusyLocal,
|
||||||
|
label: 'SAVE', textColor: Colors.white, onTap: () {
|
||||||
|
if (_bloodSugarValueController.text.isNotEmpty) {
|
||||||
|
model.addDiabtecResult(diabtecUnit: measureUnitSelectedType,
|
||||||
|
measuredTime: measuredTime,
|
||||||
|
bloodSugerResult:_bloodSugarValueController.text.toString(),
|
||||||
|
bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDate() {
|
||||||
|
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate
|
||||||
|
.day}, ${bloodSugarDate.year}";
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTime() {
|
||||||
|
return " ${timeSugarDate.hour}:${timeSugarDate.minute}";
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectMeasureUnitDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: RadioStringDialog(
|
||||||
|
radioList: measureUnitList,
|
||||||
|
title: 'Measure unit',
|
||||||
|
selectedValue: measureUnitSelectedType,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
measureUnitSelectedType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void confirmSelectMeasureTimeDialog(List<String> list) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: RadioStringDialog(
|
||||||
|
radioList: list,
|
||||||
|
title: 'Measure time',
|
||||||
|
selectedValue: measureTimeSelectedType,
|
||||||
|
onValueSelected: (value) {
|
||||||
|
setState(() {
|
||||||
|
measureTimeSelectedType = value;
|
||||||
|
measuredTime = list.indexOf(value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/YearMonthlyChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodMonthlyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<YearMonthlyChartDate, int>> data;
|
||||||
|
final List<DiabtecPatientResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodMonthlyPage({Key key, this.data,this.diabtecPatientResult}) : super(key: key);
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.LineChart(
|
||||||
|
data,
|
||||||
|
//animate: animate,
|
||||||
|
defaultRenderer: new charts.LineRendererConfig(includePoints: true)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12,),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Measured', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach((diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.dateChart.hour}:${diabtec.dateChart.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.resultValue}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,199 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodYearPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<DiabtecPatientResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodYearPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Time',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Measured',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Value',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach(
|
||||||
|
(diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.dateChart.hour}:${diabtec.dateChart.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.resultValue}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,145 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.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:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
import 'AddBloodSugarPage.dart';
|
||||||
|
import 'BloodMonthly.dart';
|
||||||
|
import 'BloodYeaPage.dart';
|
||||||
|
import 'blood_sugar_weekly_page.dart';
|
||||||
|
|
||||||
|
class BloodSugarHomePage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_BloodSugarHomePageState createState() => _BloodSugarHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BloodSugarHomePageState extends State<BloodSugarHomePage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_tabController.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<BloodSugarViewMode>(
|
||||||
|
onModelReady: (model) => model.getBloodSugar(),
|
||||||
|
builder: (_, model, w) => AppScaffold(
|
||||||
|
isShowAppBar: true,
|
||||||
|
appBarTitle: 'Blood Sugar',
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Scaffold(
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(60.0),
|
||||||
|
child: Stack(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Center(
|
||||||
|
child: Container(
|
||||||
|
height: 55.0,
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: TabBar(
|
||||||
|
isScrollable: true,
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorWeight: 5.0,
|
||||||
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
|
indicatorColor: Colors.red[800],
|
||||||
|
labelColor: Theme.of(context).primaryColor,
|
||||||
|
labelPadding: EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0),
|
||||||
|
unselectedLabelColor: Colors.grey[800],
|
||||||
|
tabs: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Weekly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Monthly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.27,
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Yearly'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
controller: _tabController,
|
||||||
|
children: <Widget>[
|
||||||
|
BloodSugarWeeklyPage(data: model.getBloodWeeklySeries(),diabtecPatientResult: model.weekDiabtecPatientResult,),
|
||||||
|
BloodMonthlyPage(data: model.getBloodMonthlyTimeSeriesSales(),diabtecPatientResult: model.monthDiabtecPatientResult,),
|
||||||
|
BloodYearPage(data: model.getBloodYearTimeSeriesSales(),diabtecPatientResult: model.yearDiabtecPatientResult,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
floatingActionButton: InkWell(
|
||||||
|
onTap: (){
|
||||||
|
Navigator.push(context, FadePage(page: AddBloodSugarPage()));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Hexcolor('515B5D')
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(Icons.add,color: Colors.white,),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,204 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/my_trakers/chartData/WeekChartDate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class BloodSugarWeeklyPage extends StatelessWidget {
|
||||||
|
final List<charts.Series<WeekChartDate, DateTime>> data;
|
||||||
|
final List<DiabtecPatientResult> diabtecPatientResult;
|
||||||
|
|
||||||
|
const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: 180,
|
||||||
|
color: Colors.white,
|
||||||
|
child: charts.TimeSeriesChart(
|
||||||
|
data,
|
||||||
|
dateTimeFactory: const charts.LocalDateTimeFactory(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12,),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Texts('Details'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Table(
|
||||||
|
border: TableBorder.symmetric(
|
||||||
|
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
|
||||||
|
),
|
||||||
|
children: fullData(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TableRow> fullData() {
|
||||||
|
List<TableRow> tableRow = [];
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'Date',
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Time', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Measured', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Value', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Hexcolor('#515B5D'),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Texts('Edit', color: Colors.white,fontSize: 15,),
|
||||||
|
),
|
||||||
|
height: 40),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
diabtecPatientResult.forEach((diabtec) {
|
||||||
|
tableRow.add(
|
||||||
|
TableRow(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.dateChart.hour}:${diabtec.dateChart.minute}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.measuredDesc}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
'${diabtec.resultValue}',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
height: 70,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Center(
|
||||||
|
child: Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return tableRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,114 @@
|
|||||||
|
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 'Weight/WeightHomePage.dart';
|
||||||
|
import 'blood_pressure/BloodPressureHomePage.dart';
|
||||||
|
import 'blood_suger/blood_sugar_home_page.dart';
|
||||||
|
|
||||||
|
class MyTrackers extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: 'My Tracker',
|
||||||
|
isShowAppBar: true,
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: ()=> Navigator.push(context, FadePage(page: BloodSugarHomePage())),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(5),
|
||||||
|
width: MediaQuery.of(context).size.width*0.35,
|
||||||
|
height:MediaQuery.of(context).size.width*0.35 ,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/tracker/blood-suger.png',width: 60.0,),
|
||||||
|
SizedBox(height: 15,),
|
||||||
|
Text('Blood Sugar'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: ()=> Navigator.push(context, FadePage(page: BloodPressureHomePage())),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(5),
|
||||||
|
width: MediaQuery.of(context).size.width*0.35,
|
||||||
|
height:MediaQuery.of(context).size.width*0.35 ,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/tracker/blood-pressure.png',width: 60.0,),
|
||||||
|
SizedBox(height: 15,),
|
||||||
|
Text('Blood Pressure'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
//mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: ()=> Navigator.push(context, FadePage(page: WeightHomePage())),
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.all(5),
|
||||||
|
width: MediaQuery.of(context).size.width*0.35,
|
||||||
|
height:MediaQuery.of(context).size.width*0.35 ,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/tracker/weight.png',width: 60.0,),
|
||||||
|
SizedBox(height: 15,),
|
||||||
|
Text('Weight'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class RadioStringDialog extends StatefulWidget {
|
||||||
|
final List<String> radioList;
|
||||||
|
final Function(String) onValueSelected;
|
||||||
|
final String title;
|
||||||
|
String selectedValue;
|
||||||
|
|
||||||
|
RadioStringDialog(
|
||||||
|
{Key key,
|
||||||
|
this.radioList,
|
||||||
|
this.onValueSelected,
|
||||||
|
this.selectedValue,
|
||||||
|
this.title});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_RadioStringDialogState createState() => _RadioStringDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RadioStringDialogState extends State<RadioStringDialog> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
widget.selectedValue = widget.selectedValue ?? widget.radioList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
widget.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
))),
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: widget.radioList.length > 3
|
||||||
|
? MediaQuery.of(context).size.height * 0.6
|
||||||
|
: null,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Divider(),
|
||||||
|
...List.generate(
|
||||||
|
widget.radioList.length,
|
||||||
|
(index) => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedValue =
|
||||||
|
widget.radioList[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(widget.radioList[index]),
|
||||||
|
leading: Radio(
|
||||||
|
value: widget.radioList[index],
|
||||||
|
groupValue: widget.selectedValue,
|
||||||
|
activeColor: Colors.red[800],
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
widget.selectedValue = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.cancel
|
||||||
|
.toUpperCase(),
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 30,
|
||||||
|
color: Colors.grey[500],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
widget.onValueSelected(widget.selectedValue);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Texts(
|
||||||
|
TranslationBase.of(context).ok,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue