fix blood sugar service on my tracker

merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
parent 4457b5f109
commit 0b1014a91c

@ -289,6 +289,8 @@ const ADD_DIABTEC_RESULT = 'Services/Patients.svc/REST/Patient_AddDiabtecResult'
const GET_BLOOD_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetBloodPressureResultAverage';
const GET_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetBloodPressureResult';
const ADD_BLOOD_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_AddBloodPressureResult';
const UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult';
const GET_WEIGHT_PRESSURE_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResultAverage';
const GET_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_GetWeightMeasurementResult';

@ -1481,4 +1481,48 @@ const Map localizedValues = {
"en": "Orders Log",
"ar": "سجل الطلبات"
},
"blood-sugar": {
"en": "Blood Sugar",
"ar": "سكر الدم"
},
"my-tracker": {
"en": "My Tracker",
"ar": "قراءاتي"
},
"weekly": {
"en": "Weekly",
"ar": "أسبوعي"
},
"monthly": {
"en": "Monthly",
"ar": "شهري"
},
"yearly": {
"en": "Yearly",
"ar": "سنوي"
},
"measured": {
"en": "Measured",
"ar": "قياس"
},
"sugar-add": {
"en": "Enter Blood Sugar Value",
"ar": "أدخل قيمة قراءة السكر"
},
"other": {
"en": "Other",
"ar": "آخر"
},
"measure-unit": {
"en": "Measure unit",
"ar": "وحدة القياس"
},
"measure-time": {
"en": "Measure time",
"ar": "وقت القياس"
},"update": {
"en": "Update",
"ar": "تعديل"
},
};

