From 0086875d0d1f1f0b3870118c065b47d93d5434c3 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 8 Sep 2021 11:50:07 +0300 Subject: [PATCH 1/4] Design Updated for tracker --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 33 +- .../ContactUs/widgets/card_common_contat.dart | 12 + lib/pages/landing/landing_page.dart | 50 +- .../my_trackers/Weight/AddWeightPage.dart | 400 ++++++++-------- .../my_trackers/Weight/WeightHomePage.dart | 2 + .../blood_pressure/AddBloodPressurePage.dart | 405 ++++++++-------- .../blood_pressure/BloodPressureHomePage.dart | 154 +++--- .../blood_pressure/BloodPressureMonthly.dart | 69 +-- .../blood_pressure/BloodPressureYeaPage.dart | 56 +-- .../bloodPressureWeeklyPage.dart | 56 +-- .../blood_suger/AddBloodSugarPage.dart | 444 ++++++++---------- .../my_trackers/blood_suger/BloodMonthly.dart | 35 +- .../my_trackers/blood_suger/BloodYeaPage.dart | 59 +-- .../blood_suger/blood_sugar_home_page.dart | 85 ++-- .../blood_suger/blood_sugar_weekly_page.dart | 91 ++-- .../medical/my_trackers/my_trackers.dart | 216 +++++---- lib/uitl/translations_delegate_base.dart | 52 +- lib/widgets/dialogs/RadioStringDialog.dart | 120 +++-- .../others/floating_button_search.dart | 10 +- 20 files changed, 1144 insertions(+), 1209 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index dabfdf55..d3d47ab4 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ 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/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 11bb669a..65adc481 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1417,10 +1417,7 @@ const Map localizedValues = { }, "dental-procedure-list": {"en": "Dental Procedures for this Appointment: ", "ar": "إجراءات الأسنان لهذا الموعد:"}, "time-needed": {"en": "Time Needed:", "ar": "الوقت اللازم:"}, - "total-time-needed": { - "en": "Total Appointment Time:", - "ar": "وقت المواعيد الكلي:" - }, + "total-time-needed": {"en": "Total Appointment Time:", "ar": "وقت المواعيد الكلي:"}, "info-eye": { "en": "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.", "ar": " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية." @@ -1434,27 +1431,35 @@ const Map localizedValues = { "ar": "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة." }, "info-health-data": { - "en": "This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.", + "en": + "This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.", "ar": "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك." }, "info-ask-doc": { - "en": "This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.", + "en": + "This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.", "ar": "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب." }, "info-auto-wifi": { "en": "This service allows you to connect to the Internet directly without the need for entering a user name or password.", "ar": "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور." }, - "auto-wifi": { - "en": "Connect To Internet", - "ar": "الإتصال بالإنترنت" - }, + "auto-wifi": {"en": "Connect To Internet", "ar": "الإتصال بالإنترنت"}, "child-vaccine-info": { - "en": "This service to remind you of the deadlines of the necessary vaccinations for your child’s against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.", - "ar": "هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل." + "en": + "This service to remind you of the deadlines of the necessary vaccinations for your child’s against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.", + "ar": + "هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل." }, "h2o-info": { - "en": "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", - "ar": "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر." + "en": + "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", + "ar": + "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر." }, + + "sys/dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, + "arm": {"en": "Arm", "ar": "الذراع"}, + "remove-measure": {"en": "Remove this measure", "ar": "إزالة هذا القياس؟"}, + "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"} }; diff --git a/lib/pages/ContactUs/widgets/card_common_contat.dart b/lib/pages/ContactUs/widgets/card_common_contat.dart index fb8fe6b6..ecb6a481 100644 --- a/lib/pages/ContactUs/widgets/card_common_contat.dart +++ b/lib/pages/ContactUs/widgets/card_common_contat.dart @@ -2,6 +2,9 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/Weight/WeightHomePage.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart'; +import 'package:diplomaticquarterapp/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -57,6 +60,15 @@ class CardCommonContact extends StatelessWidget { } else if (type == 2) { //LiveChatPage Navigator.push(context, FadePage(page: LiveChatPage())); + } else if (type == 3) { + //LiveChatPage + Navigator.push(context, FadePage(page: BloodSugarHomePage())); + } else if (type == 4) { + //LiveChatPage + Navigator.push(context, FadePage(page: BloodPressureHomePage())); + } else if (type == 5) { + //LiveChatPage + Navigator.push(context, FadePage(page: WeightHomePage())); } } } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 1e50e81d..4b525d01 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -41,7 +41,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import '../../locator.dart'; import '../../routes.dart'; @@ -601,31 +601,33 @@ class _LandingPageState extends State with WidgetsBindingObserver { ), ), drawer: SafeArea(child: AppDrawer()), - extendBody: true, + extendBody: false, body: WillPopScope( - onWillPop: onWillPop, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: pageController, - children: [ - HomePage2( - goToMyProfile: () { - changeCurrentTab(1); - }, - onLoginClick: () { - login(); - }, - onMedicalFileClick: () { - changeCurrentTab(1); - }, + onWillPop: onWillPop, + child: Stack(children: [ + PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + HomePage2( + goToMyProfile: () { + changeCurrentTab(1); + }, + onLoginClick: () { + login(); + }, + onMedicalFileClick: () { + changeCurrentTab(1); + }, + ), + MedicalProfilePageNew(), + Search(), + MyFamily(isAppbarVisible: false), + ToDo(isShowAppBar: false), + ], // Please do not remove the BookingOptions from this array ), - MedicalProfilePageNew(), - Search(), - MyFamily(isAppbarVisible: false), - ToDo(isShowAppBar: false), - ], // Please do not remove the BookingOptions from this array - ), - ), + RobotIcon() + ])), bottomNavigationBar: BottomNavBar( changeIndex: changeCurrentTab, index: currentTab, diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 9c588f73..b275b237 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -15,6 +15,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; class AddWeightPage extends StatefulWidget { final WeightPressureViewModel model; @@ -25,16 +26,7 @@ class AddWeightPage extends StatefulWidget { final String measureTimeSelectedType; final int weightUnit; - AddWeightPage( - {Key key, - this.model, - this.isUpdate = false, - this.dayWeightDate, - this.lineItemNo, - this.weightValue, - this.measureTimeSelectedType, - this.weightUnit}) - : super(key: key); + AddWeightPage({Key key, this.model, this.isUpdate = false, this.dayWeightDate, this.lineItemNo, this.weightValue, this.measureTimeSelectedType, this.weightUnit}) : super(key: key); @override _AddWeightPageState createState() => _AddWeightPageState(); @@ -62,8 +54,7 @@ class _AddWeightPageState extends State { measureTimeSelectedType = widget.measureTimeSelectedType; if (measureUnitEnList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitEnList.indexOf(widget.measureTimeSelectedType); - else if (measureUnitArList.contains(widget.measureTimeSelectedType)) - weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); + else if (measureUnitArList.contains(widget.measureTimeSelectedType)) weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType); _weightValueController.text = widget.weightValue; validateForm(); } @@ -74,211 +65,199 @@ class _AddWeightPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .deleteWeightResult(lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).weightAdd, - controller: _weightValueController, - keyboardType: TextInputType.number, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureUnitArList - : measureUnitEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? - TranslationBase.of(context).other), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + isShowAppBar: true, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).weightAdd, + controller: _weightValueController, + keyboardType: TextInputType.number, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureUnitArList : measureUnitEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - setState(() { - dayWeightDate = date; - }); - }, - currentTime: dayWeightDate, - locale: projectViewModel.localeType, - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + minTime: DateTime(DateTime.now().year - 1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + setState(() { + dayWeightDate = date; + }); + }, + currentTime: dayWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker( - context, - showTitleActions: true, - onConfirm: (date) { - setState(() { - timeWeightDate = date; - }); - }, - currentTime: timeWeightDate, - locale: projectViewModel.localeType, - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker( + context, + showTitleActions: true, + onConfirm: (date) { + setState(() { + timeWeightDate = date; + }); + }, + currentTime: timeWeightDate, + locale: projectViewModel.localeType, + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - ], + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).removeMeasure, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.model.deleteWeightResult(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }) + ], + )) + : Container() + ], + ), ), ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.2, - child: Padding( - padding: const EdgeInsets.all(15.0), - child: SecondaryButton( - loading: widget.model.state == ViewState.BusyLocal, - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () { - if (_weightValueController.text.isNotEmpty) { - if (widget.isUpdate) { - GifLoaderDialogUtils.showMyDialog(context); - 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); - }); - } - }), - ), - ), - ); + 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) { + if (widget.isUpdate) { + GifLoaderDialogUtils.showMyDialog(context); + 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: Colors.red[900], + disabled: isButtonDisabled, + ), + )); } String getDate() { @@ -308,8 +287,7 @@ class _AddWeightPageState extends State { } void validateForm() { - if (_weightValueController.text.length > 0 && - measureTimeSelectedType != null) { + if (_weightValueController.text.length > 0 && measureTimeSelectedType != null) { setState(() { isButtonDisabled = true; }); diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 41592110..27ffb386 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -42,6 +42,8 @@ class _WeightHomePageState extends State with SingleTickerProvid builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).weight, appBarIcons: [ IconButton( diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index 0c7fea59..41189415 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -15,6 +15,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; class AddBloodPressurePage extends StatefulWidget { final DateTime bloodSugarDate; @@ -25,15 +26,7 @@ class AddBloodPressurePage extends StatefulWidget { 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.model, this.bloodSystolicValue, this.bloodDiastolicValue}) : super(key: key); @override @@ -42,8 +35,7 @@ class AddBloodPressurePage extends StatefulWidget { class _AddBloodPressurePageState extends State { TextEditingController _bloodSystolicValueController = TextEditingController(); - TextEditingController _bloodDiastolicValueController = - TextEditingController(); + TextEditingController _bloodDiastolicValueController = TextEditingController(); DateTime bloodSugarDate = DateTime.now(); DateTime timeSugarDate = DateTime.now(); int measuredArm = 1; @@ -67,8 +59,7 @@ class _AddBloodPressurePageState extends State { measureTimeSelectedType = widget.measureTimeSelectedType; if (measureTimeEnList.contains(widget.measureTimeSelectedType)) measuredArm = measureTimeEnList.indexOf(widget.measureTimeSelectedType); - else if (measureTimeArList.contains(widget.measureTimeSelectedType)) - measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType); + else if (measureTimeArList.contains(widget.measureTimeSelectedType)) measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType); _bloodSystolicValueController.text = widget.bloodSystolicValue; _bloodDiastolicValueController.text = widget.bloodDiastolicValue; validateForm(); @@ -80,221 +71,194 @@ class _AddBloodPressurePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .deactivateDiabeticStatus( - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).systolicAdd, - controller: _bloodSystolicValueController, - keyboardType: TextInputType.number, - maxLength: 3, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - NewTextFields( - hintText: TranslationBase.of(context).diastolicAdd, - controller: _bloodDiastolicValueController, - keyboardType: TextInputType.number, - maxLength: 3, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeArList - : measureTimeEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + isShowAppBar: true, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + showNewAppBar: true, + showNewAppBarTitle: true, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).systolicAdd, + controller: _bloodSystolicValueController, + keyboardType: TextInputType.number, + maxLength: 3, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox( + height: 8, + ), + NewTextFields( + hintText: TranslationBase.of(context).diastolicAdd, + controller: _bloodDiastolicValueController, + keyboardType: TextInputType.number, + maxLength: 3, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { - setState( - () { - bloodSugarDate = date; - }, - ); + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { + setState( + () { + bloodSugarDate = date; + }, + ); + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - setState( - () { - timeSugarDate = date; - }, - ); + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + setState( + () { + timeSugarDate = date; + }, + ); + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - ], + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).removeMeasure, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }) + ], + )) + : Container() + ], + ), ), ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.10, - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - Container( - height: 50, - child: SecondaryButton( - loading: widget.model.state == ViewState.BusyLocal, - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () async { - if (_bloodSystolicValueController.text.isNotEmpty && - _bloodDiastolicValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); + 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) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - ; - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - } - }), - ), - ], + 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) + 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: Colors.red[900], + disabled: isButtonDisabled, ), - ), - ), - ); + )); } String getDate() { @@ -310,7 +274,7 @@ class _AddBloodPressurePageState extends State { context: context, child: RadioStringDialog( radioList: list, - title: 'Select the Arm', + title: TranslationBase.of(context).selectArm, selectedValue: measureTimeSelectedType, onValueSelected: (value) { setState(() { @@ -324,11 +288,8 @@ class _AddBloodPressurePageState extends State { } void validateForm() { - print("_bloodSystolicValueController " + - _bloodSystolicValueController.text.length.toString()); - if (measureTimeSelectedType != 'Left Arm' && - _bloodSystolicValueController.text.length > 0 && - _bloodDiastolicValueController.text.length > 0) { + print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString()); + if (measureTimeSelectedType != 'Left Arm' && _bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) { setState(() { isButtonDisabled = true; }); diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index 723871cb..134ab3b1 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -14,14 +14,14 @@ import 'AddBloodPressurePage.dart'; import 'BloodPressureMonthly.dart'; import 'BloodPressureYeaPage.dart'; import 'bloodPressureWeeklyPage.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; class BloodPressureHomePage extends StatefulWidget { @override _BloodPressureHomePageState createState() => _BloodPressureHomePageState(); } -class _BloodPressureHomePageState extends State - with SingleTickerProviderStateMixin { +class _BloodPressureHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -41,78 +41,92 @@ class _BloodPressureHomePageState extends State return BaseView( onModelReady: (model) => model.getBloodPressure(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodPressure, - baseViewModel: model, - appBarIcons: [IconButton( - icon: Icon(Icons.email), - color: Colors.white, - onPressed: () { - 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); - }); - }, - ), - ); - }, - ),], - 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( + 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: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( model: model, - ) - ], - ), - ) - ], - ), - 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, + ))); + }, + 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, + ), ), ), ), - ), - ), - ), + 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); + }); + }, + ), + ); + }, + label: TranslationBase.of(context).sendEmail, + backgroundColor: Colors.red[900], + ), + ), + )), ); } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 6d4f02d8..09d9af90 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -16,7 +16,6 @@ class BloodPressureMonthlyPage extends StatelessWidget { const BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -24,36 +23,43 @@ class BloodPressureMonthlyPage extends StatelessWidget { return AppScaffold( body: ListView( children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: MonthCurvedChartBloodPressure( - horizontalInterval: 20.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataTop, - timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty?[TimeSeriesSales3(0,0.0)]:model.weighMonthTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: MonthCurvedChartBloodPressure( + horizontalInterval: 20.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataTop, + timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), + ), SizedBox( height: 12, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), + // 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.weighMonthTimeSeriesDataTop.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), - ), + model.weighMonthTimeSeriesDataTop.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), + ), + SizedBox(height: 80) ], ), ) @@ -62,8 +68,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { ); } - List fullData(BuildContext context, - ProjectViewModel projectViewModel, BloodPressureViewMode model) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode model) { List tableRow = []; tableRow.add( TableRow( @@ -78,7 +83,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { ), child: Center( child: Texts( - 'Date', + TranslationBase.of(context).date, color: Colors.white, fontSize: 15, ), @@ -93,7 +98,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { ), child: Center( child: Texts( - 'Time', + TranslationBase.of(context).time, color: Colors.white, fontSize: 15, ), @@ -107,7 +112,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { ), child: Center( child: Texts( - 'Arm', + TranslationBase.of(context).arm, color: Colors.white, fontSize: 15, ), @@ -124,7 +129,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { ), child: Center( child: Texts( - 'SBP/DBP', + TranslationBase.of(context).sysdias, color: Colors.white, fontSize: 15, ), @@ -143,8 +148,8 @@ class BloodPressureMonthlyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate):DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', - fontSize: 15, + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.bloodPressureDate) : DateUtil.getMonthDayYearDateFormatted(diabtec.bloodPressureDate)}', + fontSize: 12, textAlign: TextAlign.center, ), ), @@ -155,7 +160,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { child: Center( child: Texts( '${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', - fontSize: 15, + fontSize: 12, ), ), height: 40), @@ -164,7 +169,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { child: Center( child: Texts( diabtec.measuredArmDesc, - fontSize: 15, + fontSize: 12, ), ), height: 40), @@ -174,7 +179,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { child: Texts( '${diabtec.systolicePressure}/${diabtec.diastolicPressure}', color: Colors.red, - fontSize: 15, + fontSize: 12, ), ), height: 40), diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 68172354..28e3a4b9 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -19,38 +19,45 @@ class BloodPressureYearPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body:ListView( + body: ListView( children: [ Container( margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, child: CurvedChartBloodPressure( - horizontalInterval: 3.0,// model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, + horizontalInterval: 3.0, // model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataTop, - timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightYearTimeSeriesDataLow, + timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataTop, + timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataLow, indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), ), SizedBox( height: 12, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), + // 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.weightYearTimeSeriesDataTop.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), - ), + model.weightYearTimeSeriesDataTop.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), + ), + SizedBox(height: 80) ], ), ) @@ -59,10 +66,7 @@ class BloodPressureYearPage extends StatelessWidget { ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodPressureViewMode bloodSugarViewMode) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -72,12 +76,8 @@ class BloodPressureYearPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -123,12 +123,8 @@ class BloodPressureYearPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index 1929d836..f936c18e 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -22,38 +22,45 @@ class BloodPressureWeeklyPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - body: ListView( + body: ListView( children: [ Container( margin: EdgeInsets.only(top: 12, left: 8, right: 8), color: Colors.white, child: CurvedChartBloodPressure( - horizontalInterval:3.0, + horizontalInterval: 3.0, title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataTop, - timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:model.weightWeekTimeSeriesDataLow, + timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataTop, + timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataLow, indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), ), SizedBox( height: 12, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), + // 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.weightWeekTimeSeriesDataTop.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), - ), + model.weightWeekTimeSeriesDataTop.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), + ), + SizedBox(height: 80) ], ), ) @@ -62,10 +69,7 @@ class BloodPressureWeeklyPage extends StatelessWidget { ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodPressureViewMode bloodSugarViewMode) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodPressureViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -75,12 +79,8 @@ class BloodPressureWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -140,12 +140,8 @@ class BloodPressureWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 075e107e..b6c15034 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -6,6 +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/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; @@ -25,15 +26,7 @@ class AddBloodSugarPage extends StatefulWidget { final int lineItemNo; 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}) : super(key: key); @override @@ -83,8 +76,7 @@ class _AddBloodSugarPageState extends State { measureUnitSelectedType = widget.measureUnitSelectedType; if (measureTimeEnList.contains(widget.measuredTime)) measuredTime = measureTimeEnList.indexOf(widget.measuredTime); - else if (measureTimeArList.contains(widget.measuredTime)) - measuredTime = measureTimeArList.indexOf(widget.measuredTime); + else if (measureTimeArList.contains(widget.measuredTime)) measuredTime = measureTimeArList.indexOf(widget.measuredTime); _bloodSugarValueController.text = widget.bloodSugarValue; validateForm(); } @@ -94,246 +86,222 @@ class _AddBloodSugarPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, - appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); + isShowAppBar: true, + 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: () { - GifLoaderDialogUtils.showMyDialog(context); - widget.bloodSugarViewMode - .deactivateDiabeticStatus( - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == - ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast( - message: widget.bloodSugarViewMode.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] - : null, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).sugarAdd, - controller: _bloodSugarValueController, - keyboardType: TextInputType.number, - onChanged: (value) => validateForm(), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureUnitDialog(); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureUnitSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + // }, + // ) + // ] + // : null, + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + margin: EdgeInsets.all(15), + child: Column( + children: [ + SizedBox( + height: 15, + ), + NewTextFields( + hintText: TranslationBase.of(context).sugarAdd, + controller: _bloodSugarValueController, + keyboardType: TextInputType.number, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureUnitDialog(); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureUnitSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 1, 1, 1), - maxTime: DateTime.now(), onConfirm: (date) { - setState(() { - bloodSugarDate = date; - }); - }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { + setState(() { + bloodSugarDate = date; + }); + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - setState(() { - timeSugarDate = date; - }); - }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + setState(() { + timeSugarDate = date; + }); + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic - ? measureTimeArList - : measureTimeEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? - TranslationBase.of(context).other), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + SizedBox( + height: 8, + ), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - ], + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).removeMeasure, + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); + + GifLoaderDialogUtils.showMyDialog(context); + widget.bloodSugarViewMode.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + ) + ], + )) + : Container() + ], + ), ), ), - ), - bottomSheet: Container( - color: Colors.transparent, - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.10, - child: Column( - children: [ - FractionallySizedBox( - widthFactor: 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).save.toUpperCase(), - textColor: Colors.white, - color: isButtonDisabled ? Colors.grey[900] : Colors.grey, - onTap: () async { - if (_bloodSugarValueController.text.isNotEmpty) { - if (widget.isUpdate) { - GifLoaderDialogUtils.showMyDialog(context); - await widget.bloodSugarViewMode - .updateDiabtecResult( - month: bloodSugarDate, - hour: timeSugarDate, - diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - lineItemNo: widget.lineItemNo, - bloodSugerResult: - _bloodSugarValueController.text.toString()); + 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) { + if (widget.isUpdate) { + GifLoaderDialogUtils.showMyDialog(context); + 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 { - GifLoaderDialogUtils.showMyDialog(context); - 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); - - } + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + } else { + GifLoaderDialogUtils.showMyDialog(context); + 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: Colors.red[900], + disabled: isButtonDisabled, + ), + )); } String getDate() { diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index f94053e3..fb71bea2 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -21,10 +21,7 @@ class BloodMonthlyPage extends StatelessWidget { final List timeSeriesData; final BloodSugarViewMode bloodSugarViewMode; - - const BloodMonthlyPage( - {Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) - : super(key: key); + const BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); @override Widget build(BuildContext context) { @@ -39,9 +36,7 @@ class BloodMonthlyPage extends StatelessWidget { color: Colors.white, child: MonthLineChartCurved( title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty - ? [TimeSeriesSales3(0, 0.0)] - : timeSeriesData, + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : timeSeriesData, indexes: timeSeriesData.length ~/ 5.5, )), SizedBox( @@ -60,17 +55,16 @@ class BloodMonthlyPage extends StatelessWidget { timeSeriesData.isEmpty ? Container( child: Center( - child: Texts( - TranslationBase.of(context).noDataAvailable), + child: Texts(TranslationBase.of(context).noDataAvailable), ), ) : Table( border: TableBorder.symmetric( - inside: - BorderSide(width: 2.0, color: Colors.grey[300]), + inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), children: fullData(context, projectViewModel), ), + SizedBox(height: 80) ], ), ) @@ -79,8 +73,7 @@ class BloodMonthlyPage extends StatelessWidget { ); } - List fullData( - BuildContext context, ProjectViewModel projectViewModel) { + List fullData(BuildContext context, ProjectViewModel projectViewModel) { List tableRow = []; tableRow.add( TableRow( @@ -90,12 +83,8 @@ class BloodMonthlyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -141,12 +130,8 @@ class BloodMonthlyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 0b6bf607..85cdf47d 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -27,46 +27,47 @@ class BloodYearPage extends StatelessWidget { return AppScaffold( // baseViewModel: bloodSugarViewMode, body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - width: double.maxFinite, - color: Colors.white, - child: LineChartCurved( - title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, - indexes: timeSeriesData.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: [ - timeSeriesData.isEmpty - ? Container( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + width: double.maxFinite, + color: Colors.white, + child: LineChartCurved( + title: '${TranslationBase.of(context).bloodSugar}', + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, + indexes: timeSeriesData.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: [ + timeSeriesData.isEmpty + ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - :Table( + : Table( border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), children: fullData(context, projectViewModel), ), - ], - ), - ) + SizedBox(height: 80) ], ), + ) + ], + ), ); } 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 29989e53..ddac174e 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 @@ -13,6 +13,7 @@ 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:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:charts_flutter/flutter.dart' as charts; import 'package:hexcolor/hexcolor.dart'; @@ -26,8 +27,7 @@ class BloodSugarHomePage extends StatefulWidget { _BloodSugarHomePageState createState() => _BloodSugarHomePageState(); } -class _BloodSugarHomePageState extends State - with SingleTickerProviderStateMixin { +class _BloodSugarHomePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -47,38 +47,17 @@ class _BloodSugarHomePageState extends State return BaseView( onModelReady: (model) => model.getBloodSugar(), builder: (_, model, w) => AppScaffold( - appBarIcons: [IconButton( - icon: Icon(Icons.email), - color: Colors.white, - onPressed: () { - 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); - }); - }, - ), - ); - }, - ),], - isShowAppBar: true, + showNewAppBar: true, + isShowDecPage: true, + showNewAppBarTitle: true, + baseViewModel: model, appBarTitle: TranslationBase.of(context).bloodSugar, // baseViewModel: model, body: Scaffold( extendBodyBehindAppBar: true, - appBar: TabBarWidget(tabController: _tabController,), + appBar: TabBarWidget( + tabController: _tabController, + ), body: Column( children: [ Expanded( @@ -93,7 +72,8 @@ class _BloodSugarHomePageState extends State ), BloodMonthlyPage( timeSeriesData: model.monthTimeSeriesData, - diabtecPatientResult: model.monthDiabtecPatientResult, bloodSugarViewMode: model, + diabtecPatientResult: model.monthDiabtecPatientResult, + bloodSugarViewMode: model, ), BloodYearPage( timeSeriesData: model.yearTimeSeriesData, @@ -107,13 +87,17 @@ class _BloodSugarHomePageState extends State ), floatingActionButton: InkWell( onTap: () { - Navigator.push(context, FadePage(page: AddBloodSugarPage(bloodSugarViewMode: model,))); + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + bloodSugarViewMode: model, + ))); }, child: Container( width: 55, height: 55, - decoration: BoxDecoration( - shape: BoxShape.circle, color:Theme.of(context).primaryColor), + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), child: Center( child: Icon( Icons.add, @@ -122,6 +106,39 @@ class _BloodSugarHomePageState 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: () { + 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], + ), + ), ), ), ); 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 8bc6788c..677ccd66 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 @@ -20,66 +20,61 @@ class BloodSugarWeeklyPage extends StatelessWidget { final BloodSugarViewMode bloodSugarViewMode; final List timeSeriesData; - BloodSugarWeeklyPage( - {Key key, - this.diabtecPatientResult, - this.bloodSugarViewMode, - this.timeSeriesData}) - : super(key: key); + BloodSugarWeeklyPage({Key key, this.diabtecPatientResult, this.bloodSugarViewMode, this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( // baseViewModel: bloodSugarViewMode, - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: LineChartCurved( - title: '${TranslationBase.of(context).bloodSugar}', - timeSeries: timeSeriesData.isEmpty?[TimeSeriesSales2(DateTime.now(),0.0)]:timeSeriesData, - indexes: timeSeriesData.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: [ - timeSeriesData.isEmpty - ? Container( + body: ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: LineChartCurved( + title: '${TranslationBase.of(context).bloodSugar}', + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, + indexes: timeSeriesData.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: [ + timeSeriesData.isEmpty + ? Container( child: Center( child: Texts(TranslationBase.of(context).noDataAvailable), ), ) - :Table( + : Table( border: TableBorder.symmetric( inside: BorderSide(width: 2.0, color: Colors.grey[300]), ), children: fullData(context, projectViewModel, bloodSugarViewMode), ), - ], - ), + SizedBox( + height: 80, ) ], ), + ) + ], + ), ); } - List fullData( - BuildContext context, - ProjectViewModel projectViewModel, - BloodSugarViewMode bloodSugarViewMode) { + List fullData(BuildContext context, ProjectViewModel projectViewModel, BloodSugarViewMode bloodSugarViewMode) { List tableRow = []; tableRow.add( TableRow( @@ -89,12 +84,8 @@ class BloodSugarWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), ), ), child: Center( @@ -154,12 +145,8 @@ class BloodSugarWeeklyPage extends StatelessWidget { 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), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + topRight: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), ), ), child: Center( @@ -186,7 +173,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { color: Colors.white, child: Center( child: Texts( - '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart):DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', + '${projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(diabtec.dateChart) : DateUtil.getMonthDayYearDateFormatted(diabtec.dateChart)} ', textAlign: TextAlign.center, fontSize: 12, ), diff --git a/lib/pages/medical/my_trackers/my_trackers.dart b/lib/pages/medical/my_trackers/my_trackers.dart index b9450fd5..970ba3d7 100644 --- a/lib/pages/medical/my_trackers/my_trackers.dart +++ b/lib/pages/medical/my_trackers/my_trackers.dart @@ -5,7 +5,7 @@ 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:diplomaticquarterapp/pages/ContactUs/widgets/card_common_contat.dart'; import 'Weight/WeightHomePage.dart'; import 'blood_pressure/BloodPressureHomePage.dart'; import 'blood_suger/blood_sugar_home_page.dart'; @@ -15,110 +15,136 @@ class MyTrackers extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).myTracker, - isShowAppBar: true, + showNewAppBar: true, isShowDecPage: true, + showNewAppBarTitle: true, + backgroundColor: Color(0xffF8F8F8), description: TranslationBase.of(context).infoTrackers, imagesInfo: [ ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-trackers/ar/0.png') ], body: SingleChildScrollView( child: Container( - padding: EdgeInsets.all(12), - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.all(21), + shrinkWrap: true, children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: BloodSugarHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/blood-suger.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).bloodSugar), - ], - ), - ), - ), - ), - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: BloodPressureHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/blood-pressure.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).bloodPressure), - ], - ), - ), - ), - ), - ], + CardCommonContact( + image: 'assets/tracker/blood-suger.png', + text: TranslationBase.of(context).bloodSugar, + subText: "", + type: 3, ), - Row( - //mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: WeightHomePage())), - child: Container( - margin: EdgeInsets.all(5), - width: MediaQuery.of(context).size.width * 0.35, - height: MediaQuery.of(context).size.width * 0.35, - decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/tracker/weight.png', - width: 60.0, - ), - SizedBox( - height: 15, - ), - Texts(TranslationBase.of(context).weight), - ], - ), - ), - ), - ), - Expanded( - child: Container(), - ), - ], + CardCommonContact( + image: 'assets/tracker/blood-pressure.png', + text: TranslationBase.of(context).bloodPressure, + subText: "", + type: 4, ), - ], - ), - ), + CardCommonContact( + image: 'assets/tracker/weight.png', + text: TranslationBase.of(context).weight, + subText: "", + type: 5, + ) + ]) + + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Expanded( + // child: InkWell( + // onTap: () => Navigator.push(context, FadePage(page: BloodSugarHomePage())), + // child: Container( + // margin: EdgeInsets.all(5), + // width: MediaQuery.of(context).size.width * 0.35, + // height: MediaQuery.of(context).size.width * 0.35, + // decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // 'assets/tracker/blood-suger.png', + // width: 60.0, + // ), + // SizedBox( + // height: 15, + // ), + // Texts(TranslationBase.of(context).bloodSugar), + // ], + // ), + // ), + // ), + // ), + // Expanded( + // child: InkWell( + // onTap: () => Navigator.push(context, FadePage(page: BloodPressureHomePage())), + // child: Container( + // margin: EdgeInsets.all(5), + // width: MediaQuery.of(context).size.width * 0.35, + // height: MediaQuery.of(context).size.width * 0.35, + // decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // 'assets/tracker/blood-pressure.png', + // width: 60.0, + // ), + // SizedBox( + // height: 15, + // ), + // Texts(TranslationBase.of(context).bloodPressure), + // ], + // ), + // ), + // ), + // ), + // ], + // ), + // Row( + // //mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // Expanded( + // child: InkWell( + // onTap: () => Navigator.push(context, FadePage(page: WeightHomePage())), + // child: Container( + // margin: EdgeInsets.all(5), + // width: MediaQuery.of(context).size.width * 0.35, + // height: MediaQuery.of(context).size.width * 0.35, + // decoration: BoxDecoration(shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), color: Colors.white), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // 'assets/tracker/weight.png', + // width: 60.0, + // ), + // SizedBox( + // height: 15, + // ), + // Texts(TranslationBase.of(context).weight), + // ], + // ), + // ), + // ), + // ), + // Expanded( + // child: Container(), + // ), + // ], + // ), + // ], + // ), + ), ), ); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 63bfed02..5e30c803 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -725,10 +725,8 @@ class TranslationBase { String get km => localizedValues['km'][locale.languageCode]; String get km_ => localizedValues['km_'][locale.languageCode]; - String get patientHealthSummaryReport => - localizedValues['PatientHealthSummaryReport'][locale.languageCode]; - String get toViewTheTermsAndConditions => - localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; + String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; String get clickHere => localizedValues['ClickHere'][locale.languageCode]; String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; @@ -1069,14 +1067,10 @@ class TranslationBase { String get consumed => localizedValues['consumed'][locale.languageCode]; String get transferred => localizedValues['transferred'][locale.languageCode]; - String get checkBeneficiary => - localizedValues['checkBeneficiary'][locale.languageCode]; - String get beneficiaryName => - localizedValues['beneficiaryName'][locale.languageCode]; - String get accountActivation => - localizedValues['accountActivation'][locale.languageCode]; - String get nonRecommended => - localizedValues['nonRecommended'][locale.languageCode]; + String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode]; + String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode]; + String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; + String get nonRecommended => localizedValues['nonRecommended'][locale.languageCode]; String get lakumTransfer => localizedValues['lakumTransfer'][locale.languageCode]; @@ -2142,26 +2136,20 @@ class TranslationBase { String get aboutApp => localizedValues["about-app"][locale.languageCode]; String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode]; String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; - String get totalTimeNeeded => - localizedValues["total-time-needed"][locale.languageCode]; - String get infoEye => - localizedValues["info-eye"][locale.languageCode]; - String get infoVaccines => - localizedValues["info-vaccines"][locale.languageCode]; - String get infoTrackers => - localizedValues["info-trackers"][locale.languageCode]; - String get infoHealthData => - localizedValues["info-health-data"][locale.languageCode]; - String get infoAskDoc => - localizedValues["info-ask-doc"][locale.languageCode]; - String get infoAutoWifi => - localizedValues["info-auto-wifi"][locale.languageCode]; - String get autoWifi => - localizedValues["auto-wifi"][locale.languageCode]; - String get childVaccineInfo => - localizedValues["child-vaccine-info"][locale.languageCode]; - String get h2oInfo => - localizedValues["h2o-info"][locale.languageCode]; + String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode]; + String get infoEye => localizedValues["info-eye"][locale.languageCode]; + String get infoVaccines => localizedValues["info-vaccines"][locale.languageCode]; + String get infoTrackers => localizedValues["info-trackers"][locale.languageCode]; + String get infoHealthData => localizedValues["info-health-data"][locale.languageCode]; + String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode]; + String get infoAutoWifi => localizedValues["info-auto-wifi"][locale.languageCode]; + String get autoWifi => localizedValues["auto-wifi"][locale.languageCode]; + String get childVaccineInfo => localizedValues["child-vaccine-info"][locale.languageCode]; + String get h2oInfo => localizedValues["h2o-info"][locale.languageCode]; + String get sysdias => localizedValues["sys/dias"][locale.languageCode]; + String get arm => localizedValues["arm"][locale.languageCode]; + String get removeMeasure => localizedValues["remove-measure"][locale.languageCode]; + String get selectArm => localizedValues["select-arm"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dialogs/RadioStringDialog.dart b/lib/widgets/dialogs/RadioStringDialog.dart index 912c3a72..af8eae5f 100644 --- a/lib/widgets/dialogs/RadioStringDialog.dart +++ b/lib/widgets/dialogs/RadioStringDialog.dart @@ -10,12 +10,7 @@ class RadioStringDialog extends StatefulWidget { final String title; String selectedValue; - RadioStringDialog( - {Key key, - this.radioList, - this.onValueSelected, - this.selectedValue, - this.title}); + RadioStringDialog({Key key, this.radioList, this.onValueSelected, this.selectedValue, this.title}); @override _RadioStringDialogState createState() => _RadioStringDialogState(); @@ -40,9 +35,7 @@ class _RadioStringDialogState extends State { ))), children: [ Container( - height: widget.radioList.length > 3 - ? MediaQuery.of(context).size.height * 0.6 - : null, + height: widget.radioList.length > 3 ? MediaQuery.of(context).size.height * 0.6 : null, child: SingleChildScrollView( child: Column( children: [ @@ -52,9 +45,9 @@ class _RadioStringDialogState extends State { (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 2, - ), + // SizedBox( + // height: 2, + // ), Row( children: [ Expanded( @@ -62,12 +55,14 @@ class _RadioStringDialogState extends State { child: InkWell( onTap: () { setState(() { - widget.selectedValue = - widget.radioList[index]; + widget.selectedValue = widget.radioList[index]; }); }, child: ListTile( - title: Text(widget.radioList[index]), + title: Texts( + widget.radioList[index], + fontSize: 14, + ), leading: Radio( value: widget.radioList[index], groupValue: widget.selectedValue, @@ -83,66 +78,61 @@ class _RadioStringDialogState extends State { ) ], ), - SizedBox( - height: 5.0, - ), ], ), ), SizedBox( height: 5.0, ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context) - .cancel - .toUpperCase(), - color: Colors.red, - ), - ), - ), - ), + ], + ), + ), + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, ), ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedValue); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), - ), - ), - ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedValue); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, ), - ], - ) - ], + ), + ), + ), ), - ), + ], ) ], ); diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 01957fbb..f0338afc 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -113,12 +113,13 @@ class _FloatingSearchButton extends State with TickerProvi void initState() { controller = AnimationController(vsync: this, duration: Duration(seconds: 1)); offset = Tween(begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)).animate(controller); + if (IS_VOICE_COMMAND_CLOSED == true) { controller.reverse(from: -1); } else { if (mounted) { //Future.delayed(const Duration(seconds: 2), () { - + _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; setState(() { if (IS_TEXT_COMPLETED) { isAnimationEnable = false; @@ -222,13 +223,14 @@ class _FloatingSearchButton extends State with TickerProvi } startVoiceSearch() async { - _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); + _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + if (available) { speech.listen( onResult: resultListener, - // listenMode: ListenMode.confirmation, - localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + //listenMode: ListenMode.confirmation, + localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', ); } else { print("The user has denied the use of speech recognition."); From 831780555c94b64c4878b5fcef52556234567371 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Sun, 12 Sep 2021 15:07:54 +0300 Subject: [PATCH 2/4] CMC 1.0 --- lib/config/localized_values.dart | 1 + .../NewCMC/new_cmc_page.dart | 26 +- .../NewCMC/new_cmc_step_one_page.dart | 301 ++++++--------- .../ComprehensiveMedicalCheckup/cmc_page.dart | 135 +++---- .../orders_log_details_page.dart | 361 +++++++++--------- .../HomeHealthCare/StepsWidget.dart | 191 +++------ .../fragments/home_page_fragment2.dart | 9 +- .../landing/widgets/logged_slider_view.dart | 8 +- lib/uitl/translations_delegate_base.dart | 42 ++ lib/widgets/drawer/app_drawer_widget.dart | 2 +- 10 files changed, 463 insertions(+), 613 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 03e966ff..5ab7d487 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1175,6 +1175,7 @@ const Map localizedValues = { "generalHealth": {"en": "General Health", "ar": "صحة عامة"}, "womanHealth": {"en": "Women's Health", "ar": "صحة المرأة"}, "bmi": {"en": "BMI", "ar": "الكتلة"}, + "bloodType": {"en": "Blood Type:", "ar": ":فصيلة الدم"}, "calc-health": {"en": "Calculators", "ar": "الصحية"}, "calories": {"en": "Calories", "ar": "سعرات"}, "bmr": {"en": "BMR", "ar": "معدل الأيض القاعدي"}, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index f314a9bf..5ce0cc3e 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -122,16 +122,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - if (widget.model.cmcAllOrderDetail.length == 0) - Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, - ), - ), + Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), @@ -376,12 +367,15 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { ), ), ) - : NewCMCStepOnePage( - changePageViewIndex: changePageViewIndex, - cMCInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), + : Container( + color: Colors.red, + child: NewCMCStepOnePage( + changePageViewIndex: changePageViewIndex, + cMCInsertPresOrderRequestModel: + cMCInsertPresOrderRequestModel, + model: widget.model, + ), + ), NewCMCStepTowPage( longitude: _longitude, latitude: _latitude, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index c07b8345..5bf65ef4 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -3,8 +3,10 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/Comprehens import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -17,12 +19,7 @@ class NewCMCStepOnePage extends StatefulWidget { final Function changePageViewIndex; final CMCViewModel model; - const NewCMCStepOnePage( - {Key key, - this.cMCInsertPresOrderRequestModel, - this.model, - this.changePageViewIndex}) - : super(key: key); + const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key); @override _NewCMCStepOnePageState createState() => _NewCMCStepOnePageState(); @@ -44,175 +41,107 @@ class _NewCMCStepOnePageState extends State { body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.all(12), + margin: EdgeInsets.only(left: 12, right: 12), child: Center( child: Column( children: [ - FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Texts( - TranslationBase.of(context).selectService, - textAlign: TextAlign.center, - ), - Column( - children: - widget.model.cmcAllServicesList.map((service) { - return Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - child: Column( - children: [ - Row( - children: [ - Radio( - value: service.serviceID, - activeColor: Colors.red[800], - onChanged: (newValue) async { - PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: service.price, - serviceID: service.serviceID - .toString(), - selectedServiceName: - service.description, - selectedServiceNameAR: - service.descriptionN, - recordID: 1, - totalPrice: - service.totalPrice, - vAT: service.vAT); - setState(() { - widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = [ - patientERCMCInsertServicesList - ]; - }); - CMCGetItemsRequestModel - cMCGetItemsRequestModel = - new CMCGetItemsRequestModel( - checkupType: newValue); - await widget.model.getCheckupItems( - cMCGetItemsRequestModel: - cMCGetItemsRequestModel); - }, - groupValue: widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList - .length > - 0 - ? int.parse(widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList[ - 0] - .serviceID) - : 1), - Expanded( - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Texts( - projectViewModel.isArabic - ? service.descriptionN - : service.description, - fontSize: 15, - ), - ), - ), - ], + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Row( + children: [ + Radio( + value: widget.model.cmcAllServicesList[index].serviceID, + activeColor: Colors.red[800], + onChanged: (newValue) async { + PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( + price: widget.model.cmcAllServicesList[index].price, + serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(), + selectedServiceName: widget.model.cmcAllServicesList[index].description, + selectedServiceNameAR: widget.model.cmcAllServicesList[index].descriptionN, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[index].totalPrice, + vAT: widget.model.cmcAllServicesList[index].vAT); + setState(() { + widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; + }); + CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue); + await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel); + }, + groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0 + ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID) + : 1), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 10, + right: 10, + top: 20, + bottom: 20, + ), + child: Text( + projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].descriptionN : widget.model.cmcAllServicesList[index].description, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - ], + ), ), - ); - }).toList(), - ), - ], - ), - ), - SizedBox( - height: 30, - ), - Container( - color: Theme.of(context).primaryColor, - width: double.infinity, - child: Column( - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 10, left: 10), - child: Texts( - TranslationBase.of(context).coveredService, - fontWeight: FontWeight.bold, - )) + ), ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: widget.model.checkupItems.map((item) { - return Center( - child: FractionallySizedBox( - widthFactor: 1, - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 5, top: 5), - decoration: BoxDecoration( - border: BorderDirectional( - bottom: BorderSide( - style: BorderStyle.solid, - width: 0.5, - color: Colors.grey)), - //borderRadius: , - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only( - right: 10, left: 10), - child: Texts(item.itemName, - fontSize: 15, - fontWeight: FontWeight.bold), - ), - ], - ), - ), - SizedBox( - height: 12, - ), - ], - ), + ); + }, + separatorBuilder: (context, index) { + return mDivider(Colors.grey); + }, + itemCount: widget.model.cmcAllServicesList.length), + Card( + shape: cardRadius(12), + elevation: 4, + child: Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 12,right: 12,top: 12), + child: Text( + TranslationBase.of(context).coveredService, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, + ), + ), + ), + ListView.separated( + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.all(12.0), + child: Text( + widget.model.checkupItems[index].itemName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), ), ); - }).toList()), - ], + }, + separatorBuilder: (context, index) { + return mDivider(Colors.grey); + }, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: widget.model.checkupItems.length, + ), + ], + ), ), - ) + ), + mHeight(MediaQuery.of(context).size.height * 0.12), ], ), ), @@ -221,44 +150,30 @@ class _NewCMCStepOnePageState extends State { bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, + color: CustomColors.appBackgroudGreyColor, child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: TranslationBase.of(context).next, textColor: Theme.of(context).backgroundColor, - color: Colors.grey[800], + color: CustomColors.accentColor, onTap: () async { - if (widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList.length != - 0 || - widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList == - null) { + if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) { int index = widget.model.cmcAllServicesList.length; - PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: widget - .model.cmcAllServicesList[index - 1].price, - serviceID: widget - .model.cmcAllServicesList[index - 1].serviceID - .toString(), - selectedServiceName: widget.model - .cmcAllServicesList[index - 1].description, - selectedServiceNameAR: widget.model - .cmcAllServicesList[index - 1].descriptionN, - recordID: 1, - totalPrice: widget - .model.cmcAllServicesList[index - 1].totalPrice, - vAT: - widget.model.cmcAllServicesList[index - 1].vAT); + PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( + price: widget.model.cmcAllServicesList[index - 1].price, + serviceID: widget.model.cmcAllServicesList[index - 1].serviceID.toString(), + selectedServiceName: widget.model.cmcAllServicesList[index - 1].description, + selectedServiceNameAR: widget.model.cmcAllServicesList[index - 1].descriptionN, + recordID: 1, + totalPrice: widget.model.cmcAllServicesList[index - 1].totalPrice, + vAT: widget.model.cmcAllServicesList[index - 1].vAT); - widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = [ - patientERCMCInsertServicesList - ]; + widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; await widget.model.getCustomerInfo(); if (widget.model.state == ViewState.ErrorLocal) { Utils.showErrorToast(); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index d7ebad6c..65b2d878 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -42,93 +43,69 @@ class _CMCPageState extends State with SingleTickerProviderStateMixin { isShowAppBar: true, description: TranslationBase.of(context).infoCMC, imagesInfo: [ - ImagesInfo( - imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', - imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png') + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), ], appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: PreferredSize( - preferredSize: Size.fromHeight(65.0), - child: Stack( - children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context).primaryColor.withOpacity(0.8), - height: 70.0, - ), - ), - ), - Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Container( + height: 60.0, + width: double.infinity, + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: CustomColors.accentColor, + labelColor: Colors.black, + labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Center( + child: Text( + TranslationBase.of(context).comprehensiveMedicalCheckup, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.34, ), - color: Theme.of(context).primaryColor), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts(TranslationBase.of(context) - .comprehensiveMedicalCheckup), - ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: - Texts(TranslationBase.of(context).orderLog), - ), - ), - ], ), ), - ), - ), - ], - ), - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - NewCMCPage( - model: model, + Center( + child: Text( + TranslationBase.of(context).orderLog, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.34, + ), + ), ), - OrdersLogDetailsPage( - model: model, - ) ], ), - ) - ], - ), + ), + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + NewCMCPage( + model: model, + ), + OrdersLogDetailsPage( + model: model, + ) + ], + ), + ) + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index ec686e70..b98d97c9 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -22,26 +22,20 @@ class OrdersLogDetailsPage extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - CMCViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(CMCViewModel 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.updateCmcPresOrder(updatePresOrderRequestModel); - if(model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); + 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.getCmcAllPresOrders(); } }, @@ -49,205 +43,210 @@ class OrdersLogDetailsPage extends StatelessWidget { } return AppScaffold( - isShowAppBar: false, - baseViewModel: model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.94, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 50, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: model.cmcAllPresOrders.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, - ), + isShowAppBar: false, + baseViewModel: model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: model.cmcAllPresOrders.map((order) { + return Container( + width: double.infinity, + margin: EdgeInsets.only(top: 12), + clipBehavior: Clip.antiAlias, + 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: 6, + ), + Container( + width: double.infinity, + padding: EdgeInsets.only(left: 15, bottom: 15, top: 8, 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, + ), + // borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).requestID, + style: TextStyle( fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - SizedBox( - height: 4, + ), + SizedBox( + height: 4, + ), + Text( + order.iD.toString(), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - 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, - ), + ), + 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, + ), + // borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).OrderStatus, + style: TextStyle( fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - SizedBox( - height: 4, + ), + SizedBox( + height: 4, + ), + Text( + projectViewModel.isArabic ? order.descriptionN : order.description, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - 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, - ), + ), + 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, + ), + // borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).pickupDate, + style: TextStyle( fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - SizedBox( - height: 4, + ), + SizedBox( + height: 4, + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(order.createdOn)), - 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, - ), + ), + Container( + width: double.infinity, + clipBehavior: Clip.antiAlias, + padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: (order.status == 1 || order.status == 2) ? Colors.grey : Colors.transparent, + width: (order.status == 1 || order.status == 2) ? 1.0 : 0, ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation, - bold: false, + ), + // borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderLocation, + style: TextStyle( fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic?order. - projectDescription.toString() : - order - .projectDescriptionN - .toString(), - fontSize: 22, + ), + SizedBox( + height: 4, + ), + Text( + !projectViewModel.isArabic ? order.projectDescription.toString() : order.projectDescriptionN.toString(), + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + letterSpacing: -0.45, ), - ], - ), - ), - SizedBox( - height: 12, + ), + ], ), - if (order.status == 1 ||order.status == 2 ) + ), + (order.status == 1 || order.status == 2) + ? SizedBox( + height: 12, + ) + : Container(), + if (order.status == 1 || order.status == 2) Center( child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, + width: MediaQuery.of(context).size.width * 0.85, child: SecondaryButton( label: TranslationBase.of(context).cancel.toUpperCase(), onTap: () { - showConfirmMessage(model, - order); - } - , + showConfirmMessage(model, order); + }, color: Colors.red[800], disabled: false, - textColor: Theme - .of(context) - .backgroundColor), + textColor: Theme.of(context).backgroundColor), ), ), - SizedBox( - height: 22, - ), - ], - ), - ); + (order.status == 1 || order.status == 2) + ? SizedBox( + height: 12, + ) + : SizedBox( + height: 2, + ), + ], + ), + ); }).toList()) ], ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart index 370544d0..4ea50670 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/StepsWidget.dart @@ -1,4 +1,6 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -12,170 +14,87 @@ class StepsWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return !projectViewModel.isArabic? Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.42, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), - child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], - ), - ), - ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3) : null, - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : Colors.white, - ), - child: Center( - child: Texts( - '3', - color: index == 2 ? Colors.white : Colors.grey[800], - ), - ), - ), - ), - ), + return showRow(); + } - ], - ):Stack( - children: [ - Container( - height: 50, - width: MediaQuery.of(context).size.width, - color: Colors.transparent, - child: Center( - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( + Widget showRow() { + return Container( + width: double.infinity, + child: Row( + children: [ + InkWell( onTap: () => changeCurrentTab(0), child: Container( width: 35, height: 35, - decoration: BoxDecoration( - border: index > 0 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 0 ? Colors.grey[800] : index > 0 ?Colors.green: Colors.white, - ), + decoration: containerColorRadiusBorder( + index == 0 + ? CustomColors.accentColor + : index > 0 + ? Colors.green[700] + : Colors.white, + 2000, + Colors.black), child: Center( - child: Texts( - '1', - color: index == 0 ? Colors.white : index > 0 ?Colors.white: Colors.grey[800], + child: Text( + "1", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - Positioned( - top: 10, - left: MediaQuery.of(context).size.width * 0.42, - child: InkWell( + Expanded(child: mDivider(Colors.grey)), + InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Container( width: 35, height: 35, - decoration: BoxDecoration( - border: index > 1 ? null:Border.all(color: Colors.black,width: 0.75), - shape: BoxShape.circle, - color: index == 1 ? Colors.grey[800] : index > 1 ?Colors.green: Colors.white, - ), + decoration: containerColorRadiusBorder( + index == 1 + ? CustomColors.accentColor + : index > 1 + ? Colors.green[700] + : Colors.white, + 2000, + Colors.black), child: Center( - child: Texts( - '2', - color: index == 1? Colors.white : index > 1 ?Colors.white: Colors.grey[800], + child: Text( + "2", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => index == 2 ?changeCurrentTab(3) : null, + Expanded(child: mDivider(Colors.grey)), + InkWell( + onTap: () => index == 2 ? changeCurrentTab(3) : null, child: Container( width: 35, height: 35, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(color: Colors.black,width: 0.75), - color: index == 2 ? Colors.grey[800] : Colors.white, + decoration: containerColorRadiusBorder( + index == 2 ? CustomColors.accentColor : Colors.white, + 2000, + Colors.black, ), child: Center( - child: Texts( - '3', - color: index == 2 ? Colors.white : Colors.grey[800], + child: Text( + "3", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), ), ), ), - ), - ], + ], + ), ); } } diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 68bf2ffe..c0a28d8f 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -81,10 +81,11 @@ class _HomePageFragment2State extends State { navigateTo(context, MedicalProfilePageNew()); }, child: LoggedSliderView( - projectViewModel, - new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, - "", bannerColor[0].darkColor, bannerColor[0].lightColor), - widget.model), + projectViewModel, + new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, + "", bannerColor[0].darkColor, bannerColor[0].lightColor), + widget.model, + ), ), ), ) diff --git a/lib/pages/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart index 958135d0..067cb148 100644 --- a/lib/pages/landing/widgets/logged_slider_view.dart +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -138,7 +138,7 @@ class LoggedSliderView extends StatelessWidget { padding: const EdgeInsets.only(left: 20, right: 20), child: Row( children: [ - Expanded( + Expanded( flex: 3, child: Row( children: [ SvgPicture.asset( @@ -158,7 +158,7 @@ class LoggedSliderView extends StatelessWidget { SizedBox( width: 3, ), - Expanded( + Expanded( flex: 3, child: Row( children: [ SvgPicture.asset( @@ -175,6 +175,7 @@ class LoggedSliderView extends StatelessWidget { width: 3, ), Expanded( + flex: 3, child: Row( children: [ SvgPicture.asset( @@ -183,10 +184,11 @@ class LoggedSliderView extends StatelessWidget { height: 12, ), mWidth(6), - Texts('${TranslationBase.of(context).bloodD}: ${model.booldType}', color: Colors.white, fontSize: 10) + Texts('${TranslationBase.of(context).bloodType1} ${model.booldType}', color: Colors.white, fontSize: 10) ], ), ), + mFlex(1), ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b7efad42..3cb7ce31 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -20,6 +20,8 @@ class TranslationBase { String get dashboardScreenToolbarTitle => localizedValues['dashboardScreenToolbarTitle'][locale.languageCode]; + String get bloodType1 => localizedValues['bloodType'][locale.languageCode]; + String get settings => localizedValues['settings'][locale.languageCode]; String get language => localizedValues['language'][locale.languageCode]; @@ -93,18 +95,25 @@ class TranslationBase { String get patientShare => localizedValues['patientShare'][locale.languageCode]; String get neverWait => localizedValues['neverWait'][locale.languageCode]; + String get patientShareWithTax => localizedValues['patientShareWithTax'][locale.languageCode]; String get reminderTitle => localizedValues['reminderTitle'][locale.languageCode]; + String get confirmAppo => localizedValues['confirmAppo'][locale.languageCode]; String get appointmentCalendar => localizedValues['appointmentCalendar'][locale.languageCode]; + String get appointmentSuccess => localizedValues['appointmentSuccess'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode]; + String get pressAgain => localizedValues['pressAgain'][locale.languageCode]; + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; + String get doctorFilter => localizedValues['doctorFilter'][locale.languageCode]; + String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; @@ -724,11 +733,15 @@ class TranslationBase { String get sentRequest => localizedValues['sent-requests'][locale.languageCode]; String get km => localizedValues['km'][locale.languageCode]; + String get km_ => localizedValues['km_'][locale.languageCode]; + String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; + String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + String get clickHere => localizedValues['ClickHere'][locale.languageCode]; String get iAgreeToTheTermsAndConditions => localizedValues['IAgreeToTheTermsAndConditions'][locale.languageCode]; @@ -802,7 +815,9 @@ class TranslationBase { String get country => localizedValues['country'][locale.languageCode]; String get ok => localizedValues['Ok'][locale.languageCode]; + String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode]; + String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; @@ -1069,12 +1084,16 @@ class TranslationBase { String get consumed => localizedValues['consumed'][locale.languageCode]; String get transferred => localizedValues['transferred'][locale.languageCode]; + String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode]; + String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode]; + String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; + String get nonRecommended => localizedValues['nonRecommended'][locale.languageCode]; @@ -2094,7 +2113,9 @@ class TranslationBase { String get upComingPayOption => localizedValues["upcoming-pay-options"][locale.languageCode]; String get pleaseAcceptTerms => localizedValues["please-accept-terms"][locale.languageCode]; + String get pleaseSelectAllQuestionToContinue => localizedValues["pleaseSelectAllQuestionToContinue"][locale.languageCode]; + String get type => localizedValues["type"][locale.languageCode]; String get eReferralInfo => localizedValues["info-ereferral"][locale.languageCode]; @@ -2132,36 +2153,57 @@ class TranslationBase { String get noThankyou => localizedValues["no-thankyou"][locale.languageCode]; String get visitClinic => localizedValues["visit-clinic"][locale.languageCode]; + String get generateCovidCertificate => localizedValues["generate-covid-certificate"][locale.languageCode]; + String get isReportOutsideKsa => localizedValues["is-report-outside-ksa"][locale.languageCode]; + String get passportNumber => localizedValues["passport-number"][locale.languageCode]; + String get enterPassportNumber => localizedValues["enter-passport-number"][locale.languageCode]; + String get validPassportNumber => localizedValues["valid-passport-number"][locale.languageCode]; + String get continuePlan => localizedValues["continue-plan"][locale.languageCode]; + String get dentalProcedureList => localizedValues["dental-procedure-list"][locale.languageCode]; + String get aboutApp => localizedValues["about-app"][locale.languageCode]; + String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode]; + String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; + String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode]; + String get infoEye => localizedValues["info-eye"][locale.languageCode]; + String get infoVaccines => localizedValues["info-vaccines"][locale.languageCode]; + String get infoTrackers => localizedValues["info-trackers"][locale.languageCode]; + String get infoHealthData => localizedValues["info-health-data"][locale.languageCode]; + String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode]; + String get infoAutoWifi => localizedValues["info-auto-wifi"][locale.languageCode]; + String get autoWifi => localizedValues["auto-wifi"][locale.languageCode]; + String get childVaccineInfo => localizedValues["child-vaccine-info"][locale.languageCode]; + String get h2oInfo => localizedValues["h2o-info"][locale.languageCode]; + String get askDocEmpty => localizedValues["ask-doc-empty"][locale.languageCode]; } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index f5e633ec..6fa0a4ec 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -163,7 +163,7 @@ class _AppDrawerState extends State { } else { projectProvider.changeLanguage('ar'); } - var themeNotifier = Provider.of(context, listen: false); + var themeNotifier = Provider.of(context, listen: true); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); }, ), From 169aafa26b8e526f5dee1edb1c3a22b7cc6f1ad7 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 12 Sep 2021 15:36:10 +0300 Subject: [PATCH 3/4] hmc services design fixed --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 4 +- .../NewHomeHealthCare/location_page.dart | 187 +++--- .../new_Home_health_care_step_one_page.dart | 182 +++--- .../new_Home_health_care_step_three_page.dart | 90 ++- .../new_Home_health_care_step_tow_page.dart | 341 +++++++---- .../new_home_health_care_page.dart | 555 +++++++++--------- .../HomeHealthCare/home_health_care_page.dart | 90 +-- lib/uitl/utils.dart | 6 + 9 files changed, 771 insertions(+), 688 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d7bb78b7..dd9711b3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ 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/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f11315da..55feaf4f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1225,7 +1225,7 @@ const Map localizedValues = { "en": "Choose one of the following symptoms to show the right doctors or choose a consultation to show all", "ar": "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل" }, - "continue": {"en": "CONTINUE", "ar": "إستمرار"}, + "continue": {"en": "Continue", "ar": "إستمرار"}, "skip": {"en": "SKIP", "ar": "تخطى"}, "calorieCalcDesc": { "en": "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ", @@ -1461,5 +1461,5 @@ const Map localizedValues = { "sys/dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, "arm": {"en": "Arm", "ar": "الذراع"}, "remove-measure": {"en": "Remove this measure", "ar": "إزالة هذا القياس؟"}, - "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"} + "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"}, }; diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index 0e013ebf..58d66b3d 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -21,132 +21,115 @@ class LocationPage extends StatefulWidget { final double longitude; final dynamic model; - const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) - : super(key: key); + const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); @override - _LocationPageState createState() => - _LocationPageState(); + _LocationPageState createState() => _LocationPageState(); } -class _LocationPageState - extends State { +class _LocationPageState extends State { double latitude = 0; double longitude = 0; bool showCurrentLocation = false; @override void initState() { - latitude = widget.latitude; longitude = widget.longitude; - if(latitude == 0.0 && longitude == 0.0) { + if (latitude == 0.0 && longitude == 0.0) { showCurrentLocation = true; } super.initState(); } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) {}, builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).addAddress, - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - AddNewAddressRequestModel - addNewAddressRequestModel = - new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: - selectedPlace.formattedAddress, - address2: selectedPlace - .formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); - - selectedPlace.addressComponents.forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel.customer - .addresses[0].country = e.longName; - } - if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer - .addresses[0].zipPostalCode = - e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel.customer - .addresses[0].city = - e.longName; - } - }); + appBarTitle: TranslationBase.of(context).addAddress, + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); - await model.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: "Address Added Successfully"); - } - Navigator.of(context).pop(addNewAddressRequestModel); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), - ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(addNewAddressRequestModel); + }, + label: TranslationBase.of(context).addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + )); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 86ee791b..442a5530 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -5,43 +5,33 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; class NewHomeHealthCareStepOnePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepOnePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.model, - this.changePageViewIndex}) - : super(key: key); + const NewHomeHealthCareStepOnePage({Key key, this.patientERInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key); @override - _NewHomeHealthCareStepOnePageState createState() => - _NewHomeHealthCareStepOnePageState(); + _NewHomeHealthCareStepOnePageState createState() => _NewHomeHealthCareStepOnePageState(); } -class _NewHomeHealthCareStepOnePageState - extends State { +class _NewHomeHealthCareStepOnePageState extends State { PickResult _result; @override void initState() { - if (widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList == - null) - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList = []; + if (widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList == null) widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = []; super.initState(); } @@ -55,30 +45,25 @@ class _NewHomeHealthCareStepOnePageState body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), + margin: EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05), child: Center( child: FractionallySizedBox( widthFactor: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 12, - ), - Texts( - TranslationBase.of(context).selectHomeHealthCareServices, - textAlign: TextAlign.center, - ), + // Texts( + // TranslationBase.of(context).selectHomeHealthCareServices, + // textAlign: TextAlign.center, + // ), Column( children: widget.model.hhcAllServicesList.map((service) { return Container( - margin: EdgeInsets.only(top: 15), + margin: EdgeInsets.only(top: 10), decoration: BoxDecoration( - border: Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), + // border: Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + ), child: Column( children: [ Row( @@ -86,21 +71,14 @@ class _NewHomeHealthCareStepOnePageState Checkbox( value: isServiceSelected(service.serviceID), activeColor: Colors.red[800], + tristate: false, onChanged: (bool newValue) { setState(() { - if (!isServiceSelected( - service.serviceID)) - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .add(PatientERHHCInsertServicesList( - recordID: widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length, - serviceID: service.serviceID, - serviceName: - service.description)); + if (!isServiceSelected(service.serviceID)) + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList( + recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, + serviceID: service.serviceID, + serviceName: service.description)); else removeSelected(service.serviceID); // widget.patientERInsertPresOrderRequestModel @@ -109,22 +87,27 @@ class _NewHomeHealthCareStepOnePageState }), Expanded( child: Padding( - padding: const EdgeInsets.all(20.0), + padding: const EdgeInsets.only(left: 0.0, right: 10), child: Texts( - projectViewModel.isArabic - ? service.descriptionN - : service.description, + projectViewModel.isArabic ? service.descriptionN : service.description.toLowerCase()?.capitalize(), fontSize: 15, + style: 'letterSpacing: -0.48', + fontWeight: FontWeight.bold, ), ), ), ], ), + Divider( + height: 1, + color: Colors.grey, + ) ], ), ); }).toList(), - ) + ), + SizedBox(height: 70) ], ), ), @@ -132,44 +115,73 @@ class _NewHomeHealthCareStepOnePageState ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).next, - disabled: this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length == - 0 || - widget.model.state == ViewState.BusyLocal, - color: Colors.grey[800], - loading: widget.model.state == ViewState.BusyLocal, - onTap: () async { - await widget.model.getCustomerInfo(); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(); - } else { - widget.changePageViewIndex(1); - } - }, - textColor: Theme.of(context).backgroundColor), - ), - ], + 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 { + await widget.model.getCustomerInfo(); + if (widget.model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(); + } else { + Navigator.push( + context, + FadePage( + page: NewHomeHealthCareStepTowPage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ), + ); + + // widget.changePageViewIndex(1); + } + }, + label: TranslationBase.of(context).next, + backgroundColor: Colors.red[900], + disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal, + loading: widget.model.state == ViewState.BusyLocal, ), ), + + // Container( + // height: MediaQuery.of(context).size.height * 0.10, + // width: double.infinity, + // child: Column( + // children: [ + // Container( + // width: MediaQuery.of(context).size.width * 0.9, + // child: SecondaryButton( + // label: TranslationBase.of(context).next, + // disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal, + // color: Colors.grey[800], + // loading: widget.model.state == ViewState.BusyLocal, + // onTap: () async { + // await widget.model.getCustomerInfo(); + // if (widget.model.state == ViewState.ErrorLocal) { + // Utils.showErrorToast(); + // } else { + // Navigator.push( + // context, + // FadePage( + // page: NewHomeHealthCareStepTowPage(), + // ), + // ); + + // // widget.changePageViewIndex(1); + // } + // }, + // textColor: Theme.of(context).backgroundColor), + // ), + // ], + // ), + // ), ); } isServiceSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) { return true; } @@ -178,15 +190,11 @@ class _NewHomeHealthCareStepOnePageState removeSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) setState(() { - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .remove(patientERHHCInsertServicesList.first); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList.first); }); } } 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 5e9bd04d..c4729257 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 @@ -12,26 +12,21 @@ import 'package:flutter/cupertino.dart'; 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'; class NewHomeHealthCareStepThreePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - NewHomeHealthCareStepThreePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}); + NewHomeHealthCareStepThreePage({Key key, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}); @override - _NewHomeHealthCareStepThreePageState createState() => - _NewHomeHealthCareStepThreePageState(); + _NewHomeHealthCareStepThreePageState createState() => _NewHomeHealthCareStepThreePageState(); } -class _NewHomeHealthCareStepThreePageState - extends State { +class _NewHomeHealthCareStepThreePageState extends State { Completer _controller = Completer(); static CameraPosition _kGooglePlex = CameraPosition( @@ -42,22 +37,17 @@ class _NewHomeHealthCareStepThreePageState @override void initState() { - if (widget.patientERInsertPresOrderRequestModel.latitude != null) { markers.clear(); markers.add( Marker( markerId: MarkerId( - widget.patientERInsertPresOrderRequestModel.latitude.hashCode - .toString(), + widget.patientERInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng( - widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude), + target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude), zoom: 14.4746, ); } @@ -71,6 +61,9 @@ class _NewHomeHealthCareStepThreePageState return AppScaffold( isShowDecPage: false, baseViewModel: widget.model, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( @@ -79,19 +72,20 @@ class _NewHomeHealthCareStepThreePageState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderDetails, fontWeight: FontWeight.bold,), - SizedBox( - height: 12, - ), Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), + padding: EdgeInsets.all(20), + child: Texts( + TranslationBase.of(context).RRTSummary, + fontWeight: FontWeight.bold, + fontSize: 22, + )), + Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), padding: EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderLocation, fontWeight: FontWeight.bold), + Texts(TranslationBase.of(context).selectedLocation, fontWeight: FontWeight.bold), SizedBox( height: 12, ), @@ -112,29 +106,32 @@ class _NewHomeHealthCareStepThreePageState SizedBox( height: 12, ), - Texts(TranslationBase.of(context).selectedService + " : ", fontWeight: FontWeight.bold), + Texts(TranslationBase.of(context).selectedService), ...List.generate( - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length, + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // ), SizedBox( height: 5, ), - Texts( - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList[index] - .serviceName, - fontSize: 15, - bold: true, - ), + Row( + children: [ + Texts( + (index + 1).toString() + '. ', + fontSize: 15, + ), + Texts( + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList[index].serviceName, + fontSize: 15, + ), + ], + ) ], ), ), @@ -158,15 +155,12 @@ class _NewHomeHealthCareStepThreePageState width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: TranslationBase.of(context).confirm, - disabled: widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length == - 0, + disabled: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0, color: Colors.grey[800], onTap: () async { - await widget.model.insertPresPresOrder( - order: widget.patientERInsertPresOrderRequestModel); + await widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel); if (widget.model.state != ViewState.ErrorLocal) { - widget.changePageViewIndex(0); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: NewHomeHealthCarePage)); } }, textColor: Theme.of(context).backgroundColor), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 1b96cdc8..590733c1 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -1,9 +1,12 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -14,41 +17,37 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; - +import 'dart:async'; import 'location_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart'; class NewHomeHealthCareStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; final double longitude; - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepTowPage( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}) - : super(key: key); + const NewHomeHealthCareStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}) : super(key: key); @override - _NewHomeHealthCareStepTowPageState createState() => - _NewHomeHealthCareStepTowPageState(); + _NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState(); } -class _NewHomeHealthCareStepTowPageState - extends State { +class _NewHomeHealthCareStepTowPageState extends State { double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; bool showCurrentLocation = false; + Completer _controller = Completer(); - + static CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + final Set markers = new Set(); @override void initState() { if (widget.patientERInsertPresOrderRequestModel.latitude == null) { @@ -57,30 +56,38 @@ class _NewHomeHealthCareStepTowPageState latitude = widget.patientERInsertPresOrderRequestModel.latitude; longitude = widget.patientERInsertPresOrderRequestModel.longitude; } - + markers.clear(); + markers.add( + Marker( + markerId: MarkerId( + latitude.hashCode.toString(), + ), + position: LatLng(latitude, longitude)), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); super.initState(); } setLatitudeAndLongitude({bool isSetState = false, String latLong}) { - if (latLong == null){ - if(widget.model.addressesList.isEmpty) { + if (latLong == null) { + if (widget.model.addressesList.isEmpty) { setState(() { showCurrentLocation = true; }); } else { - latLong = widget.model.addressesList[widget.model.addressesList - .length - 1].latLong; + latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong; } - } - if(!showCurrentLocation) { + if (!showCurrentLocation) { List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); } - } @override @@ -88,121 +95,211 @@ class _NewHomeHealthCareStepTowPageState ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: Stack( children: [ - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, + Container( + margin: EdgeInsets.only(top: 120), + child: GoogleMap( + mapType: MapType.normal, + markers: markers, + initialCameraPosition: _kGooglePlex, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, + ) + + // PlacePicker( + // apiKey: GOOGLE_API_KEY, + // enableMyLocationButton: true, + // automaticallyImplyAppBarLeading: false, + // autocompleteOnTrailingWhitespace: false, + // selectInitialPosition: true, + // autocompleteLanguage: projectViewModel.currentLanguage, + // enableMapTypeButton: false, + // searchForInitialValue: true, + + // // onPlacePicked: (PickResult result) { + // // print(result.adrAddress); + // // widget.changePageViewIndex(3); + // // }, + // selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + // print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + // return isSearchBarFocused + // ? Container() + // : FloatingCard( + // bottomPosition: 0.0, + // leftPosition: 0.0, + // rightPosition: 0.0, + // width: 500, + // borderRadius: BorderRadius.circular(12.0), + // child: Container( + // margin: EdgeInsets.all(12), + // child: Column( + // children: [ + // // SecondaryButton( + // // color: Colors.grey[800], + // // textColor: Colors.white, + // // onTap: () { + // // Navigator.push( + // // context, + // // FadePage( + // // page: LocationPage( + // // latitude: latitude, + // // longitude: longitude, + // // ), + // // ), + // // ); + // // }, + // // label: TranslationBase.of(context).addNewAddress, + // // ), + // // SizedBox( + // // height: 10, + // // ), + // SecondaryButton( + // color: Colors.red[800], + // textColor: Colors.white, + // onTap: () { + // setState(() { + // widget.patientERInsertPresOrderRequestModel.latitude = selectedPlace.geometry.location.lat; + // widget.patientERInsertPresOrderRequestModel.longitude = selectedPlace.geometry.location.lng; + // }); + // widget.changePageViewIndex(3); + // }, + // label: TranslationBase.of(context).confirm, + // ), + // ], + // ), + // ), + // ); + // }, + // initialPosition: LatLng(latitude, longitude), + // useCurrentLocation: showCurrentLocation, + // ) - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: - LocationPage( - latitude: latitude, - longitude: longitude, - ), - ), - ); - }, - label: TranslationBase.of(context).addNewAddress, + ), + if (widget.model.addressesList.isNotEmpty) + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Container( + height: 60, + width: MediaQuery.of(context).size.width * .9, + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + child: DropdownButtonHideUnderline( + child: ButtonTheme( + alignedDropdown: true, + child: DropdownButton( + hint: Text( + widget.model.addressesList[0].address1, + style: TextStyle(color: CustomColors.black, fontSize: 14), ), - SizedBox(height: 10,), - SecondaryButton( - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientERInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.patientERInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, + iconEnabledColor: CustomColors.grey2, + style: TextStyle(color: CustomColors.black, fontSize: 14), + dropdownColor: CustomColors.white, + value: _selectedAddress, + items: widget.model.addressesList.map((AddressInfo value) { + return DropdownMenuItem( + value: value, + child: new AutoSizeText( + value.address1, + ), + ); + }).toList(), + onChanged: (r) {}, + underline: Container( + height: 0, ), - ], + ), ), ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - if(widget.model.addressesList.isNotEmpty) - Container( - child: InkWell( - onTap: () => - confirmSelectLocationDialog(widget.model.addressesList), - child: Container( - padding: EdgeInsets.all(10), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded(child: Texts(getAddressName(), fontSize: 14,),), - Icon(Icons.arrow_drop_down) - ], + ) + ]), + Positioned( + top: 80, + left: 20, + child: Row( + children: [ + Icon( + Icons.add_circle_rounded, + ), + InkWell( + child: Texts( + TranslationBase.of(context).addNewAddress, + fontWeight: FontWeight.bold, + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + ), + ], + )) + // Container( + // child: InkWell( + // onTap: () => confirmSelectLocationDialog(widget.model.addressesList), + // child: Container( + // padding: EdgeInsets.all(10), + // width: double.infinity, + // // height: 65, + // decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Expanded( + // child: Texts( + // getAddressName(), + // fontSize: 14, + // ), + // ), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // height: 56, + // width: double.infinity, + // color: Theme.of(context).scaffoldBackgroundColor, + // ) + ], + ), + 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 { + Navigator.push( + context, + FadePage( + page: NewHomeHealthCareStepThreePage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, ), ), - ), - height: 56, width: double.infinity, color: Theme - .of(context) - .scaffoldBackgroundColor, - - ) - ], + ); + }, + label: TranslationBase.of(context).continues, + backgroundColor: Colors.red[900], + ), ), ); } - void confirmSelectLocationDialog(List addresses) { showDialog( context: context, child: SelectLocationDialog( addresses: addresses, - selectedAddress: _selectedAddress - , + selectedAddress: _selectedAddress, onValueSelected: (value) { setLatitudeAndLongitude(latLong: value.latLong); setState(() { 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 ab564cb7..fa9188db 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 @@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import '../StepsWidget.dart'; import 'new_Home_health_care_step_one_page.dart'; @@ -28,15 +28,13 @@ class NewHomeHealthCarePage extends StatefulWidget { _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState(); } -class _NewHomeHealthCarePageState extends State - with TickerProviderStateMixin { +class _NewHomeHealthCarePageState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 1; double _latitude; double _longitude; - PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = - new PatientERInsertPresOrderRequestModel(); + PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); @override void initState() { @@ -64,32 +62,23 @@ class _NewHomeHealthCarePageState extends State setState(() { _currentIndex = tab; }); - _controller.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + _controller.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override Widget build(BuildContext context) { - void showConfirmMessage(HomeHealthCareViewModel model, - GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) { showDialog( context: context, child: ConfirmCancelOrderDialog( model: model, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, - editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); 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(); } @@ -106,15 +95,15 @@ class _NewHomeHealthCarePageState extends State height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: _changeCurrentTab, - ), - ), + // Container( + // margin: EdgeInsets.only( + // left: MediaQuery.of(context).size.width * 0.05, + // right: MediaQuery.of(context).size.width * 0.05), + // child: StepsWidget( + // index: _currentIndex, + // changeCurrentTab: _changeCurrentTab, + // ), + // ), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), @@ -130,248 +119,284 @@ class _NewHomeHealthCarePageState extends State ? FractionallySizedBox( widthFactor: 0.9, child: SingleChildScrollView( - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - 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: - Theme.of(context).primaryColor), - 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), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget.model.pendingOrder - .descriptionN - : widget.model.pendingOrder - .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: - Theme.of(context).primaryColor), - 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: 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: 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, - ), - ], - ), - ), - ), - ) + 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, + 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, + children: [ + Texts( + TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + bold: false, + fontSize: 18, + ), + Texts( + TranslationBase.of(context).serviceName, + fontSize: 12, + ), + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic + ? widget.model.hhcAllOrderDetail[index].descriptionN + : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 14, + ), + ), + ), + ], + ), + 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, + // ), + // ], + // ), + // ) + // ], + // ), + //), + ) : NewHomeHealthCareStepOnePage( changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, model: widget.model, ), - NewHomeHealthCareStepTowPage( - latitude: _latitude, - longitude: _longitude, - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ), - NewHomeHealthCareStepThreePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ) + // NewHomeHealthCareStepTowPage( + // latitude: _latitude, + // longitude: _longitude, + // changePageViewIndex: _changeCurrentTab, + // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + // model: widget.model, + // ), + // NewHomeHealthCareStepThreePage( + // changePageViewIndex: _changeCurrentTab, + // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + // model: widget.model, + // ) ], ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 001ecbb1..a5979ca2 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -17,8 +17,7 @@ class HomeHealthCarePage extends StatefulWidget { _HomeHealthCarePageState createState() => _HomeHealthCarePageState(); } -class _HomeHealthCarePageState extends State - with SingleTickerProviderStateMixin { +class _HomeHealthCarePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -43,75 +42,46 @@ class _HomeHealthCarePageState extends State isShowAppBar: true, description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, - imagesInfo: [ - ImagesInfo( - imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', - imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png') - ], + showNewAppBar: true, + showNewAppBarTitle: true, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')], body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( preferredSize: Size.fromHeight(65.0), child: Stack( children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Theme.of(context).primaryColor), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).homeHealthCare, - color: Colors.black, - ), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts( + TranslationBase.of(context).homeHealthCare, + color: Colors.black, ), ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).orderLog, - color: Colors.black, - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts( + TranslationBase.of(context).orderLog, + color: Colors.black, ), ), - ], - ), + ), + ], ), ), ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index c9d3f548..d620bcd4 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -931,6 +931,12 @@ String labelFrom({@required String className}) { return result; } +extension StringExtension on String { + String capitalize() { + return this.splitMapJoin(RegExp(r'\w+'), onMatch: (m) => '${m.group(0)}'.substring(0, 1).toUpperCase() + '${m.group(0)}'.substring(1).toLowerCase(), onNonMatch: (n) => ' '); + } +} + /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( GestureDetector(onTap: () { From b3f3558eacd594f8df410bfae7267e6ff9636efe Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Sun, 12 Sep 2021 16:44:48 +0300 Subject: [PATCH 4/4] CMC 1.2 --- lib/uitl/translations_delegate_base.dart | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 3bc2e7ea..474b13cd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -736,11 +736,9 @@ class TranslationBase { String get km_ => localizedValues['km_'][locale.languageCode]; - String get patientHealthSummaryReport => - localizedValues['PatientHealthSummaryReport'][locale.languageCode]; + String get patientHealthSummaryReport => localizedValues['PatientHealthSummaryReport'][locale.languageCode]; - String get toViewTheTermsAndConditions => - localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; + String get toViewTheTermsAndConditions => localizedValues['ToViewTheTermsAndConditions'][locale.languageCode]; String get clickHere => localizedValues['ClickHere'][locale.languageCode]; @@ -1085,17 +1083,13 @@ class TranslationBase { String get transferred => localizedValues['transferred'][locale.languageCode]; - String get checkBeneficiary => - localizedValues['checkBeneficiary'][locale.languageCode]; + String get checkBeneficiary => localizedValues['checkBeneficiary'][locale.languageCode]; - String get beneficiaryName => - localizedValues['beneficiaryName'][locale.languageCode]; + String get beneficiaryName => localizedValues['beneficiaryName'][locale.languageCode]; - String get accountActivation => - localizedValues['accountActivation'][locale.languageCode]; + String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; - String get nonRecommended => - localizedValues['nonRecommended'][locale.languageCode]; + String get nonRecommended => localizedValues['nonRecommended'][locale.languageCode]; String get lakumTransfer => localizedValues['lakumTransfer'][locale.languageCode]; @@ -2173,24 +2167,41 @@ class TranslationBase { String get aboutPointsLength => localizedValues["about-points"]['length'][locale.languageCode]; String get timeNeeded => localizedValues["time-needed"][locale.languageCode]; + String get totalTimeNeeded => localizedValues["total-time-needed"][locale.languageCode]; + String get infoEye => localizedValues["info-eye"][locale.languageCode]; + String get infoVaccines => localizedValues["info-vaccines"][locale.languageCode]; + String get infoTrackers => localizedValues["info-trackers"][locale.languageCode]; + String get infoHealthData => localizedValues["info-health-data"][locale.languageCode]; + String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode]; + String get infoAutoWifi => localizedValues["info-auto-wifi"][locale.languageCode]; + String get autoWifi => localizedValues["auto-wifi"][locale.languageCode]; + String get childVaccineInfo => localizedValues["child-vaccine-info"][locale.languageCode]; + String get h2oInfo => localizedValues["h2o-info"][locale.languageCode]; + String get sysdias => localizedValues["sys/dias"][locale.languageCode]; + String get arm => localizedValues["arm"][locale.languageCode]; + String get removeMeasure => localizedValues["remove-measure"][locale.languageCode]; + String get selectArm => localizedValues["select-arm"][locale.languageCode]; String get askDocEmpty => localizedValues["ask-doc-empty"][locale.languageCode]; + String get onlineClinics => localizedValues["online-clinics"][locale.languageCode]; + String get offlineClinics => localizedValues["offline-clinics"][locale.languageCode]; + String get clinicSchedule => localizedValues["clinic-schedule"][locale.languageCode]; }