diff --git a/lib/core/service/medical/BloodPressureService.dart b/lib/core/service/medical/BloodPressureService.dart index 7a849808..08ca9027 100644 --- a/lib/core/service/medical/BloodPressureService.dart +++ b/lib/core/service/medical/BloodPressureService.dart @@ -24,6 +24,7 @@ class BloodPressureService extends BaseService { monthDiabtectResultAverageList.clear(); weekDiabtectResultAverageList.clear(); yearDiabtecResultAverageList.clear(); + response['List_MonthBloodPressureResultAverage'].forEach((item) { monthDiabtectResultAverageList .add(MonthBloodPressureResultAverage.fromJson(item)); @@ -111,6 +112,7 @@ class BloodPressureService extends BaseService { {String bloodPressureDate, String diastolicPressure, String systolicePressure, + int lineItemNo, int measuredArm}) async { hasError = false; super.error = ""; @@ -120,6 +122,7 @@ class BloodPressureService extends BaseService { body['DiastolicPressure'] = diastolicPressure; body['SystolicePressure'] = systolicePressure; body['MeasuredArm'] ='$measuredArm'; + body['LineItemNo'] = lineItemNo; body['isDentalAllowedBackend'] = false; await baseAppClient.post(UPDATE_BLOOD_PRESSURE_RESULT, diff --git a/lib/core/service/medical/WeightPressureService.dart b/lib/core/service/medical/WeightPressureService.dart index 6d150c28..5cfcc35c 100644 --- a/lib/core/service/medical/WeightPressureService.dart +++ b/lib/core/service/medical/WeightPressureService.dart @@ -20,10 +20,10 @@ class WeightService extends BaseService { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; + monthWeightMeasurementResultAverage.clear(); + weekWeightMeasurementResultAverage.clear(); + yearWeightMeasurementResultAverage.clear(); await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT_AVERAGE, onSuccess: (dynamic response, int statusCode) { - monthWeightMeasurementResultAverage.clear(); - weekWeightMeasurementResultAverage.clear(); - yearWeightMeasurementResultAverage.clear(); response['List_MonthWeightMeasurementResultAverage'].forEach((item) { monthWeightMeasurementResultAverage.add(MonthWeightMeasurementResultAverage.fromJson(item)); }); @@ -43,10 +43,10 @@ class WeightService extends BaseService { Future getWeightMeasurementResult() async { hasError = false; + monthWeightMeasurementResult.clear(); + weekWeightMeasurementResult.clear(); + yearWeightMeasurementResult.clear(); await baseAppClient.post(GET_WEIGHT_PRESSURE_RESULT, onSuccess: (dynamic response, int statusCode) { - monthWeightMeasurementResult.clear(); - weekWeightMeasurementResult.clear(); - yearWeightMeasurementResult.clear(); response['List_WeekWeightMeasurementResult'].forEach((item) { weekWeightMeasurementResult.add(WeightMeasurementResult.fromJson(item)); diff --git a/lib/core/viewModels/medical/blood_pressure_view_model.dart b/lib/core/viewModels/medical/blood_pressure_view_model.dart index 596a9c1e..3d772095 100644 --- a/lib/core/viewModels/medical/blood_pressure_view_model.dart +++ b/lib/core/viewModels/medical/blood_pressure_view_model.dart @@ -75,17 +75,17 @@ 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, int lineItemNo, bool isUpdate = false}) async { setState(ViewState.BusyLocal); if (!isUpdate) 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, lineItemNo: lineItemNo); if (bloodPressureService.hasError) { error = bloodPressureService.error; setState(ViewState.ErrorLocal); } else { - await getBloodPressure(); + // await getBloodPressure(); setState(ViewState.Idle); } } diff --git a/lib/models/Appointments/DoctorRateDetails.dart b/lib/models/Appointments/DoctorRateDetails.dart index b29a5db9..58668856 100644 --- a/lib/models/Appointments/DoctorRateDetails.dart +++ b/lib/models/Appointments/DoctorRateDetails.dart @@ -4,13 +4,15 @@ class DoctorRateDetails { dynamic clinicID; dynamic rate; dynamic patientNumber; + dynamic ratio; DoctorRateDetails( {this.doctorID, this.projectID, this.clinicID, this.rate, - this.patientNumber}); + this.patientNumber, + this.ratio}); DoctorRateDetails.fromJson(Map json) { doctorID = json['DoctorID']; @@ -18,6 +20,7 @@ class DoctorRateDetails { clinicID = json['ClinicID']; rate = json['Rate']; patientNumber = json['PatientNumber']; + ratio = json['Ratio']; } Map toJson() { @@ -27,6 +30,7 @@ class DoctorRateDetails { data['ClinicID'] = this.clinicID; data['Rate'] = this.rate; data['PatientNumber'] = this.patientNumber; + data['Ratio'] = this.ratio; return data; } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index b64c5d7d..12879ac9 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -49,7 +49,7 @@ class OrdersLogDetailsPage extends StatelessWidget { return AppScaffold( isShowAppBar: false, baseViewModel: model, - body: ListView.separated( + body: model.hhcAllPresOrders.length > 0 ? ListView.separated( padding: EdgeInsets.all(21), physics: BouncingScrollPhysics(), itemBuilder: (context, index) { @@ -170,7 +170,7 @@ class OrdersLogDetailsPage extends StatelessWidget { ); }, separatorBuilder: (context, index) => SizedBox(height: 12), - itemCount: model.hhcAllPresOrders.length), + itemCount: model.hhcAllPresOrders.length) : getNoDataWidget(context), ); } } diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart index 864beb98..ac63011c 100644 --- a/lib/pages/AlHabibMedicalService/parking_page.dart +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -32,7 +32,7 @@ class ParkingPage extends StatelessWidget { ? Column( children: [ Texts( - TranslationBase.of(context).parkingTitle, + TranslationBase.of(context).parkingDescription, fontWeight: FontWeight.normal, fontSize: 15, ), @@ -149,6 +149,7 @@ class ParkingPage extends StatelessWidget { ), bottomSheet: !model.isSavePark ? Container( + color: Theme.of(context).scaffoldBackgroundColor, height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, child: Column( diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 6ac4d557..3ab445b2 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -125,7 +125,7 @@ class _StatusFeedbackPageState extends State { ), ], ), - bottomSheet: Container( + bottomSheet: projectViewModel.isLogin ? Container( color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( @@ -133,7 +133,7 @@ class _StatusFeedbackPageState extends State { projectViewModel.isLogin ? null : () => {}, disabledColor: Colors.grey, ), - ), + ) : Container(), ), ); } diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index 06070a7f..f91121e3 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -64,8 +64,28 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt TabBar( labelColor: Colors.black, tabs: [ - Tab(text: TranslationBase.of(context).consultation), - Tab(text: TranslationBase.of(context).logs), + Tab( + child: Text( + TranslationBase.of(context).consultation, + style: TextStyle( + color: Colors.black, + fontSize: 14, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + ), + Tab( + child: Text( + TranslationBase.of(context).logs, + style: TextStyle( + color: Colors.black, + fontSize: 14, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + ), ], controller: _tabController, ), diff --git a/lib/pages/livecare/widgets/livecare_logs.dart b/lib/pages/livecare/widgets/livecare_logs.dart index a7f7fdc0..7b85afc2 100644 --- a/lib/pages/livecare/widgets/livecare_logs.dart +++ b/lib/pages/livecare/widgets/livecare_logs.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareHistoryCard.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; class LiveCareLogs extends StatefulWidget { @@ -20,21 +21,20 @@ class _LiveCareLogsState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - child: Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.erRequestHistoryList.length, - itemBuilder: (context, index) { - return widget.erRequestHistoryList[index].callStatus < 4 - ? Container() - : LiveCareHistoryCard( - erRequestHistoryList: widget.erRequestHistoryList[index]); - }, - ), - ), + child: widget.erRequestHistoryList.length > 0 + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.erRequestHistoryList.length, + itemBuilder: (context, index) { + return widget.erRequestHistoryList[index].callStatus < 4 ? Container() : LiveCareHistoryCard(erRequestHistoryList: widget.erRequestHistoryList[index]); + }, + ), + ) + : Container(margin: EdgeInsets.only(top: 200.0), child: getNoDataWidget(context)), ); } } diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart index 459ef0f8..e83cf1d5 100644 --- a/lib/pages/medical/allergies_page.dart +++ b/lib/pages/medical/allergies_page.dart @@ -16,6 +16,8 @@ class AllergiesPage extends StatelessWidget { onModelReady: (model) => model.getAllergies(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).allergies, baseViewModel: model, description: TranslationBase.of(context).infoAllergies, diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index f01bb05f..5380896e 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; @@ -51,9 +51,10 @@ class _AddWeightPageState extends State { dayWeightDate = widget.dayWeightDate; timeWeightDate = widget.dayWeightDate; measureTimeSelectedType = widget.measureTimeSelectedType; - if (measureUnitEnList.contains(widget.measureTimeSelectedType)) - weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); - else if (measureUnitArList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); + weightUnit = widget.weightUnit; + // if (measureUnitEnList.contains(widget.measureTimeSelectedType)) + // weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); + // else if (measureUnitArList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); _weightValueController.text = widget.weightValue; validateForm(); } @@ -215,46 +216,46 @@ class _AddWeightPageState extends State { ), ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () async { - if (_weightValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - if (widget.isUpdate) { - widget.model - .updateWeightResult( - weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', - weightMeasured: _weightValueController.text.toString(), - weightUnit: weightUnit, - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.Error) - AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - }); - } else - widget.model - .addWeightResult( - weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', - weightMeasured: _weightValueController.text.toString(), - weightUnit: weightUnit, - ) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.Error) - AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - }); - } - }, - label: TranslationBase.of(context).save.toUpperCase(), - backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900], - disabled: isButtonDisabled, + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton( + TranslationBase.of(context).save.toUpperCase(), + isButtonDisabled ? null : () async { + if (_weightValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + if (widget.isUpdate) { + widget.model + .updateWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', + weightMeasured: _weightValueController.text.toString(), + weightUnit: weightUnit + 1, + lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } else + widget.model + .addWeightResult( + weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00', + weightMeasured: _weightValueController.text.toString(), + weightUnit: weightUnit, + ) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.Error) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }); + } + }, + disabledColor: Colors.grey, + ), ), )); } diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 448d8809..54891563 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -56,7 +55,8 @@ class WeightWeeklyPage extends StatelessWidget { shape: cardRadius(12), elevation: 1, margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(8.0), @@ -124,7 +124,7 @@ class WeightWeeklyPage extends StatelessWidget { page: AddWeightPage( isUpdate: true, dayWeightDate: diabtec.weightDate, - measureTimeSelectedType: 'Kg', + measureTimeSelectedType: diabtec.unit == "1" ? 'Kg' : 'Pound', weightValue: diabtec.weightMeasured.toString(), lineItemNo: diabtec.lineItemNo, weightUnit: int.parse(diabtec.unit), @@ -138,8 +138,6 @@ class WeightWeeklyPage extends StatelessWidget { }); }, child: Container( - // height: 70, - // padding: EdgeInsets.all(10), child: Icon( Icons.edit, color: Color(0xff575757), diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index 4e64bb6f..44a28209 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; @@ -21,11 +22,13 @@ class AddBloodPressurePage extends StatefulWidget { final String measureTimeSelectedType; final bool isUpdate; final int lineItemNo; + final int measuredArm; final String bloodSystolicValue; final String bloodDiastolicValue; final BloodPressureViewMode model; - const AddBloodPressurePage({Key key, this.bloodSugarDate, this.measureTimeSelectedType, this.isUpdate = false, this.lineItemNo, this.model, this.bloodSystolicValue, this.bloodDiastolicValue}) + const AddBloodPressurePage( + {Key key, this.bloodSugarDate, this.measureTimeSelectedType, this.isUpdate = false, this.lineItemNo, this.measuredArm, this.model, this.bloodSystolicValue, this.bloodDiastolicValue}) : super(key: key); @override @@ -39,13 +42,10 @@ class _AddBloodPressurePageState extends State { DateTime timeSugarDate = DateTime.now(); int measuredArm = 1; bool isButtonDisabled = true; - final List measureTimeEnList = [ - 'Left Arm ', - 'Right Arm', - ]; + final List measureTimeEnList = ['Right Arm', 'Left Arm']; final List measureTimeArList = [ - 'الذراع الأيسر', 'الذراع الأيمن', + 'الذراع الأيسر', ]; String measureTimeSelectedType = 'Left Arm'; @@ -56,9 +56,7 @@ class _AddBloodPressurePageState extends State { bloodSugarDate = widget.bloodSugarDate; bloodSugarDate = widget.bloodSugarDate; measureTimeSelectedType = widget.measureTimeSelectedType; - if (measureTimeEnList.contains(widget.measureTimeSelectedType)) - measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType); - else if (measureTimeArList.contains(widget.measureTimeSelectedType)) measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType); + measuredArm = widget.measuredArm - 1; _bloodSystolicValueController.text = widget.bloodSystolicValue; _bloodDiastolicValueController.text = widget.bloodDiastolicValue; validateForm(); @@ -119,7 +117,7 @@ class _AddBloodPressurePageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(projectViewModel.isArabic ? measureTimeArList[0] : measureTimeEnList[0]), + Texts(projectViewModel.isArabic ? measureTimeArList[measuredArm] : measureTimeEnList[measuredArm]), Icon( Icons.arrow_drop_down, color: Colors.grey, @@ -224,38 +222,37 @@ class _AddBloodPressurePageState extends State { ), ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () async { - if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - - widget.model - .addORUpdateDiabtecResult( - isUpdate: widget.isUpdate, - bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - diastolicPressure: _bloodDiastolicValueController.text.toString(), - systolicePressure: _bloodSystolicValueController.text.toString(), - measuredArm: measuredArm, - ) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.BusyLocal) + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton( + TranslationBase.of(context).save, + isButtonDisabled ? null : () async { + if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + widget.model + .addORUpdateDiabtecResult( + isUpdate: widget.isUpdate, + bloodPressureDate: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + diastolicPressure: _bloodDiastolicValueController.text.toString(), + systolicePressure: _bloodSystolicValueController.text.toString(), + measuredArm: (measuredArm + 1), + lineItemNo: widget.lineItemNo) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.BusyLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + ; + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - ; - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - } - }, - label: TranslationBase.of(context).save.toUpperCase(), - backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900], - disabled: isButtonDisabled, + }); + } + }, + disabledColor: Colors.grey, + ), ), )); } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index 7dd4d619..a99b75ea 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -1,22 +1,23 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + import 'AddBloodPressurePage.dart'; import 'BloodPressureMonthly.dart'; import 'BloodPressureYeaPage.dart'; import 'bloodPressureWeeklyPage.dart'; -import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; class BloodPressureHomePage extends StatefulWidget { @override @@ -43,97 +44,113 @@ class _BloodPressureHomePageState extends State with Sing ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getBloodPressure(), - builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodPressure, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget( - tabController: _tabController, - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - BloodPressureWeeklyPage( - model: model, - ), - BloodPressureMonthlyPage( - model: model, - ), - BloodPressureYearPage( - model: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: Stack(children: [ - Positioned( - bottom: 80, - right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodPressurePage( + builder: (_, model, w) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase + .of(context) + .bloodPressure, + showNewAppBar: true, + showNewAppBarTitle: true, + baseViewModel: model, + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: TabBarWidget( + tabController: _tabController, + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + BloodPressureWeeklyPage( + model: model, + ), + BloodPressureMonthlyPage( 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, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async { - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).emailSentSuccessfully, - ); - } - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); + BloodPressureYearPage( + model: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: Stack(children: [ + Positioned( + bottom: 60, + right: projectViewModel.isArabic ? MediaQuery + .of(context) + .size + .width * .85 : 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( + model: model, + ))).then((value) { + model.getBloodPressure(); + }); + }, + 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( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase + .of(context) + .sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase + .of(context) + .emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); }, + // label: TranslationBase.of(context).sendEmail, + // backgroundColor: Colors.red[900], ), - ); - }, - label: TranslationBase.of(context).sendEmail, - backgroundColor: Colors.red[900], - ), - ), - )), + ), + ), + )), ); } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index b4974159..1e7f3b8b 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -109,9 +109,11 @@ class BloodPressureWeeklyPage extends StatelessWidget { bloodDiastolicValue: diabtec.diastolicPressure.toString(), bloodSystolicValue: diabtec.systolicePressure.toString(), measureTimeSelectedType: diabtec.measuredArmDesc, + measuredArm: diabtec.measuredArm, ), ), ).then((value) { + model.getBloodPressure(); if(model.weekDiabtecPatientResult.isEmpty) { model.weightWeekTimeSeriesDataTop.clear(); model.weightWeekTimeSeriesDataLow.clear(); diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 65005109..0095fb94 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; @@ -23,9 +23,10 @@ class AddBloodSugarPage extends StatefulWidget { final String measuredTime; final String bloodSugarValue; final int lineItemNo; + final String measuredSelectedType; final BloodSugarViewMode bloodSugarViewMode; - AddBloodSugarPage({Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode}) + AddBloodSugarPage({Key key, this.bloodSugarDate, this.measureUnitSelectedType, this.isUpdate = false, this.measuredTime, this.bloodSugarValue, this.lineItemNo, this.bloodSugarViewMode, this.measuredSelectedType}) : super(key: key); @override @@ -77,6 +78,7 @@ class _AddBloodSugarPageState extends State { measuredTime = measureTimeEnList.indexOf(widget.measuredTime); else if (measureTimeArList.contains(widget.measuredTime)) measuredTime = measureTimeArList.indexOf(widget.measuredTime); _bloodSugarValueController.text = widget.bloodSugarValue; + measureTimeSelectedType = widget.measuredSelectedType; validateForm(); } } @@ -89,17 +91,6 @@ class _AddBloodSugarPageState extends State { showNewAppBar: true, showNewAppBarTitle: true, appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, - // appBarIcons: widget.isUpdate - // ? [ - // IconButton( - // icon: Icon(Icons.delete), - // color: Colors.white, - // onPressed: () { - - // }, - // ) - // ] - // : null, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( @@ -258,46 +249,48 @@ class _AddBloodSugarPageState extends State { ), ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () async { - if (_bloodSugarValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - if (widget.isUpdate) { - await widget.bloodSugarViewMode.updateDiabtecResult( - month: bloodSugarDate, - hour: timeSugarDate, - diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - lineItemNo: widget.lineItemNo, - bloodSugerResult: _bloodSugarValueController.text.toString()); + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton( + TranslationBase.of(context).save.toUpperCase(), + isButtonDisabled + ? null + : () async { + if (_bloodSugarValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + if (widget.isUpdate) { + await widget.bloodSugarViewMode.updateDiabtecResult( + month: bloodSugarDate, + hour: timeSugarDate, + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + lineItemNo: widget.lineItemNo, + bloodSugerResult: _bloodSugarValueController.text.toString()); - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) - AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - } else { - await widget.bloodSugarViewMode.addDiabtecResult( - diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - bloodSugerResult: _bloodSugarValueController.text.toString(), - bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - ); + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + } else { + await widget.bloodSugarViewMode.addDiabtecResult( + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + bloodSugerResult: _bloodSugarValueController.text.toString(), + bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + ); - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.Error) - AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - } - } - }, - label: TranslationBase.of(context).save.toUpperCase(), - backgroundColor: isButtonDisabled ? Colors.grey : Colors.red[900], - disabled: isButtonDisabled, + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + } + } + }, + disabledColor: Colors.grey, + ), ), )); } 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 85500a69..13c8392d 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 @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -85,7 +86,7 @@ class _BloodSugarHomePageState extends State with SingleTick floatingActionButton: Stack( children: [ Positioned( - bottom: 130, + bottom: 60, right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, child: InkWell( onTap: () { @@ -111,36 +112,36 @@ class _BloodSugarHomePageState extends State with SingleTick ], ), bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), - child: Button( - onTap: () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async { - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).emailSentSuccessfully, - ); - } - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, - ), - ); - }, - label: TranslationBase.of(context).sendEmail, - backgroundColor: Colors.red[900], + }); + }, + ), + ); + }, + ), ), ), ), 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 537265ed..7921d030 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 @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -33,7 +34,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, child: LineChartCurved( - title: '${TranslationBase.of(context).bloodSugar}', + title: '${TranslationBase.of(AppGlobal.context).bloodSugar}', timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, indexes: timeSeriesData.length ~/ 5.5, ), @@ -43,7 +44,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + child: Texts(TranslationBase.of(AppGlobal.context).details), ), Container( padding: EdgeInsets.all(10), @@ -54,7 +55,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { timeSeriesData.isEmpty ? Container( child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), + child: Texts(TranslationBase.of(AppGlobal.context).noDataAvailable), ), ) : Table( @@ -114,6 +115,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { lineItemNo: diabtec.lineItemNo, measureUnitSelectedType: diabtec.unit, bloodSugarViewMode: bloodSugarViewMode, + measuredSelectedType: diabtec.measuredDesc, ), ), ).then((value) { diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart index ee7e00af..b2721366 100644 --- a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -85,7 +86,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { width: 20, height: 20, decoration: BoxDecoration( - shape: BoxShape.rectangle, color: Colors.grey), + shape: BoxShape.rectangle, color: secondaryColor), ), SizedBox( width: 5, diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 722cddb6..f565594e 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -26,7 +27,7 @@ class ReportListWidget extends StatelessWidget { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - return ListView.separated( + return reportList.length > 0 ? ListView.separated( physics: BouncingScrollPhysics(), padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), separatorBuilder: (context, index) => SizedBox(height: 14), @@ -112,7 +113,7 @@ class ReportListWidget extends StatelessWidget { ); }, itemCount: reportList.length, - ); + ) : getNoDataWidget(context) ; } void showConfirmMessage(Reports report) { diff --git a/lib/widgets/charts/show_chart.dart b/lib/widgets/charts/show_chart.dart index b5a3c869..b23d90f5 100644 --- a/lib/widgets/charts/show_chart.dart +++ b/lib/widgets/charts/show_chart.dart @@ -137,7 +137,7 @@ class ShowChart extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 10, ), - // interval: 3.0, + interval: null, margin: 12, ), ), diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 7817ce38..53969cd7 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -160,6 +160,7 @@ class _AppDrawerState extends State { ), onTap: () { sharedPref.setBool(IS_ROBOT_INIT, null); + sharedPref.remove(CLINICS_LIST); if (projectProvider.isArabic) { projectProvider.changeLanguage('en'); } else { @@ -310,6 +311,7 @@ class _AppDrawerState extends State { isImageIcon: true, bottomLine: false, letterSpacing: -0.84, fontSize: 14, fontHeight: projectProvider.isArabic ? 1 : 0.8, projectProvider: projectProvider), onTap: () { sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + sharedPref.remove(CLINICS_LIST); sharedPref.setBool(IS_ROBOT_INIT, null); if (projectProvider.isArabic) { projectProvider.changeLanguage('en'); diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index a9cd0706..ed93fe59 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -223,7 +223,7 @@ class DoctorHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: MediaQuery.of(context).size.width * 0.8, + width: 350.0, color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -249,11 +249,14 @@ class DoctorHeader extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container(margin: EdgeInsets.only(left: 20.0), child: Text(this.headerModel.decimalDoctorRate != null ? this.headerModel.decimalDoctorRate : this.headerModel.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black, fontWeight: FontWeight.bold))), + Container( + margin: EdgeInsets.symmetric(horizontal: 20.0), + child: Text(this.headerModel.decimalDoctorRate != null ? this.headerModel.decimalDoctorRate : this.headerModel.actualDoctorRate.ceilToDouble().toString(), + style: TextStyle(fontSize: 32.0, color: Colors.black, letterSpacing: -0.64, fontWeight: FontWeight.bold))), Container( margin: EdgeInsets.symmetric(horizontal: 20.0), child: RatingBar.readOnly( - initialRating: this.headerModel.actualDoctorRate.toDouble(), + initialRating: this.headerModel.decimalDoctorRate != null ? double.tryParse(this.headerModel.decimalDoctorRate) : this.headerModel.actualDoctorRate.toDouble(), size: 35.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], @@ -267,7 +270,9 @@ class DoctorHeader extends StatelessWidget { ), Container( margin: EdgeInsets.symmetric(horizontal: 20.0), - child: Text(this.headerModel.totalReviews.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600))), + transform: Matrix4.translationValues(0.0, -10.0, 0.0), + child: Text(this.headerModel.totalReviews.toString() + " " + TranslationBase.of(context).reviews, + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600))), Container( margin: EdgeInsets.only(top: 10.0), child: Row( @@ -278,22 +283,14 @@ class DoctorHeader extends StatelessWidget { Container( width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[0].patientNumber), - height: 6.0, - child: Container( - color: Colors.green[700], - ), - ), - ), + child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), + getRatingLine(doctorDetailsList[0].patientNumber, Colors.green[700]), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[0].patientNumber).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[0].patientNumber).round().toString() + "%", + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -307,22 +304,14 @@ class DoctorHeader extends StatelessWidget { Container( width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[1].patientNumber), - height: 6.0, - child: Container( - color: Color(0xffB7B723), - ), - ), - ), + child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), + getRatingLine(doctorDetailsList[1].patientNumber, Color(0xffB7B723)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[1].patientNumber).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[1].patientNumber).round().toString() + "%", + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -336,22 +325,14 @@ class DoctorHeader extends StatelessWidget { Container( width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[2].patientNumber), - height: 6.0, - child: Container( - color: Color(0xffEBA727), - ), - ), - ), + child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), + getRatingLine(doctorDetailsList[2].patientNumber, Color(0xffEBA727)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[2].patientNumber).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[2].patientNumber).round().toString() + "%", + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -365,22 +346,14 @@ class DoctorHeader extends StatelessWidget { Container( width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[3].patientNumber), - height: 6.0, - child: Container( - color: Color(0xffEB7227), - ), - ), - ), + child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), + getRatingLine(doctorDetailsList[3].patientNumber, Color(0xffEB7227)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[3].patientNumber).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[3].patientNumber).round().toString() + "%", + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), @@ -395,53 +368,18 @@ class DoctorHeader extends StatelessWidget { Container( width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black))), - Container( - margin: EdgeInsets.only(top: 10.0), - child: SizedBox( - width: getRatingWidth(doctorDetailsList[4].patientNumber), - height: 6.0, - child: Container( - color: Color(0xffE20C0C), - ), - ), - ), + child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), + getRatingLine(doctorDetailsList[4].patientNumber, Color(0xffE20C0C)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[4].patientNumber).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), + child: Text(getRatingWidth(doctorDetailsList[4].patientNumber).round().toString() + "%", + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], ), ), - // Container(margin: EdgeInsets.only(top: 40.0), child: Divider()), - // Container( - // margin: EdgeInsets.only(top: 0.0), - // child: Align( - // alignment: FractionalOffset.bottomCenter, - // child: ButtonTheme( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10.0), - // ), - // minWidth: MediaQuery.of(context).size.width, - // height: 40.0, - // child: RaisedButton( - // elevation: 0.0, - // color: Colors.white, - // textColor: Colors.red, - // hoverColor: Colors.transparent, - // focusColor: Colors.transparent, - // highlightColor: Colors.transparent, - // disabledColor: new Color(0xFFbcc2c4), - // onPressed: () { - // Navigator.of(context).pop(); - // }, - // child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), - // ), - // ), - // ), - // ), ], ), ), @@ -462,4 +400,26 @@ class DoctorHeader extends StatelessWidget { var width = (patientNumber / this.headerModel.totalReviews) * 100; return width.roundToDouble(); } + + Widget getRatingLine(int patientNumber, Color color) { + return Container( + margin: EdgeInsets.only(top: 10.0), + child: Stack(children: [ + SizedBox( + width: 135.0, + height: 4.0, + child: Container( + color: Colors.grey[300], + ), + ), + SizedBox( + width: getRatingWidth(patientNumber) * 1.35, + height: 4.0, + child: Container( + color: color, + ), + ), + ]), + ); + } }