@ -17,7 +17,7 @@ class DiabtecPatientResult {
int patientID;
var remark;
var resultDesc;
int resultValue;
dynamic resultValue;
String unit;
var weekAverageResult;
String weekDesc;

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class WeekDiabtectResultAverage {
int dailyAverageResult;
dynamic dailyAverageResult;
DateTime dateChart;
WeekDiabtectResultAverage({this.dailyAverageResult, this.dateChart});

@ -69,25 +69,34 @@ class BloodSugarService extends BaseService {
}, body: Map());
}
addDiabtecResult(
{String bloodSugerDateChart,
String bloodSugerResult,
String diabtecUnit,
int measuredTime}) async {
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['MeasuredTime'] = measuredTime;
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(ADD_BLOOD_PRESSURE_RESULT,
onSuccess: (response, statusCode) async {
var asd ="";
},
onSuccess: (response, statusCode) async {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['BloodSugerResult'] = bloodSugerResult;
body['DiabtecUnit'] = diabtecUnit;
body['BloodSugerDateChart'] = '${month.year}-${month.month}-${month.day} ${hour.hour}:${hour.minute}:00';
body['isDentalAllowedBackend'] = false;
body['MeasuredTime'] = measuredTime;
body['LineItemNo'] = lineItemNo;
await baseAppClient.post(UPDATE_DIABETIC_RESULT,
onSuccess: (response, statusCode) async {},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;

@ -45,7 +45,6 @@ class BloodSugarViewMode extends BaseViewModel {
x: index,
y: bloodSugarService
.monthDiabtectResultAverageList[index].weekAverageResult));
var asd="";
}
bloodSugarService.yearDiabtecResultAverageList.forEach((element) {
@ -94,11 +93,7 @@ class BloodSugarViewMode extends BaseViewModel {
];
}
addDiabtecResult(
{String bloodSugerDateChart,
String bloodSugerResult,
String diabtecUnit,
int measuredTime}) async {
Future addDiabtecResult({String bloodSugerDateChart, String bloodSugerResult, String diabtecUnit, int measuredTime}) async {
setState(ViewState.BusyLocal);
await bloodSugarService.addDiabtecResult(
bloodSugerDateChart: bloodSugerDateChart,
@ -113,7 +108,25 @@ class BloodSugarViewMode extends BaseViewModel {
setState(ViewState.Idle);
}
}
Future updateDiabtecResult({DateTime month,DateTime hour,String bloodSugerResult,String diabtecUnit, int measuredTime,int lineItemNo}) async {
setState(ViewState.BusyLocal);
await bloodSugarService.updateDiabtecResult(
bloodSugerResult: bloodSugerResult ,
diabtecUnit: diabtecUnit,
hour: hour,
measuredTime: measuredTime,
lineItemNo: lineItemNo,
month: month);
if (bloodSugarService.hasError) {
error = bloodSugarService.error;
setState(ViewState.Error);
} else {
await getBloodSugar();
setState(ViewState.Idle);
}
}
}

@ -3,18 +3,37 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_mo
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/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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 {
final DateTime bloodSugarDate;
final String measureUnitSelectedType;
final bool isUpdate;
final String measuredTime;
final String bloodSugarValue;
final int lineItemNo;
final BloodSugarViewMode bloodSugarViewMode;
AddBloodSugarPage(
{Key key,
this.bloodSugarDate,
this.measureUnitSelectedType,
this.isUpdate = false,
this.measuredTime,
this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode})
: super(key: key);
@override
_AddBloodSugarPageState createState() => _AddBloodSugarPageState();
}
@ -24,7 +43,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now();
String measureUnitSelectedType = 'mg/dlt';
int measuredTime=1;
int measuredTime = 1;
final List<String> measureUnitList = ['mg/dlt', 'mol/L'];
final List<String> measureTimeEnList = [
'Before Breakfast',
@ -39,270 +58,229 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
'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
void initState() {
super.initState();
if (widget.isUpdate) {
bloodSugarDate = widget.bloodSugarDate;
timeSugarDate = widget.bloodSugarDate;
measureUnitSelectedType = widget.measureUnitSelectedType;
if (measureTimeEnList.contains(widget.measuredTime))
measuredTime = measureTimeEnList.indexOf(widget.measuredTime);
else if (measureTimeArList.contains(widget.measuredTime))
measuredTime = measureTimeArList.indexOf(widget.measuredTime);
_bloodSugarValueController.text = widget.bloodSugarValue;
}
}
@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 AppScaffold(
isShowAppBar: true,
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
margin: EdgeInsets.all(15),
child: Column(
children: [
SizedBox(
height: 15,
),
NewTextFields(
hintText: TranslationBase.of(context).sugarAdd,
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,
)
],
),
],
),
),
);
});
}
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);
SizedBox(
height: 8,
),
InkWell(
onTap: () {
DatePicker.showDatePicker(context,
showTitleActions: true,
minTime: DateTime(DateTime.now().year - 1, 1, 1),
maxTime: DateTime.now(), onConfirm: (date) {
setState(() {
bloodSugarDate = date;
});
},
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);
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(TranslationBase.of(context).date),
Texts(getDate()),
],
),
),
),
SizedBox(
height: 8,
),
InkWell(
onTap: () {
DatePicker.showTimePicker(context, showTitleActions: true,
onConfirm: (date) {
setState(() {
timeSugarDate = date;
});
},
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,
)
],
),
),
),
],
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(TranslationBase.of(context).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 (_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',
);
}
}),
SizedBox(
height: 8,
),
InkWell(
onTap: () {
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
? measureTimeArList
: measureTimeEnList);
},
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 ??
TranslationBase.of(context).other),
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(
label: TranslationBase.of(context).save,
textColor: Colors.white,
onTap: () {
if (_bloodSugarValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate)
widget.bloodSugarViewMode.updateDiabtecResult(
month: bloodSugarDate,
hour: timeSugarDate,
diabtecUnit: measureUnitSelectedType,
measuredTime: measuredTime,
lineItemNo: widget.lineItemNo,
bloodSugerResult:
_bloodSugarValueController.text.toString()).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if(widget.bloodSugarViewMode.state == ViewState.Error)
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
});
else
widget.bloodSugarViewMode.addDiabtecResult(
diabtecUnit: measureUnitSelectedType,
measuredTime: measuredTime,
bloodSugerResult:
_bloodSugarValueController.text.toString(),
bloodSugerDateChart:
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if(widget.bloodSugarViewMode.state == ViewState.Error)
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
});
}
}),
),
),
);
}
String getDate() {
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate
.day}, ${bloodSugarDate.year}";
return "${DateUtil.getMonth(bloodSugarDate.month)} ${bloodSugarDate.day}, ${bloodSugarDate.year}";
}
String getTime() {
@ -314,7 +292,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
context: context,
child: RadioStringDialog(
radioList: measureUnitList,
title: 'Measure unit',
title: TranslationBase.of(context).measureUnit,
selectedValue: measureUnitSelectedType,
onValueSelected: (value) {
setState(() {
@ -330,7 +308,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
context: context,
child: RadioStringDialog(
radioList: list,
title: 'Measure time',
title: TranslationBase.of(context).measureTime,
selectedValue: measureTimeSelectedType,
onValueSelected: (value) {
setState(() {

@ -1,13 +1,16 @@
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/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
class BloodMonthlyPage extends StatelessWidget {
final List<charts.Series<YearMonthlyChartDate, int>> data;
@ -17,6 +20,7 @@ class BloodMonthlyPage extends StatelessWidget {
: super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body: ListView(
children: [
@ -34,7 +38,7 @@ class BloodMonthlyPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts('Details'),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
@ -46,7 +50,7 @@ class BloodMonthlyPage extends StatelessWidget {
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(),
children: fullData(context,projectViewModel),
),
],
),
@ -56,7 +60,7 @@ class BloodMonthlyPage extends StatelessWidget {
);
}
List<TableRow> fullData() {
List<TableRow> fullData(BuildContext context,ProjectViewModel projectViewModel) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
@ -64,14 +68,15 @@ class BloodMonthlyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0),
topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0),
topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0),
),
),
child: Center(
child: Texts(
'Date',
TranslationBase.of(context).date,
color: Colors.white,
fontSize: 15,
),
@ -82,11 +87,11 @@ class BloodMonthlyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Time',
TranslationBase.of(context).time,
color: Colors.white,
fontSize: 15,
),
@ -96,11 +101,11 @@ class BloodMonthlyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Measured',
TranslationBase.of(context).measured,
color: Colors.white,
fontSize: 15,
),
@ -110,20 +115,22 @@ class BloodMonthlyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.0),
topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0),
topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0),
),
),
child: Center(
child: Texts(
'Value',
TranslationBase.of(context).value,
color: Colors.white,
fontSize: 15,
),
),
height: 40),
),
],
),
);

