From c6404a2a0b581a14214972cf4e70dcd7375c214e Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 14 Sep 2021 16:52:28 +0300 Subject: [PATCH] tracker services --- lib/config/config.dart | 13 +- lib/config/localized_values.dart | 2 +- .../customer_addresses_service.dart | 113 ++-- .../home_health_care_service.dart | 34 +- .../home_health_care_view_model.dart | 58 +- .../medical/blood_pressure_view_model.dart | 58 +- .../Dialog/confirm_cancel_order_dialog.dart | 25 +- .../new_Home_health_care_step_three_page.dart | 16 +- .../new_home_health_care_page.dart | 508 +++++++++--------- .../orders_log_details_page.dart | 487 ++++++++++------- .../ancillaryOrdersDetails.dart | 51 +- .../my_trackers/Weight/WeightMonthlyPage.dart | 188 +++---- .../my_trackers/Weight/WeightWeeklyPage.dart | 242 +++------ .../my_trackers/Weight/WeightYeaPage.dart | 191 +++---- .../blood_pressure/BloodPressureHomePage.dart | 46 +- .../blood_pressure/BloodPressureMonthly.dart | 153 ++---- .../blood_pressure/BloodPressureYeaPage.dart | 170 ++---- .../bloodPressureWeeklyPage.dart | 209 ++----- .../my_trackers/blood_suger/BloodMonthly.dart | 304 ++++++----- .../my_trackers/blood_suger/BloodYeaPage.dart | 170 ++---- .../blood_suger/blood_sugar_home_page.dart | 43 +- .../blood_suger/blood_sugar_weekly_page.dart | 208 ++----- 22 files changed, 1329 insertions(+), 1960 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4d3a6ae3..a887eec9 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,17 +12,16 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; - -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs -const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // Pharmacy Production URLs -// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; +const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a38c1033..60e03364 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1060,7 +1060,7 @@ const Map localizedValues = { "referralDate": {"en": "Referral Date", "ar": "تاريخ الإحالة"}, "patientName": {"en": "Patient Name", "ar": "اسم المريض"}, "referralNumber": {"en": "Referral Number", "ar": "رقم الإحالة"}, - "requestID": {"en": "Request ID", "ar": " رقم الطلب"}, + "requestID": {"en": "Req ID", "ar": " رقم الطلب"}, "OrderStatus": {"en": "Status", "ar": "الحاله"}, "pickupDate": {"en": "Pickup Date", "ar": "التاريخ"}, "serviceName": {"en": "Service Name", "ar": " اسم الخدمة"}, diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index ea5d03ca..643259d7 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -7,14 +7,10 @@ import '../../../locator.dart'; import '../base_service.dart'; class CustomerAddressesService extends BaseService { - List addressesList = List(); CustomerInfo customerInfo; - - Future addAddressInfo({ AddNewAddressRequestModel - addNewAddressRequestModel }) async { - + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { addNewAddressRequestModel.customer.email = customerInfo.email; addNewAddressRequestModel.customer.id = customerInfo.customerId; addNewAddressRequestModel.customer.roleIds = [3]; @@ -28,55 +24,44 @@ class CustomerAddressesService extends BaseService { var date = f.format(DateTime.now().toUtc()) + " GMT"; addNewAddressRequestModel.customer.addresses[0].createdOnUtc = date; hasError = false; - await baseAppClient.post(ADD_CUSTOMER_ADDRESS, - onSuccess: (dynamic response, int statusCode) { - addressesList.clear(); - response["customers"][0]["addresses"].forEach((data) { - addressesList - .add(AddressInfo.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: addNewAddressRequestModel.toJson(), isAllowAny: true); + await baseAppClient.post(ADD_CUSTOMER_ADDRESS, onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList.add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addNewAddressRequestModel.toJson(), isAllowAny: true); } Future getCustomerAddresses() async { - Map queryParams = { - 'fields':'addresses' - }; + Map queryParams = {'fields': 'addresses'}; hasError = false; - await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", - onSuccess: (dynamic response, int statusCode) { - addressesList.clear(); - response["customers"][0]["addresses"].forEach((data) { - addressesList - .add(AddressInfo.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, queryParams: queryParams, isExternal: true); + await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", onSuccess: (dynamic response, int statusCode) { + addressesList.clear(); + response["customers"][0]["addresses"].forEach((data) { + addressesList.add(AddressInfo.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); } - Future getCustomerInfo() async { - Map queryParams = { - 'FileNumber':'${user.patientID}' - }; + Map queryParams = {'FileNumber': '${user.patientID}'}; hasError = false; - await baseAppClient.getPharmacy(BASE_PHARMACY_URL+GET_CUSTOMER_INFO, - onSuccess: (dynamic response, int statusCode) { - customerInfo= CustomerInfo.fromJson(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, queryParams: queryParams, isExternal: true); + await baseAppClient.getPharmacy(BASE_PHARMACY_URL + GET_CUSTOMER_INFO, onSuccess: (dynamic response, int statusCode) { + customerInfo = CustomerInfo.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams, isExternal: true); } } - class CustomerInfo { bool isRegistered; String userName; @@ -86,14 +71,7 @@ class CustomerInfo { String mobileNumber; int customerId; - CustomerInfo( - {this.isRegistered, - this.userName, - this.password, - this.email, - this.errorMessage, - this.mobileNumber, - this.customerId}); + CustomerInfo({this.isRegistered, this.userName, this.password, this.email, this.errorMessage, this.mobileNumber, this.customerId}); CustomerInfo.fromJson(Map json) { isRegistered = json['IsRegistered']; @@ -118,7 +96,6 @@ class CustomerInfo { } } - class AddressInfo { String id; String firstName; @@ -141,23 +118,23 @@ class AddressInfo { AddressInfo( {this.id, - this.firstName, - this.lastName, - this.email, - this.company, - this.countryId, - this.country, - this.stateProvinceId, - this.city, - this.address1, - this.address2, - this.zipPostalCode, - this.phoneNumber, - this.faxNumber, - this.customerAttributes, - this.createdOnUtc, - this.province, - this.latLong}); + this.firstName, + this.lastName, + this.email, + this.company, + this.countryId, + this.country, + this.stateProvinceId, + this.city, + this.address1, + this.address2, + this.zipPostalCode, + this.phoneNumber, + this.faxNumber, + this.customerAttributes, + this.createdOnUtc, + this.province, + this.latLong}); AddressInfo.fromJson(Map json) { id = json['id']; diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index 2ec1e310..eb27f24e 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -19,14 +19,12 @@ class HomeHealthCareService extends BaseService { List hhcAllOrderDetail = List(); List addressesList = List(); - + dynamic hhcResponse; bool isOrderUpdated; CustomerInfo customerInfo; - Future getHHCAllServices( - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { + Future getHHCAllServices(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; - await baseAppClient.post(HHC_GET_ALL_SERVICES, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(HHC_GET_ALL_SERVICES, onSuccess: (dynamic response, int statusCode) { hhcAllServicesList.clear(); response['PatientER_HHC_GetAllServicesList'].forEach((data) { hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); @@ -38,16 +36,12 @@ class HomeHealthCareService extends BaseService { } Future getHHCAllPresOrders() async { - GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = - GetHHCAllPresOrdersRequestModel(); + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) - hhcAllPresOrdersList - .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -60,12 +54,10 @@ class HomeHealthCareService extends BaseService { Map body = Map(); body['PresOrderID'] = presOrderID; body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { hhcAllOrderDetail.clear(); response['PatientER_HHC_GetTransactionsForOrderList'].forEach((data) { - hhcAllOrderDetail - .add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + hhcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -75,8 +67,7 @@ class HomeHealthCareService extends BaseService { Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; }, onFailure: (String error, int statusCode) { hasError = true; @@ -86,14 +77,11 @@ class HomeHealthCareService extends BaseService { Future insertPresPresOrder({PatientERInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + hhcResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: order.toJson()); } } - - diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 32644fd4..4ebdbcc1 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -18,42 +18,30 @@ import '../../../locator.dart'; import 'add_new_address_Request_Model.dart'; class HomeHealthCareViewModel extends BaseViewModel { - HomeHealthCareService _homeHealthCareService = - locator(); + HomeHealthCareService _homeHealthCareService = locator(); - CustomerAddressesService _customerAddressesService = - locator(); + CustomerAddressesService _customerAddressesService = locator(); - List get hhcAllServicesList => - _homeHealthCareService.hhcAllServicesList; + List get hhcAllServicesList => _homeHealthCareService.hhcAllServicesList; + List get addressesList => _customerAddressesService.addressesList; - List get addressesList => - _customerAddressesService.addressesList; + List get hhcAllPresOrders => _homeHealthCareService.hhcAllPresOrdersList; - List get hhcAllPresOrders => - _homeHealthCareService.hhcAllPresOrdersList; - - List get hhcAllOrderDetail => - _homeHealthCareService.hhcAllOrderDetail; + List get hhcAllOrderDetail => _homeHealthCareService.hhcAllOrderDetail; PharmacyModuleService _pharmacyModuleService = locator(); - - - bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; GetHHCAllPresOrdersResponseModel pendingOrder; List patientERHHCInsertServicesList = List(); - + dynamic get hhcResponse => _homeHealthCareService.hhcResponse; Future getHHCAllServices() async { - HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = - new HHCGetAllServicesRequestModel(); + HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = new HHCGetAllServicesRequestModel(); //setState(ViewState.Busy); - await _homeHealthCareService - .getHHCAllServices(hHCGetAllServicesRequestModel); + await _homeHealthCareService.getHHCAllServices(hHCGetAllServicesRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); @@ -70,23 +58,19 @@ class HomeHealthCareViewModel extends BaseViewModel { error = _homeHealthCareService.error; setState(ViewState.Error); } else { - pendingOrder = _homeHealthCareService.hhcAllPresOrdersList - .firstWhere((element) => element.status == 1 || element.status == 2, - orElse: () => null); + pendingOrder = _homeHealthCareService.hhcAllPresOrdersList.firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); if (pendingOrder != null) { await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); setState(ViewState.Idle); } else { getHHCAllServices(); } - } } Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.Busy); - await _homeHealthCareService.updateHHCPresOrder( - updatePresOrderRequestModel); + await _homeHealthCareService.updateHHCPresOrder(updatePresOrderRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.ErrorLocal); @@ -108,11 +92,9 @@ class HomeHealthCareViewModel extends BaseViewModel { } } - Future getCustomerAddresses() async { setState(ViewState.Busy); - await _customerAddressesService.getCustomerAddresses( - ); + await _customerAddressesService.getCustomerAddresses(); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); @@ -123,7 +105,7 @@ class HomeHealthCareViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ + await _pharmacyModuleService.generatePharmacyToken().then((value) async { await _customerAddressesService.getCustomerInfo(); }); if (_customerAddressesService.hasError) { @@ -134,15 +116,11 @@ class HomeHealthCareViewModel extends BaseViewModel { } } - Future addAddressInfo( - {AddNewAddressRequestModel addNewAddressRequestModel}) async { - + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ - await _customerAddressesService.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel - ); + await _pharmacyModuleService.generatePharmacyToken().then((value) async { + await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); }); if (_customerAddressesService.hasError) { @@ -152,6 +130,4 @@ class HomeHealthCareViewModel extends BaseViewModel { setState(ViewState.Idle); } } - - -} \ No newline at end of file +} diff --git a/lib/core/viewModels/medical/blood_pressure_view_model.dart b/lib/core/viewModels/medical/blood_pressure_view_model.dart index 16a43a6f..596a9c1e 100644 --- a/lib/core/viewModels/medical/blood_pressure_view_model.dart +++ b/lib/core/viewModels/medical/blood_pressure_view_model.dart @@ -34,31 +34,22 @@ class BloodPressureViewMode extends BaseViewModel { } else { clearDate(); bloodPressureService.weekDiabtectResultAverageList.forEach((element) { - weightWeekTimeSeriesDataTop - .add(TimeSeriesSales2(element.bloodPressureDate, element.dailyDiastolicPressureAverageResult.toDouble())); - weightWeekTimeSeriesDataLow - .add(TimeSeriesSales2(element.bloodPressureDate, element.dailySystolicePressureAverageResult.toDouble())); - - for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { - weighMonthTimeSeriesDataTop.add(TimeSeriesSales3( - index, - bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult - .toDouble())); - - weighMonthTimeSeriesDataLow.add(TimeSeriesSales3( - index, - bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult - .toDouble())); - } - - bloodPressureService.yearDiabtecResultAverageList.forEach((element) { - weightYearTimeSeriesDataTop - .add(TimeSeriesSales2(element.date, element.monthSystolicePressureAverageResult.toDouble())); - - weightYearTimeSeriesDataLow - .add(TimeSeriesSales2(element.date, element.monthDiastolicPressureAverageResult.toDouble())); - }); + weightWeekTimeSeriesDataTop.add(TimeSeriesSales2(element.bloodPressureDate, element.dailyDiastolicPressureAverageResult.toDouble())); + weightWeekTimeSeriesDataLow.add(TimeSeriesSales2(element.bloodPressureDate, element.dailySystolicePressureAverageResult.toDouble())); }); + + for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { + weighMonthTimeSeriesDataTop.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + + weighMonthTimeSeriesDataLow.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + } + + bloodPressureService.yearDiabtecResultAverageList.forEach((element) { + weightYearTimeSeriesDataTop.add(TimeSeriesSales2(element.date, element.monthSystolicePressureAverageResult.toDouble())); + + weightYearTimeSeriesDataLow.add(TimeSeriesSales2(element.date, element.monthDiastolicPressureAverageResult.toDouble())); + }); + setState(ViewState.Idle); } } @@ -84,25 +75,12 @@ class BloodPressureViewMode extends BaseViewModel { } } - Future addORUpdateDiabtecResult( - {String bloodPressureDate, - String diastolicPressure, - String systolicePressure, - int measuredArm, - bool isUpdate = false}) async { + Future addORUpdateDiabtecResult({String bloodPressureDate, String diastolicPressure, String systolicePressure, int measuredArm, bool isUpdate = false}) async { setState(ViewState.BusyLocal); if (!isUpdate) - await bloodPressureService.addDiabtecResult( - bloodPressureDate: bloodPressureDate, - diastolicPressure: diastolicPressure, - systolicePressure: systolicePressure, - measuredArm: measuredArm); + await bloodPressureService.addDiabtecResult(bloodPressureDate: bloodPressureDate, diastolicPressure: diastolicPressure, systolicePressure: systolicePressure, measuredArm: measuredArm); else - await bloodPressureService.updateDiabtecResult( - bloodPressureDate: bloodPressureDate, - diastolicPressure: diastolicPressure, - systolicePressure: systolicePressure, - measuredArm: measuredArm); + await bloodPressureService.updateDiabtecResult(bloodPressureDate: bloodPressureDate, diastolicPressure: diastolicPressure, systolicePressure: systolicePressure, measuredArm: measuredArm); if (bloodPressureService.hasError) { error = bloodPressureService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart index bfab0324..3db199b2 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/Dialog/confirm_cancel_order_dialog.dart @@ -9,9 +9,7 @@ class ConfirmCancelOrderDialog extends StatefulWidget { final HomeHealthCareViewModel model; final Function onTap; - - ConfirmCancelOrderDialog( - {Key key, this.model, this.onTap}); + ConfirmCancelOrderDialog({Key key, this.model, this.onTap}); @override _ConfirmCancelOrderDialogState createState() => _ConfirmCancelOrderDialogState(); @@ -26,7 +24,7 @@ class _ConfirmCancelOrderDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + contentPadding: EdgeInsets.all(20), title: Center( child: Texts( TranslationBase.of(context).confirm, @@ -37,14 +35,16 @@ class _ConfirmCancelOrderDialogState extends State { Column( children: [ Divider(), + SizedBox( + height: 10.0, + ), Center( child: Texts( - TranslationBase.of(context).cancelOrderMsg , - color: Colors.grey, + TranslationBase.of(context).cancelOrderMsg, ), ), SizedBox( - height: 5.0, + height: 10, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -76,7 +76,7 @@ class _ConfirmCancelOrderDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ + onTap: () async { widget.onTap(); Navigator.pop(context); }, @@ -84,9 +84,9 @@ class _ConfirmCancelOrderDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), ), ), ), @@ -98,6 +98,3 @@ class _ConfirmCancelOrderDialogState extends State { ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart index c4729257..6b94b832 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart @@ -13,7 +13,8 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:provider/provider.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; class NewHomeHealthCareStepThreePage extends StatefulWidget { final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; @@ -158,10 +159,15 @@ class _NewHomeHealthCareStepThreePageState extends State Utils.route(route, equalsTo: NewHomeHealthCarePage)); - } + widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel).then((value) => { + print(widget.model.hhcResponse), + Navigator.push( + context, + FadePage( + page: HomeHealthCarePage(), + ), + ) + }); }, textColor: Theme.of(context).backgroundColor), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index fa9188db..2a8cc732 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -119,267 +119,271 @@ class _NewHomeHealthCarePageState extends State with Tick ? FractionallySizedBox( widthFactor: 0.9, child: SingleChildScrollView( - child: Row( - children: [ - Expanded( - flex: 3, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(20.0)), - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10), - margin: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), - decoration: BoxDecoration(boxShadow: [ - BoxShadow(color: Color(0xffcd9e1b), offset: Offset(-10, 0)), - ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), - child: Row( - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, + child: Container( + margin: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20.0)), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10), + margin: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + decoration: BoxDecoration(boxShadow: [ + BoxShadow(color: Color(0xffcd9e1b), offset: Offset(-10, 0)), + ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), + child: Row( children: [ - Texts( - TranslationBase.of(context).OrderStatus + - ' ' + - (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), - bold: false, - fontSize: 12, - color: Color(0xffcd9e1b), - fontWeight: FontWeight.bold, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Texts( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - fontSize: 14, - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - bold: false, - fontSize: 18, - ), - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).OrderStatus + + ' ' + + (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + bold: false, + fontSize: 12, + color: Color(0xffcd9e1b), + fontWeight: FontWeight.bold, + ), + ], ), - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - child: Texts( - projectViewModel.isArabic - ? widget.model.hhcAllOrderDetail[index].descriptionN - : widget.model.hhcAllOrderDetail[index].description.capitalize(), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), fontSize: 14, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + fontWeight: FontWeight.w600, + fontSize: 18, + ), + Texts( + TranslationBase.of(context).serviceName, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic + ? widget.model.hhcAllOrderDetail[index].descriptionN + : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 13, + bold: false, + ), + ), + ), + ], ), - ), + SecondaryButton( + onTap: () { + showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + }, + label: TranslationBase.of(context).cancel, + color: Colors.red[900], + small: true, + ) + ], + // ) + // ], + // ) + // ], ), ], - ), - SecondaryButton( - onTap: () { - showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - }, - label: TranslationBase.of(context).cancel, - color: Colors.red[900], - small: true, - ) + )) ], - // ) - // ], - // ) - // ], - ), - ], - )) - ], - ))), - ) - ], - )) + ))), + ) + ], + )) - // Row( - // children: [ - // Expanded( - // flex: 1, - // child: ClipRRect( - // borderRadius: const BorderRadius.all(Radius.circular(20.0)), - // child: Container( - // padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20), - // margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), - // decoration: BoxDecoration( - // boxShadow: [ - // BoxShadow(color: Colors.green, offset: Offset(-5, 0)), - // ], - // )))), - // Expanded( - // flex: 5, - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // width: double.infinity, - // padding: EdgeInsets.all(5), - // decoration: BoxDecoration( - // border: Border( - // bottom: BorderSide( - // color: Colors.grey, - // width: 1.0, - // ), - // ), - // // borderRadius: BorderRadius.circular(12), - // ), - // child: Row( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).OrderStatus, - // bold: false, - // fontSize: 12, - // ), - // SizedBox( - // height: 4, - // ), - // Texts( - // projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description, - // fontSize: 12, - // ), - // ], - // ), - // ), - // Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), - // decoration: BoxDecoration( - // border: Border( - // bottom: BorderSide( - // color: Colors.grey, - // width: 1.0, - // ), - // ), - // // borderRadius: BorderRadius.circular(12), - // ), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).requestID, - // bold: false, - // fontSize: 13, - // ), - // SizedBox( - // height: 4, - // ), - // Texts( - // widget.model.pendingOrder.iD.toString(), - // fontSize: 22, - // ), - // ], - // ), - // ), - // Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), - // decoration: BoxDecoration( - // border: Border( - // bottom: BorderSide( - // color: Colors.grey, - // width: 1.0, - // ), - // ), - // // borderRadius: BorderRadius.circular(12), - // ), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).pickupDate, - // bold: false, - // fontSize: 13, - // ), - // SizedBox( - // height: 4, - // ), - // Texts( - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - // fontSize: 22, - // ), - // ], - // ), - // ), - // ...List.generate( - // widget.model.hhcAllOrderDetail.length, - // (index) => Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), - // decoration: BoxDecoration( - // border: Border( - // bottom: BorderSide( - // color: Colors.grey, - // width: 1.0, - // ), - // ), - // // borderRadius: BorderRadius.circular(12), - // color: Theme.of(context).primaryColor), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).serviceName, - // bold: false, - // fontSize: 13, - // ), - // SizedBox( - // height: 4, - // ), - // Texts( - // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description, - // fontSize: 22, - // bold: true, - // ), - // ], - // ), - // ), - // ), - // SizedBox( - // height: 12, - // ), - // Center( - // child: Container( - // width: MediaQuery.of(context).size.width * 0.85, - // child: SecondaryButton( - // label: TranslationBase.of(context).cancel.toUpperCase(), - // onTap: () { - // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - // }, - // color: Colors.red[800], - // disabled: false, - // textColor: Theme.of(context).backgroundColor), - // ), - // ), - // SizedBox( - // height: 12, - // ), - // ], - // ), - // ) - // ], - // ), - //), - ) + // Row( + // children: [ + // Expanded( + // flex: 1, + // child: ClipRRect( + // borderRadius: const BorderRadius.all(Radius.circular(20.0)), + // child: Container( + // padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20), + // margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), + // decoration: BoxDecoration( + // boxShadow: [ + // BoxShadow(color: Colors.green, offset: Offset(-5, 0)), + // ], + // )))), + // Expanded( + // flex: 5, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // width: double.infinity, + // padding: EdgeInsets.all(5), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus, + // bold: false, + // fontSize: 12, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description, + // fontSize: 12, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).requestID, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // widget.model.pendingOrder.iD.toString(), + // fontSize: 22, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).pickupDate, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 22, + // ), + // ], + // ), + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Theme.of(context).primaryColor), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).serviceName, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description, + // fontSize: 22, + // bold: true, + // ), + // ], + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // Center( + // child: Container( + // width: MediaQuery.of(context).size.width * 0.85, + // child: SecondaryButton( + // label: TranslationBase.of(context).cancel.toUpperCase(), + // onTap: () { + // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // }, + // color: Colors.red[800], + // disabled: false, + // textColor: Theme.of(context).backgroundColor), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // ], + // ), + // ) + // ], + // ), + //), + )) : NewHomeHealthCareStepOnePage( changePageViewIndex: _changeCurrentTab, patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index f0ca5fe4..e8ec39ea 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -24,23 +24,18 @@ class OrdersLogDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { showDialog( context: context, child: ConfirmCancelOrderDialog( model: model, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.iD, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { + if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -54,203 +49,305 @@ class OrdersLogDetailsPage extends StatelessWidget { body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.all(10), child: Center( child: FractionallySizedBox( widthFactor: 0.94, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 50, - ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: model.hhcAllPresOrders.map((order) { - return Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - order.iD.toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - - projectViewModel.isArabic ? order.descriptionN : order.description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), - fontSize: 22, - ), - ], - ), - ), - - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15, right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic ?order.nearestProjectDescription - .toString() : - order.nearestProjectDescriptionN - .toString(), - fontSize: 22, - ), - ], - ), - ), - SizedBox( - height: 12, - ), - if (order.status == 1 ||order.status == 2 ) - Center( + return Row( + children: [ + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20.0)), child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: "Cancel".toUpperCase(), - onTap: () { - showConfirmMessage(model, order); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 12, - ), - ], - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10), + margin: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: order.status == 4 + ? Colors.red[900] + : order.status == 3 + ? Colors.green[400] + : Color(0xffcd9e1b), + offset: Offset(-10, 0)), + ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).OrderStatus + ' ' + (projectViewModel.isArabic ? order.descriptionN : order.description), + bold: false, + fontSize: 12, + color: order.status == 4 + ? Colors.red[900] + : order.status == 3 + ? Colors.green[400] + : Color(0xffcd9e1b), + fontWeight: FontWeight.bold, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)), + fontSize: 14, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).requestID + ' ' + order.iD.toString(), + bold: false, + fontSize: 18, + ), + ], + ), + (order.status == 1 || order.status == 2) + ? SecondaryButton( + onTap: () { + showConfirmMessage(model, order); + }, + label: TranslationBase.of(context).cancel, + color: Colors.red[900], + small: true, + ) + : SizedBox() + ], + // ) + // ], + // ) + // ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).orderLocation, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + !projectViewModel.isArabic ? order.nearestProjectDescription.toString() : order.nearestProjectDescriptionN.toString(), + fontSize: 13, + ), + ], + ), + ], + )) + ], + ))), + ) + ], ); + + // return Container( + // width: double.infinity, + // margin: EdgeInsets.only(top: 15), + // decoration: BoxDecoration( + // border: + // Border.all(color: Colors.grey, width: 1), + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // SizedBox( + // height: 12, + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only( + // left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase + // .of(context) + // .requestID, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // order.iD.toString(), + // fontSize: 22, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only( + // left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase + // .of(context) + // .OrderStatus, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + + // projectViewModel.isArabic ? order.descriptionN : order.description, + // fontSize: 22, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only( + // left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase + // .of(context) + // .pickupDate, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // DateUtil.getDayMonthYearDateFormatted( + // DateUtil.convertStringToDate(order.createdOn)), + // fontSize: 22, + // ), + // ], + // ), + // ), + + // SizedBox( + // height: 12, + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only( + // left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).orderLocation, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // !projectViewModel.isArabic ?order.nearestProjectDescription + // .toString() : + // order.nearestProjectDescriptionN + // .toString(), + // fontSize: 22, + // ), + // ], + // ), + // ), + // SizedBox( + // height: 12, + // ), + // if (order.status == 1 ||order.status == 2 ) + // Center( + // child: Container( + // width: MediaQuery + // .of(context) + // .size + // .width * + // 0.85, + // child: SecondaryButton( + // label: "Cancel".toUpperCase(), + // onTap: () { + // showConfirmMessage(model, order); + // } + // , + // color: Colors.red[800], + // disabled: false, + // textColor: Theme + // .of(context) + // .backgroundColor), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // ], + // ), + // ); }).toList()) ], ), diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index cb10f68c..f330717d 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -33,8 +33,7 @@ class _AnicllaryOrdersState extends State with SingleTic @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrdersDetails( - widget.appoNo, widget.orderNo, widget.projectID), + onModelReady: (model) => model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, baseViewModel: model, @@ -156,8 +155,7 @@ class _AnicllaryOrdersState extends State with SingleTic Texts(" : "), Texts( DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - model.ancillaryListsDetails[0].appointmentDate), + DateUtil.convertStringToDate(model.ancillaryListsDetails[0].appointmentDate), ), ) ], @@ -227,27 +225,25 @@ class _AnicllaryOrdersState extends State with SingleTic Row( children: [], ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Texts( - TranslationBase.of(context).price, - color: Colors.grey[500], - fontSize: 14, - ), - SizedBox(width: 15), - Texts( - TranslationBase.of(context).vat, - color: Colors.grey[500], - fontSize: 14, - ), - SizedBox(width: 15), - Texts( - TranslationBase.of(context).total, - color: Colors.grey[500], - fontSize: 14, - ), - ]), + Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ + Texts( + TranslationBase.of(context).price, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).vat, + color: Colors.grey[500], + fontSize: 14, + ), + SizedBox(width: 15), + Texts( + TranslationBase.of(context).total, + color: Colors.grey[500], + fontSize: 14, + ), + ]), ], ), Divider( @@ -258,10 +254,7 @@ class _AnicllaryOrdersState extends State with SingleTic } Widget getAncillaryDetails(model) { - Map newMap = groupBy( - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, - (obj) => obj.procedureCategoryName); - print(newMap); + Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); return Padding(padding: EdgeInsets.only(top: 10, bottom: 10), child: getHeaderDetails(newMap)); } diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 5b391a62..285dc281 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -15,161 +15,99 @@ 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:collection/collection.dart"; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class WeightMonthlyPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightMonthlyPage({ + WeightMonthlyPage({ Key key, this.model, }) : super(key: key); - + List monthlyGroup = []; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + groupData(); return AppScaffold( isShowDecPage: false, body: ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: MonthLineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weighMonthTimeSeriesData.isEmpty?[TimeSeriesSales3(0, 0.0)]:model.weighMonthTimeSeriesData, - indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weighMonthTimeSeriesData.isEmpty? Container( + children: [ + Container( + width: double.maxFinite, + color: Colors.white, + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, + )), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weighMonthTimeSeriesData.isEmpty + ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), - ):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + // 2: FlexColumnWidth(1.8), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]) ], ), + ) + ], + ), ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.monthWeightMeasurementResult.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : 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, - ), - ), - ), - ), + Utils.tableColumnValue('${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + isCapitable: false), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), ], ), ); @@ -177,4 +115,10 @@ class WeightMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.monthWeightMeasurementResult, (obj) => DateUtil.getMonth(obj.weightDate.month) + ' ' + obj.weightDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 5895eee1..99d025a2 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -12,7 +12,7 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'AddWeightPage.dart'; class WeightWeeklyPage extends StatelessWidget { @@ -27,122 +27,59 @@ class WeightWeeklyPage extends StatelessWidget { return AppScaffold( isShowDecPage: false, body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightWeekTimeSeriesData.isEmpty - ? [TimeSeriesSales2(DateTime.now(), 0.0)] - : model.weightWeekTimeSeriesData, - indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, - ), - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightWeekTimeSeriesData.isEmpty? Container( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: LineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + ), + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightWeekTimeSeriesData.isEmpty + ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), - ):Table( - border: TableBorder.symmetric( - inside: - BorderSide(width: 2.0, color: Colors.grey[300]), - ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, children: fullData(context, projectViewModel, model), ), - ], - ), - ) ], ), + ) + ], + ), ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -151,72 +88,47 @@ class WeightWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : 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, - ), - ), - ), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddWeightPage( - isUpdate: true, - dayWeightDate: diabtec.weightDate, - measureTimeSelectedType: 'Kg', - weightValue: diabtec.weightMeasured.toString(), - lineItemNo: diabtec.lineItemNo, - weightUnit: int.parse(diabtec.unit), - model: model, + Utils.tableColumnValue('${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + isCapitable: false), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddWeightPage( + isUpdate: true, + dayWeightDate: diabtec.weightDate, + measureTimeSelectedType: 'Kg', + weightValue: diabtec.weightMeasured.toString(), + lineItemNo: diabtec.lineItemNo, + weightUnit: int.parse(diabtec.unit), + model: model, + ), + ), + ); + }, + child: Container( + // height: 70, + // padding: EdgeInsets.all(10), + child: Icon( + Icons.edit, + color: Color(0xff575757), ), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), ); diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index ed50458e..c38b0977 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -15,161 +15,98 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import "package:collection/collection.dart"; +import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class WeightYearPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightYearPage({ + WeightYearPage({ Key key, this.model, }) : super(key: key); - + List monthlyGroup = []; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + groupData(); return AppScaffold( isShowDecPage: false, - body: - ListView( - children: [ - Container( - width: double.maxFinite, - color: Colors.white, - child: LineChartCurved( - horizontalInterval: 2.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightYearTimeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesData, - indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", - )), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightYearTimeSeriesData.isEmpty? Container( + body: ListView( + children: [ + Container( + width: double.maxFinite, + color: Colors.white, + child: LineChartCurved( + horizontalInterval: 2.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData, + indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", + )), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightYearTimeSeriesData.isEmpty + ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), - ):Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), - ], - ), - ) + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]), ], ), + ) + ], + ), ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, WeightPressureViewModel model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - model.yearWeightMeasurementResult.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : 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, - ), - ), - ), - ), + Utils.tableColumnValue('${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.weightDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.weightDate)} ', + isCapitable: false), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), ], ), ); @@ -177,4 +114,10 @@ class WeightYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.yearWeightMeasurementResult.reversed, (obj) => DateUtil.getMonth(obj.weightDate.month) + ' ' + obj.weightDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index 134ab3b1..b0d5613f 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -72,27 +72,31 @@ class _BloodPressureHomePageState extends State with Sing ) ], ), - floatingActionButton: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodPressurePage( - model: model, - ))); - }, - child: Container( - width: 55, - height: 55, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), - ), - ), - ), + floatingActionButton: Stack(children: [ + Positioned( + bottom: 80, + right: 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + ))); + }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + )), + )) + ]), bottomSheet: Container( width: MediaQuery.of(context).size.width, height: 70.0, diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 09d9af90..9faf74af 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -9,17 +9,19 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import "package:collection/collection.dart"; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class BloodPressureMonthlyPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); - + BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); + List monthlyGroup = []; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - + groupData(); return AppScaffold( body: ListView( children: [ @@ -53,12 +55,23 @@ class BloodPressureMonthlyPage extends StatelessWidget { child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]), SizedBox(height: 80) ], ), @@ -68,121 +81,29 @@ class BloodPressureMonthlyPage extends StatelessWidget { ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).arm, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topRight: Radius.circular(10.0), - ), - ), - child: Center( - child: Texts( - TranslationBase.of(context).sysdias, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).arm), + Utils.tableColumnTitle(TranslationBase.of(context).sysdias), ], ), ); - model.monthDiabtecPatientResult.reversed.forEach( + model.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', - fontSize: 12, - textAlign: TextAlign.center, - ), - ), - height: 40, - ), - Container( - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - fontSize: 12, - ), - ), - height: 40), - Container( - color: Colors.white, - child: Center( - child: Texts( - diabtec.measuredArmDesc, - fontSize: 12, - ), - ), - height: 40), - Container( - color: Colors.white, - child: Center( - child: Texts( - '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', - color: Colors.red, - fontSize: 12, - ), - ), - height: 40), + Utils.tableColumnValue( + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', + isCapitable: false), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), ], ), ); @@ -190,4 +111,10 @@ class BloodPressureMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.bloodPressureService.monthDiabtecPatientResult, (obj) => DateUtil.getMonth(obj.bloodPressureDate.month) + ' ' + obj.bloodPressureDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 28e3a4b9..aa5fa267 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -9,15 +9,18 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import "package:collection/collection.dart"; class BloodPressureYearPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureYearPage({Key key, this.model}) : super(key: key); - + BloodPressureYearPage({Key key, this.model}) : super(key: key); + List monthlyGroup = []; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + groupData(); return AppScaffold( body: ListView( children: [ @@ -51,12 +54,23 @@ class BloodPressureYearPage extends StatelessWidget { child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel, model), - ), + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]), SizedBox(height: 80) ], ), @@ -66,139 +80,29 @@ class BloodPressureYearPage extends StatelessWidget { ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode bloodSugarViewMode) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, model) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).arm), + Utils.tableColumnTitle(TranslationBase.of(context).sysdias), ], ), ); - model.yearDiabtecPatientResult.reversed.forEach( + model.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, - ), - ), - ), - ), + Utils.tableColumnValue( + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', + isCapitable: false), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), ], ), ); @@ -206,4 +110,10 @@ class BloodPressureYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(model.bloodPressureService.yearDiabtecPatientResult.reversed, (obj) => DateUtil.getMonth(obj.bloodPressureDate.month) + ' ' + obj.bloodPressureDate.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index f936c18e..b325aff7 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -10,7 +10,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'AddBloodPressurePage.dart'; class BloodPressureWeeklyPage extends StatelessWidget { @@ -48,16 +48,17 @@ class BloodPressureWeeklyPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - model.weightWeekTimeSeriesDataTop.isEmpty + model.bloodPressureService.weekDiabtecPatientResult.isEmpty ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), ) : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, children: fullData(context, projectViewModel, model), ), SizedBox(height: 80) @@ -74,85 +75,11 @@ class BloodPressureWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -161,87 +88,47 @@ class BloodPressureWeeklyPage extends StatelessWidget { 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, - ), - ), - ), - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodPressurePage( - model: model, - isUpdate: true, - lineItemNo: diabtec.lineItemNo, - bloodSugarDate: diabtec.bloodPressureDate, - bloodDiastolicValue: diabtec.diastolicPressure.toString(), - bloodSystolicValue: diabtec.systolicePressure.toString(), - measureTimeSelectedType: diabtec.measuredArmDesc, + Utils.tableColumnValue('${DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)} ', isCapitable: false), + Utils.tableColumnValue(diabtec.bloodPressureDate.hour.toString() + ':' + diabtec.bloodPressureDate.minute.toString(), isCapitable: false), + Utils.tableColumnValue('${diabtec.measuredArmDesc}', isCapitable: false), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + isUpdate: true, + lineItemNo: diabtec.lineItemNo, + bloodSugarDate: diabtec.bloodPressureDate, + bloodDiastolicValue: diabtec.diastolicPressure.toString(), + bloodSystolicValue: diabtec.systolicePressure.toString(), + measureTimeSelectedType: diabtec.measuredArmDesc, + ), + ), + ); + }, + child: Container( + // height: 70, + // padding: EdgeInsets.all(10), + child: Icon( + Icons.edit, + color: Color(0xff575757), ), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index fb71bea2..c89a4164 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -14,18 +14,23 @@ 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:collection/collection.dart"; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class BloodMonthlyPage extends StatelessWidget { final List diabtecPatientResult; final List timeSeriesData; final BloodSugarViewMode bloodSugarViewMode; - const BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); + BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); + + List monthlyGroup = []; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + groupData(); return AppScaffold( // baseViewModel: bloodSugarViewMode, body: ListView( @@ -47,166 +52,181 @@ class BloodMonthlyPage extends StatelessWidget { child: Texts(TranslationBase.of(context).details), ), Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ timeSeriesData.isEmpty ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel), - ), - SizedBox(height: 80) - ], - ), - ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]), + ])) ], ), ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, e) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), + // Container( + // child: Container( + // decoration: BoxDecoration( + // color: Theme.of(context).primaryColor, + // borderRadius: BorderRadius.only( + // 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( + // TranslationBase.of(context).date, + // color: Colors.white, + // fontSize: 15, + // ), + // ), + // height: 40, + // ), + // ), + // Container( + // child: Container( + // decoration: BoxDecoration( + // color: Theme.of(context).primaryColor, + // ), + // child: Center( + // child: Texts( + // TranslationBase.of(context).time, + // color: Colors.white, + // fontSize: 15, + // ), + // ), + // height: 40), + // ), + // Container( + // child: Container( + // decoration: BoxDecoration( + // color: Theme.of(context).primaryColor, + // ), + // child: Center( + // child: Texts( + // TranslationBase.of(context).measured, + // color: Colors.white, + // fontSize: 15, + // ), + // ), + // height: 40), + // ), + // Container( + // child: Container( + // decoration: BoxDecoration( + // color: Theme.of(context).primaryColor, + // borderRadius: BorderRadius.only( + // 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( + // TranslationBase.of(context).value, + // color: Colors.white, + // fontSize: 15, + // ), + // ), + // height: 40), + // ), ], ), ); - diabtecPatientResult.forEach( + e.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : 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, - ), - ), - ), - ), + Utils.tableColumnValue(projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart), + isCapitable: false), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), + // Container( + // child: Container( + // height: 70, + // padding: EdgeInsets.all(10), + // color: Colors.white, + // child: Center( + // child: Texts( + // '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : 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, + // ), + // ), + // ), + // ), ], ), ); @@ -214,4 +234,10 @@ class BloodMonthlyPage extends StatelessWidget { ); return tableRow; } + + groupData() { + monthlyGroup.clear(); + var groupedArray = groupBy(diabtecPatientResult, (obj) => DateUtil.getMonth(obj.dateChart.month) + ' ' + obj.dateChart.year.toString()); + groupedArray.entries.forEach((e) => monthlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 85cdf47d..e9280fd4 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -13,16 +13,19 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import "package:collection/collection.dart"; class BloodYearPage extends StatelessWidget { final List diabtecPatientResult; final List timeSeriesData; final BloodSugarViewMode bloodSugarViewMode; - const BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); - + BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); + List yearlyGroup = []; @override Widget build(BuildContext context) { + groupData(); ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( // baseViewModel: bloodSugarViewMode, @@ -56,12 +59,23 @@ class BloodYearPage extends StatelessWidget { child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), - children: fullData(context, projectViewModel), - ), + : Column(children: [ + for (var monthly in yearlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, projectViewModel, monthly[1]), + ) + ]) + ]), SizedBox(height: 80) ], ), @@ -71,140 +85,28 @@ class BloodYearPage extends StatelessWidget { ); } - List fullData(BuildContext context, ProjectViewModel projectViewModel) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, yearlyGroup) { List tableRow = []; tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); - diabtecPatientResult.forEach( + yearlyGroup.forEach( (diabtec) { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : 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, - ), - ), - ), - ), + Utils.tableColumnValue(projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart), + isCapitable: false), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), ], ), ); @@ -212,4 +114,10 @@ class BloodYearPage extends StatelessWidget { ); return tableRow; } + + groupData() { + yearlyGroup.clear(); + var groupedArray = groupBy(diabtecPatientResult.reversed, (obj) => DateUtil.getMonth(obj.dateChart.month) + ' ' + obj.dateChart.year.toString()); + groupedArray.entries.forEach((e) => yearlyGroup.add([e.key, e.value])); + } } diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index ddac174e..fd5ebc39 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -85,26 +85,33 @@ class _BloodSugarHomePageState extends State with SingleTick ) ], ), - floatingActionButton: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodSugarPage( - bloodSugarViewMode: model, - ))); - }, - child: Container( - width: 55, - height: 55, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, + floatingActionButton: Stack( + children: [ + Positioned( + bottom: 80, + right: 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + bloodSugarViewMode: model, + ))); + }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + )), ), ), - ), + ], ), bottomSheet: Container( width: MediaQuery.of(context).size.width, diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart index 677ccd66..76339aa5 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:provider/provider.dart'; import 'AddBloodSugarPage.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class BloodSugarWeeklyPage extends StatelessWidget { final List diabtecPatientResult; @@ -58,9 +59,10 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), ) : Table( - border: TableBorder.symmetric( - inside: BorderSide(width: 2.0, color: Colors.grey[300]), - ), + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, children: fullData(context, projectViewModel, bloodSugarViewMode), ), SizedBox( @@ -79,85 +81,11 @@ class BloodSugarWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).date, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40, - ), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).time, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).measured, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Texts( - TranslationBase.of(context).value, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), - Container( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - 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( - TranslationBase.of(context).edit, - color: Colors.white, - fontSize: 15, - ), - ), - height: 40), - ), + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).time), + Utils.tableColumnTitle(TranslationBase.of(context).measured), + Utils.tableColumnTitle(TranslationBase.of(context).value), + Utils.tableColumnTitle(TranslationBase.of(context).edit), ], ), ); @@ -166,90 +94,48 @@ class BloodSugarWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Container( - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : 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: 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, + Utils.tableColumnValue(projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart), + isCapitable: false), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), + Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + SizedBox(height: 12), + Container( + 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), + child: Icon( + Icons.edit, + color: Color(0xff575757), ), - ); - }, - child: Container( - height: 70, - padding: EdgeInsets.all(10), - color: Colors.white, - child: Center( - child: Icon(Icons.edit), ), ), ), - ), + SizedBox(height: 6), + Divider( + height: 1, + color: Color(0xffEFEFEF), + thickness: 1, + ) + ]), ], ), );