@ -1,12 +1,15 @@
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/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
class BloodYearPage extends StatelessWidget {
final List<charts.Series<WeekChartDate, DateTime>> data;
@ -17,6 +20,7 @@ class BloodYearPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body: ListView(
children: [
@ -34,7 +38,7 @@ class BloodYearPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts('Details'),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
@ -46,7 +50,7 @@ class BloodYearPage extends StatelessWidget {
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(),
children: fullData(context,projectViewModel),
),
],
),
@ -56,7 +60,7 @@ class BloodYearPage extends StatelessWidget {
);
}
List<TableRow> fullData() {
List<TableRow> fullData(BuildContext context,ProjectViewModel projectViewModel) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
@ -64,14 +68,15 @@ class BloodYearPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0),
topLeft: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0),
topRight: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0),
),
),
child: Center(
child: Texts(
'Date',
TranslationBase.of(context).date,
color: Colors.white,
fontSize: 15,
),
@ -82,11 +87,11 @@ class BloodYearPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Time',
TranslationBase.of(context).time,
color: Colors.white,
fontSize: 15,
),
@ -96,11 +101,11 @@ class BloodYearPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Measured',
TranslationBase.of(context).measured,
color: Colors.white,
fontSize: 15,
),
@ -110,20 +115,22 @@ class BloodYearPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.0),
topLeft: projectViewModel.isArabic? Radius.circular(10.0):Radius.circular(0.0),
topRight: projectViewModel.isArabic? Radius.circular(0.0):Radius.circular(10.0),
),
),
child: Center(
child: Texts(
'Value',
TranslationBase.of(context).value,
color: Colors.white,
fontSize: 15,
),
),
height: 40),
),
],
),
);

@ -43,7 +43,7 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
onModelReady: (model) => model.getBloodSugar(),
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarTitle: 'Blood Sugar',
appBarTitle: TranslationBase.of(context).bloodSugar,
baseViewModel: model,
body: Scaffold(
extendBodyBehindAppBar: true,
@ -81,21 +81,21 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.27,
width: MediaQuery.of(context).size.width * 0.33,
child: Center(
child: Texts('Weekly'),
child: Texts(TranslationBase.of(context).weekly),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.27,
width: MediaQuery.of(context).size.width * 0.33,
child: Center(
child: Texts('Monthly'),
child: Texts(TranslationBase.of(context).monthlyT),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.27,
width: MediaQuery.of(context).size.width * 0.34,
child: Center(
child: Texts('Yearly'),
child: Texts(TranslationBase.of(context).yearly),
),
),
],
@ -116,6 +116,7 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
BloodSugarWeeklyPage(
data: model.getBloodWeeklySeries(),
diabtecPatientResult: model.weekDiabtecPatientResult,
bloodSugarViewMode: model,
),
BloodMonthlyPage(
data: model.getBloodMonthlyTimeSeriesSales(),
@ -132,13 +133,13 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage>
),
floatingActionButton: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: AddBloodSugarPage()));
Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,)));
},
child: Container(
width: 55,
height: 55,
decoration: BoxDecoration(
shape: BoxShape.circle, color: HexColor('515B5D')),
shape: BoxShape.circle, color:Theme.of(context).primaryColor),
child: Center(
child: Icon(
Icons.add,

@ -1,22 +1,31 @@
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/viewModels/medical/blood_sugar_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.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 'package:provider/provider.dart';
import 'AddBloodSugarPage.dart';
class BloodSugarWeeklyPage extends StatelessWidget {
final List<charts.Series<WeekChartDate, DateTime>> data;
final List<DiabtecPatientResult> diabtecPatientResult;
final BloodSugarViewMode bloodSugarViewMode;
const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult})
const BloodSugarWeeklyPage({Key key, this.data, this.diabtecPatientResult, this.bloodSugarViewMode})
: super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body: ListView(
children: [
@ -34,7 +43,7 @@ class BloodSugarWeeklyPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts('Details'),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
@ -46,7 +55,7 @@ class BloodSugarWeeklyPage extends StatelessWidget {
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(),
children: fullData(context, projectViewModel,bloodSugarViewMode),
),
],
),
@ -56,7 +65,8 @@ class BloodSugarWeeklyPage extends StatelessWidget {
);
}
List<TableRow> fullData() {
List<TableRow> fullData(
BuildContext context, ProjectViewModel projectViewModel, BloodSugarViewMode bloodSugarViewMode) {
List<TableRow> tableRow = [];
tableRow.add(
TableRow(
@ -64,14 +74,19 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0),
topLeft: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
topRight: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
),
),
child: Center(
child: Texts(
'Date',
TranslationBase.of(context).date,
color: Colors.white,
fontSize: 15,
),
@ -82,11 +97,11 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Time',
TranslationBase.of(context).time,
color: Colors.white,
fontSize: 15,
),
@ -96,11 +111,11 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Measured',
TranslationBase.of(context).measured,
color: Colors.white,
fontSize: 15,
),
@ -110,11 +125,11 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
),
child: Center(
child: Texts(
'Value',
TranslationBase.of(context).value,
color: Colors.white,
fontSize: 15,
),
@ -124,14 +139,19 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Container(
child: Container(
decoration: BoxDecoration(
color: HexColor('#515B5D'),
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.0),
topLeft: projectViewModel.isArabic
? Radius.circular(10.0)
: Radius.circular(0.0),
topRight: projectViewModel.isArabic
? Radius.circular(0.0)
: Radius.circular(10.0),
),
),
child: Center(
child: Texts(
'Edit',
TranslationBase.of(context).edit,
color: Colors.white,
fontSize: 15,
),
@ -203,12 +223,30 @@ class BloodSugarWeeklyPage extends StatelessWidget {
),
),
Container(
child: Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Icon(Icons.edit),
child: InkWell(
onTap: () {
Navigator.push(
context,
FadePage(
page: AddBloodSugarPage(
isUpdate: true,
bloodSugarDate: diabtec.dateChart,
measuredTime: diabtec.measuredDesc,
bloodSugarValue: diabtec.resultValue.toString(),
lineItemNo: diabtec.lineItemNo,
measureUnitSelectedType: diabtec.unit,
bloodSugarViewMode: bloodSugarViewMode,
),
),
);
},
child: Container(
height: 70,
padding: EdgeInsets.all(10),
color: Colors.white,
child: Center(
child: Icon(Icons.edit),
),
),
),
),

@ -1,3 +1,5 @@
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';
@ -11,7 +13,7 @@ class MyTrackers extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: 'My Tracker',
appBarTitle: TranslationBase.of(context).myTracker,
isShowAppBar: true,
body: SingleChildScrollView(
child: Container(
@ -41,7 +43,7 @@ class MyTrackers extends StatelessWidget {
children: [
Image.asset('assets/tracker/blood-suger.png',width: 60.0,),
SizedBox(height: 15,),
Text('Blood Sugar'),
Texts(TranslationBase.of(context).bloodSugar),
],
),
),
@ -65,7 +67,7 @@ class MyTrackers extends StatelessWidget {
children: [
Image.asset('assets/tracker/blood-pressure.png',width: 60.0,),
SizedBox(height: 15,),
Text('Blood Pressure'),
Texts(TranslationBase.of(context).bloodPressure),
],
),
),
@ -94,7 +96,7 @@ class MyTrackers extends StatelessWidget {
children: [
Image.asset('assets/tracker/weight.png',width: 60.0,),
SizedBox(height: 15,),
Text('Weight'),
Texts(TranslationBase.of(context).weight),
],
),
),

@ -1251,6 +1251,17 @@ class TranslationBase {
String get instructionAgree => localizedValues['instructionAgree'][locale.languageCode];
String get reqId => localizedValues['reqId'][locale.languageCode];
String get ordersLog => localizedValues['RRT-orders-log'][locale.languageCode];
String get bloodSugar => localizedValues['blood-sugar'][locale.languageCode];
String get myTracker => localizedValues['my-tracker'][locale.languageCode];
String get weekly => localizedValues['weekly'][locale.languageCode];
String get monthlyT => localizedValues['monthly'][locale.languageCode];
String get yearly => localizedValues['yearly'][locale.languageCode];
String get measured => localizedValues['measured'][locale.languageCode];
String get sugarAdd => localizedValues['sugar-add'][locale.languageCode];
String get other => localizedValues['other'][locale.languageCode];
String get measureUnit => localizedValues['measure-unit'][locale.languageCode];
String get measureTime => localizedValues['measure-time'][locale.languageCode];
String get update => localizedValues['update'][locale.languageCode];
}

Loading…
Cancel
Save