diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 21ff8632..4e085e46 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -421,7 +421,7 @@ const Map localizedValues = { "country": {"en": "Country", "ar": "دولة"}, "Ok": {"en": "Ok", "ar": "موافق"}, "averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"}, - "waitingTime": {"en": "Waiting Time:", "ar": "وقت الانتظار:"}, + "waitingTime": {"en": "Expected waiting time:", "ar": "وقت الانتظار المتوقع:"}, "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires in", "ar": "تنتهي صلاحية رمز التحقق في"}, @@ -1290,7 +1290,7 @@ const Map localizedValues = { "pay-options": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "livecare-service": {"en": "LiveCare Service", "ar": "خدمة لايف كير"}, "livecare-service-desc": {"en": "is to obtain medical advice with a specialist doctor Via a video call", "ar": "هي الحصول على استشارة طبية مع طبيب مختص عن طريق اتصال فيديو"}, - "why-livecare": {"en": "WHY LIVECARE", "ar": "لماذا خدمة اللايف كير"}, + "why-livecare": {"en": "Why LiveCare?", "ar": "?لماذا خدمة اللايف كير"}, "livecare-point-1": {"en": "No need to wait you will get Medical consultation immediately via Video call", "ar": "لا داعي للانتظار سوف تحصل على الاستشارة الطبية فورا عن طريق مكالمة الفيديو"}, "doc-virtual-appo-ins4": {"en": "The doctor will see your medical file", "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كامل"}, "doc-virtual-appo-ins5": {"en": "Free prescription delivery service", "ar": "خدمة توصيل الادوية مجانا"}, @@ -1298,7 +1298,7 @@ const Map localizedValues = { "en": "** The service is included with some insurance companies according to the terms and conditions with our best wishes for health and wellness", "ar": "** الخدمة مشمولة لدى بعض شركات التامين على حسب الشروط والاحكام مع تمنياتنا لكم بدوام الصحة والعافية" }, - "livecare-option-1": {"en": "Get Medical consultation immediately", "ar": "الحصول على الاستشارة فورا"}, + "livecare-option-1": {"en": "Get consultation immediately", "ar": "الحصول على الاستشارة فورا"}, "livecare-option-2": {"en": "Instant video call", "ar": "اتصال فيديو فوري"}, "livecare-option-3": {"en": "Book Appointment", "ar": "حجز موعد"}, "livecare-option-4": {"en": "Schedule video call", "ar": "اتصال فيديو مجدول"}, diff --git a/lib/core/service/blood/blood_details_servies.dart b/lib/core/service/blood/blood_details_servies.dart index 644d96d9..589b8dda 100644 --- a/lib/core/service/blood/blood_details_servies.dart +++ b/lib/core/service/blood/blood_details_servies.dart @@ -22,7 +22,7 @@ class BloodDetailsService extends BaseService{ BloodModelList.add(List_BloodGroupDetailsModel.fromJson(vital)); }); }, onFailure: (String error, int statusCode) { - hasError = true; + // hasError = true; super.error = error; }, body: body); } diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index ce9f35fa..a92b6e16 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -32,7 +32,7 @@ class MyBalanceViewModel extends BaseViewModel { _bloodDonationService.CitiesModelList; BloodDetailsService _bloodDetailsService = locator(); - List get BloodDetailsModelList => + List get bloodDetailsModelList => _bloodDetailsService .BloodModelList; //_bloodDonationService.CitiesModelList; @@ -52,6 +52,9 @@ class MyBalanceViewModel extends BaseViewModel { PatientInfoAndMobileNumber get patientInfoAndMobileNumber => _myBalanceService.patientInfoAndMobileNumber; + List get bloodModelList => + _bloodDetailsService.BloodModelList; + String get logInTokenID => _myBalanceService.logInTokenID; String get verificationCode => _myBalanceService.verificationCode; diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index f2f87712..e64ab20c 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -228,4 +228,4 @@ class OrderPreviewViewModel extends BaseViewModel { } } -enum PaymentOption { meda, sadad, visa, mastercard, installments } +enum PaymentOption { meda, sadad, visa, mastercard, installments, applepay } diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 86a320e6..420ec1fa 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -14,7 +14,7 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); - if(prescriptionsList.isNotEmpty){ + if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); if (_prescriptionService.hasError) { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index a5c89c17..d3c7f970 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -51,36 +51,6 @@ class OrdersLogDetailsPage extends StatelessWidget { }, )); return; - - // todo 'sikander' remove useless code - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - Future.delayed(new Duration(milliseconds: 300)).then((value) async { - GifLoaderDialogUtils.showMyDialog(context); - await model.updateCmcPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - GifLoaderDialogUtils.hideDialog(context); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - await model.getCmcAllPresOrders(); - GifLoaderDialogUtils.hideDialog(context); - } - }); - // await model.updateCmcPresOrder(updatePresOrderRequestModel); - // if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - // } else { - // AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - // await model.getCmcAllPresOrders(); - // } - }, - ), - ); } return AppScaffold( 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 b401a127..f8e377b7 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 @@ -95,7 +95,7 @@ class _NewHomeHealthCareStepOnePageState extends State with Tick ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.pendingOrder != null - ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ - (Container( - decoration: BoxDecoration( - color: Color(0xffCC9B14), - borderRadius: BorderRadius.all( - Radius.circular(10.0), + return PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + widget.model.pendingOrder != null + ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ + (Container( + decoration: BoxDecoration( + color: Color(0xffCC9B14), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + // decoration: containerColorRadiusLeft(Colors.white, 12), + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.pendingOrder.statusText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), + Column( + children: [ + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 13, + bold: false, + ), + ), + ) + ], + ) + ], + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, child: Container( - // decoration: containerColorRadiusLeft(Colors.white, 12), - margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), - padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: Colors.white, + color: Color(0xffD02127), border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.only( - bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - ), + borderRadius: BorderRadius.circular(10), ), - // clipBehavior: Clip.antiAlias, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.model.pendingOrder.statusText, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 6), - Text( - '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).serviceName + ": ", - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), - ), - Column( - children: [ - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - child: Texts( - projectViewModel.isArabic - ? widget.model.hhcAllOrderDetail[index].descriptionN - : widget.model.hhcAllOrderDetail[index].description.capitalize(), - fontSize: 13, - bold: false, - ), - ), - ) - ], - ) - ], - ) - ], - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 12), - if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) - InkWell( - onTap: () { - showConfirmMessage(widget.model, widget.model.pendingOrder); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), - decoration: BoxDecoration( - color: Color(0xffD02127), - border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.circular(10), - ), - child: Text( - TranslationBase.of(context).cancel_nocaps, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), - ), - ), - ), - ], - ), - ], + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - )) - ]) - - // FractionallySizedBox( - // widthFactor: 0.9, - // child: SingleChildScrollView( - // child: Container( - // // margin: EdgeInsets.all(10), - // child: Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 12, right: 12, top: 12), - // child: Card( - // shape: cardRadius(12), - // elevation: 2, - // margin: EdgeInsets.zero, - // color: Color(0xffcd9e1b), - // clipBehavior: Clip.antiAlias, - // child: Container( - // // decoration: containerColorRadiusLeft(Colors.white, 12), - // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), - // padding: EdgeInsets.all(12), - // // color: Colors.white, - // decoration: BoxDecoration( - // shape: BoxShape.rectangle, - // color: Colors.white, - // borderRadius: BorderRadius.only( - // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // ), - // ), - // // clipBehavior: Clip.antiAlias, - // child: Row( - // children: [ - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // 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, - // ), - // Texts( - // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - // fontWeight: FontWeight.w600, - // fontSize: 18, - // ), - // Texts( - // TranslationBase.of(context).serviceName, - // fontSize: 12, - // fontWeight: FontWeight.w600, - // ), - // ...List.generate( - // widget.model.hhcAllOrderDetail.length, - // (index) => Container( - // child: Texts( - // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), - // fontSize: 13, - // bold: false, - // ), - // ), - // ), - // ], - // )), - // Column( - // children: [ - // Texts( - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - // fontSize: 14, - // ), - // mHeight(8), - // // SecondaryButton( - // // onTap: () { - // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - // // }, - // // label: TranslationBase.of(context).cancel, - // // color: Colors.red[900], - // // small: true, - // // ) - // ], - // ), - // ], - // ))), - // )))) - : NewHomeHealthCareStepOnePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, - model: widget.model, - ), - ], + ), + ], + ), + ], + ), ), - ), - ], - ), - ), - ), - ), + )) + ]) + + // FractionallySizedBox( + // widthFactor: 0.9, + // child: SingleChildScrollView( + // child: Container( + // // margin: EdgeInsets.all(10), + // child: Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 12, right: 12, top: 12), + // child: Card( + // shape: cardRadius(12), + // elevation: 2, + // margin: EdgeInsets.zero, + // color: Color(0xffcd9e1b), + // clipBehavior: Clip.antiAlias, + // child: Container( + // // decoration: containerColorRadiusLeft(Colors.white, 12), + // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), + // padding: EdgeInsets.all(12), + // // color: Colors.white, + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // ), + // ), + // // clipBehavior: Clip.antiAlias, + // child: Row( + // children: [ + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // 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, + // ), + // Texts( + // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + // fontWeight: FontWeight.w600, + // fontSize: 18, + // ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // fontWeight: FontWeight.w600, + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // child: Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + // fontSize: 13, + // bold: false, + // ), + // ), + // ), + // ], + // )), + // Column( + // children: [ + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 14, + // ), + // mHeight(8), + // // SecondaryButton( + // // onTap: () { + // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // // }, + // // label: TranslationBase.of(context).cancel, + // // color: Colors.red[900], + // // small: true, + // // ) + // ], + // ), + // ], + // ))), + // )))) + : NewHomeHealthCareStepOnePage( + changePageViewIndex: _changeCurrentTab, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ], ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index 22ffd68f..e14d07e8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -45,27 +45,6 @@ class OrdersLogDetailsPage extends StatelessWidget { ), ); return; - - // todo 'sikander' remove useless code - - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - model.setState(ViewState.Busy); - await model.updateHHCPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - await model.getHHCAllPresOrders(); - // await model.getHHCAllServices(); - } - }, - ), - ); } return AppScaffold( diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart deleted file mode 100644 index 0197873b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class ConfirmAddAmountDialog extends StatefulWidget { -// final int amount; -// final String unit; -// final H2OViewModel model; -// -// ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); -// -// @override -// _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); -// } -// -// class _ConfirmAddAmountDialogState extends State { -// @override -// void initState() { -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), -// titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// textAlign: TextAlign.center, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// children: [ -// Divider(), -// Center( -// child: Texts( -// "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?", -// textAlign: TextAlign.center, -// color: Colors.grey, -// ), -// ), -// SizedBox( -// height: 16.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// 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: () async { -// InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); -// await widget.model.insertUserActivity(insertUserActivityRequestModel); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok.toUpperCase(), -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart deleted file mode 100644 index 4d02c27b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class SelectAmountDialog extends StatefulWidget { -// final Function(AmountModel) onValueSelected; -// AmountModel selectedAmount; -// -// SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount}); -// -// @override -// _SelectAmountDialogState createState() => _SelectAmountDialogState(); -// } -// -// class _SelectAmountDialogState extends State { -// List searchAmount = [ -// AmountModel(name: "l", nameAr: "لتر", value: 1), -// AmountModel(name: "ml", nameAr: "مم لتر", value: 2), -// ]; -// @override -// void initState() { -// super.initState(); -// widget.selectedAmount = widget.selectedAmount ?? searchAmount[0]; -// getLanguage(); -// } -// -// String languageID = "en"; -// -// void getLanguage() async { -// languageID = await sharedPref.getString(APP_LANGUAGE); -// setState(() {}); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// children: [ -// Column( -// children: [ -// Texts( -// TranslationBase.of(context).preferredunit, -// fontSize: 20, -// ), -// Divider(), -// ...List.generate( -// searchAmount.length, -// (index) => Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// SizedBox( -// height: 2, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// setState(() { -// widget.selectedAmount = searchAmount[index]; -// }); -// }, -// child: ListTile( -// title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name), -// leading: Radio( -// value: searchAmount[index], -// groupValue: widget.selectedAmount, -// activeColor: Colors.red[800], -// onChanged: (value) { -// setState(() { -// widget.selectedAmount = value; -// }); -// }, -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// ], -// ), -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// 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.selectedAmount); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok, -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ) -// ], -// ) -// ], -// ); -// } -// } -// -// class AmountModel { -// String name; -// String nameAr; -// int value; -// -// AmountModel({this.name, this.nameAr, this.value}); -// -// AmountModel.fromJson(Map json) { -// name = json['name']; -// nameAr = json['nameAr']; -// value = json['value']; -// } -// -// Map toJson() { -// final Map data = new Map(); -// data['name'] = this.name; -// data['nameAr'] = this.nameAr; -// data['value'] = this.value; -// return data; -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart deleted file mode 100644 index 641f6df7..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'Dialog/select_amount_dialog.dart'; - -// todo 'sikander' remove useless code -// class AddCustomAmount extends StatefulWidget { -// final H2OViewModel model; -// final Function changePageViewIndex; -// -// const AddCustomAmount({Key key, this.model, this.changePageViewIndex}) -// : super(key: key); -// -// @override -// _AddCustomAmountState createState() => _AddCustomAmountState(); -// } -// -// class _AddCustomAmountState extends State { -// TextEditingController _nameTextController = TextEditingController(); -// AmountModel selectedAmount; -// -// @override -// void initState() { -// setState(() { -// _nameTextController.text = "0"; -// }); -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return AppScaffold( -// isShowAppBar: true, -// appBarTitle:TranslationBase.of(context).customLabel, -// 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: 12, -// ), -// NewTextFields( -// hintText: TranslationBase.of(context).h2oAmountOfWater, -// // type: "Number", -// controller: _nameTextController, -// ), -// SizedBox( -// height: 12, -// ), -// InkWell( -// onTap: () => confirmAmountTypeDialog(), -// 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(getAmountName()), -// Icon(Icons.arrow_drop_down) -// ], -// ), -// ), -// ), -// SizedBox( -// height: 12, -// ), -// SecondaryButton( -// textColor: Colors.white, -// label: TranslationBase.of(context).ok, -// onTap: () async { -// Navigator.of(context).pop(); -// showConfirmMessage (int.parse(_nameTextController.text), widget.model); -// }, -// // loading: model.state == ViewState.BusyLocal, -// disabled: _nameTextController.text.isEmpty || selectedAmount == null), -// SizedBox( -// height: 12, -// ), -// ], -// ), -// ), -// ), -// ), -// ), -// ); -// } -// -// -// void confirmAmountTypeDialog() { -// showDialog( -// context: context, -// child: SelectAmountDialog( -// selectedAmount: selectedAmount, -// onValueSelected: (value) { -// setState(() { -// selectedAmount = value; -// }); -// }, -// ), -// ); -// } -// -// -// String getAmountName() { -// if (selectedAmount != null) -// return selectedAmount.name; -// else -// return TranslationBase.of(context).selectUnit; -// } -// -// -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index 904f4183..edc82034 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -126,7 +126,7 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget(inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController)), + inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController).withBorderedContainer, SizedBox(height: 16), Text( TranslationBase.of(context).preferredunit, @@ -210,80 +210,77 @@ class _H2oSettingState extends State { }, _weightPopupList), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { - showModalBottomSheet( - context: context, - builder: (context) { - return Container( - height: 250, - padding: EdgeInsets.all(8), - child: Column(children: [ - Container( - height: 40, - alignment: Alignment.centerRight, - child: Row(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - onTap: () => Navigator.pop(context), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).cancel), - ), + CommonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: 250, + padding: EdgeInsets.all(8), + child: Column(children: [ + Container( + height: 40, + alignment: Alignment.centerRight, + child: Row(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + onTap: () => Navigator.pop(context), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).cancel), ), - SizedBox(width: 8), - InkWell( - onTap: () { - Navigator.pop(context); - setState(() { - _dobDate = _tempDate; - }); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).ok), - ), - ) - ]), - ), - Expanded( - child: Container( - width: MediaQuery.of(context).size.width, - child: CupertinoDatePicker( - initialDateTime: _dobDate, - mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (_date) { - _tempDate = _date; - }, + ), + SizedBox(width: 8), + InkWell( + onTap: () { + Navigator.pop(context); + setState(() { + _dobDate = _tempDate; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).ok), ), + ) + ]), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: CupertinoDatePicker( + initialDateTime: _dobDate, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (_date) { + _tempDate = _date; + }, ), - ) - ]), - ); - }); - }, iconData: Icons.calendar_today), - ), + ), + ) + ]), + ); + }); + }, iconData: Icons.calendar_today) + .withBorderedContainer, SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { - List list = [ - for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), - ]; + CommonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + List list = [ + for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedActiveLevel, - onValueSelected: (index) { - _selectedActiveLevel = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedActiveLevel, + onValueSelected: (index) { + _selectedActiveLevel = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 18), Text( TranslationBase.of(context).reminderLabel, @@ -296,25 +293,23 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { - List list = [ - for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), - ]; + CommonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { + List list = [ + for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedRemindedTime, - onValueSelected: (index) { - _selectedRemindedTime = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedRemindedTime, + onValueSelected: (index) { + _selectedRemindedTime = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, ], ), ), @@ -333,58 +328,6 @@ class _H2oSettingState extends State { ); } - Widget _containerWidget(Widget child) { - return Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: child, - ); - } - - Widget _commonDropDownView(String title, String value, VoidCallback callback, {IconData iconData}) { - return InkWell( - onTap: callback, - child: Row( - children: [ - Expanded( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), - ), - Text( - value, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - ), - ]), - ), - Icon( - iconData ?? Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) - ], - ), - ); - } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { return InkWell( onTap: hasSelection ? () {} : null, @@ -501,81 +444,79 @@ class _H2oSettingState extends State { Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, Function(bool) onUnitTap, _list) { - return _containerWidget( - Row( - children: [ - Expanded( - flex: 3, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, ), - TextField( - controller: _controller, - keyboardType: TextInputType.number, - onChanged: (value) { - double _value = double.parse(value); - if (_value > _maxValue) { - onTextValueChange(_maxValue.toStringAsFixed(0)); - onValueChange(_maxValue); - return; - } else if (_value < _minValue) { - onTextValueChange(_minValue.toStringAsFixed(0)); - onValueChange(_minValue); - return; - } else if (_value >= _minValue && _value <= _maxValue) { - onValueChange(_value); - return; - } - }, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), - ], - style: TextStyle( + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56, ), - decoration: InputDecoration( - isDense: true, - hintText: "0", - hintStyle: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), + ), + ], ), - Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), - Expanded( - flex: 1, - child: PopupMenuButton( - child: _commonDropDownView(TranslationBase.of(context).unit, unitTitle, null), - onSelected: (value) { - onUnitTap(value); - }, - itemBuilder: (context) => _list), - ) - ], - ), - ); + ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; } void _updateUserDetails() async { @@ -627,3 +568,65 @@ class _H2oSettingState extends State { }); } } + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], + ), + ); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index fe385ade..accd6887 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -18,9 +17,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:wave/config.dart'; import 'package:wave/wave.dart'; -import 'Dialog/confirm_add_amount_dialog.dart'; -import 'add_custom_amount.dart'; - class TodayPage extends StatefulWidget { TodayPage({Key key}) : super(key: key); diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart deleted file mode 100644 index 9b876cc1..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'dart:math' as math; - -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../add_custom_amount.dart'; - - -// todo 'sikander' remove useless code - - -// class H20FloatingActionButton extends StatefulWidget { -// const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); -// -// final H2OViewModel model; -// -// @override -// _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); -// } -// -// class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { -// AnimationController _controller; -// @override -// void initState() { -// _controller = new AnimationController( -// vsync: this, -// duration: const Duration(milliseconds: 500), -// ); -// super.initState(); -// } -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog( -// context: context, -// child: ConfirmAddAmountDialog( -// model: model, -// amount: amount, -// ), -// ); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 20, right: 20), -// child: new Column(mainAxisSize: MainAxisSize.min, children: [ -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.end, -// children: [ -// ActionButton( -// controller: _controller, -// text: "600${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(600, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "330${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(330, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "200${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(200, widget.model); -// }, -// ), -// ], -// ), -// ], -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// FloatingActionButton( -// heroTag: null, -// child: new AnimatedBuilder( -// animation: _controller, -// builder: (BuildContext context, Widget child) { -// return new Transform( -// transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), -// alignment: FractionalOffset.center, -// child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), -// ); -// }, -// ), -// onPressed: () { -// if (_controller.isDismissed) { -// _controller.forward(); -// } else { -// _controller.reverse(); -// } -// }, -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// // mini: true, -// child: Text( -// TranslationBase.of(context).custom, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12, color: Colors.grey), -// ), -// onPressed: () { -// Navigator.push( -// context, -// FadePage( -// page: AddCustomAmount( -// model: widget.model, -// ), -// ), -// ); -// }, -// ), -// ), -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// //mini: true, -// child: Text( -// TranslationBase.of(context).undo, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: undoVolume, -// ), -// ), -// ), -// ], -// ), -// ]), -// ); -// } -// -// void undoVolume() async { -// GifLoaderDialogUtils.showMyDialog(context); -// await widget.model.undoUserActivity(); -// GifLoaderDialogUtils.hideDialog(context); -// } -// } -// -// class ActionButton extends StatelessWidget { -// const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) -// : _controller = controller, -// super(key: key); -// -// final AnimationController _controller; -// final String text; -// final Function onTap; -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 4, bottom: 8), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// heroTag: null, -// backgroundColor: Colors.white, -// //mini: true, -// child: Text( -// text, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: onTap), -// ), -// ); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index faa3af72..5e584602 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -77,7 +77,6 @@ class _BloodCholesterolState extends State { width: 350.0, child: Text( TranslationBase.of(context).convertCholesterolStatement, - //textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0), ), ), @@ -90,7 +89,6 @@ class _BloodCholesterolState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - //crossAxisAlignment: CrossAxisAlignment.end, children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 15.0), diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index 5dce5b15..de4e3a48 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -50,18 +50,23 @@ class _HealthCalculatorsState extends State with SingleTicker children: [ TabBar( controller: _tabController, - isScrollable: true, - indicatorWeight: 4.0, - indicatorColor: Colors.red, - labelColor: Theme.of(context).buttonColor, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - unselectedLabelColor: Colors.grey, labelStyle: TextStyle( fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ Container( width: MediaQuery.of(context).size.width * 0.35, diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index e3888240..be58b644 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,8 +1,8 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; + //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; @@ -10,14 +10,15 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -25,12 +26,6 @@ import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; -import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectBloodDialog.dart'; -import 'dialogs/SelectGenderDialog.dart'; -import 'dialogs/SelectPatientFamilyDialog.dart'; -import 'dialogs/SelectPatientInfoDialog.dart'; - enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } enum Gender { Male, Female, NON } enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } @@ -44,11 +39,16 @@ class _BloodDonationPageState extends State { TextEditingController _fileTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - Gender gender = Gender.Male; //Gender.NON; - Blood blood = Blood.Aminus; //Blood.NON; + + // Gender gender = Gender.Male; //Gender.NON; + // Blood blood = Blood.Aminus; //Blood.NON; //HospitalsModel _selectedHospital; CitiesModel _selectedHospital; + int _selectedHospitalIndex = 0; + int _selectedGenderIndex = 1; + int _selectedBloodTypeIndex = 0; + String amount = ""; String email; PatientInfo _selectedPatientInfo; @@ -69,7 +69,7 @@ class _BloodDonationPageState extends State { ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), ); WidgetsBinding.instance.addPostFrameCallback((_) { - if (projectProvider.isLogin) getAuthUser(); + if (projectProvider.isLogin) authUser = projectProvider.user; }); super.initState(); } @@ -79,404 +79,240 @@ class _BloodDonationPageState extends State { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCities(), //model.getHospitals(), + onModelReady: (model) { + model.getCities(); + model.getBlood(); + }, builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - imagesInfo: imagesInfo, - description: TranslationBase.of(context).bloodDonationInfo, - appBarTitle: TranslationBase.of(context).bloodD, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).bloodDEnterDesc - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.CitiesModelList), - //model.hospitals - 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(getHospitalName(projectProvider, context), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectGenderDialog(), - 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(getGender(context), color: Colors.black), - Icon(Icons.arrow_drop_down) - ], - ), + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + baseViewModel: model, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bloodDEnterDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectBloodDialog(), - 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(getBlood(), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Text( + SizedBox(height: 12), + CommonDropDownView( + TranslationBase.of(context).city, + model.bloodModelList.isNotEmpty + ? model.bloodModelList[0].city + : projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN + : model.CitiesModelList[_selectedHospitalIndex].description, () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).male, 1), + RadioSelectionDialogModel(TranslationBase.of(context).female, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedGenderIndex, + onValueSelected: (index) { + _selectedGenderIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).bloodType, model.bloodModelList.isNotEmpty ? model.bloodModelList[0].bloodGroup : getBlood(_selectedBloodTypeIndex), () { + List list = [ + RadioSelectionDialogModel("O+", 0), + RadioSelectionDialogModel("O-", 1), + RadioSelectionDialogModel("AB+", 2), + RadioSelectionDialogModel("AB-", 3), + RadioSelectionDialogModel("A+", 4), + RadioSelectionDialogModel("A-", 5), + RadioSelectionDialogModel("B+", 6), + RadioSelectionDialogModel("B-", 7), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedBloodTypeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedBloodTypeIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( TranslationBase.of(context).viewTermsConditions + ":", - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), ), - ), - InkWell( - onTap: () { - Navigator.of(context).push(FadePage(page: UserAgreementPage())); - }, - child: Container( - child: Texts( + InkWell( + onTap: () { + Navigator.of(context).push(FadePage(page: UserAgreementPage())); + }, + child: Text( TranslationBase.of(context).clickHere, - color: Colors.blue, - fontSize: 14.0, + style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), ), + ) + ], + ), + SizedBox(height: 12), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + value: checkedValue, + activeColor: Color(0xFFc5272d), + ), + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), ), - ) - ], - ), - SizedBox( - height: 12, - ), - Row( - children: [ - Checkbox( - onChanged: (bool value) { - setState(() { - checkedValue = value; - }); - }, - value: checkedValue, - activeColor: Color(0xFFc5272d), - ), - Text( - TranslationBase.of(context).iAgreeToTheTermsAndConditions, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ], - ), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - color: Theme.of(context).primaryColor, - width: 350, - child: InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - "", - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.asset('assets/images/BloodChrt_EN.png'), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + color: Theme.of(context).primaryColor, + width: 350, + child: InkWell( + onTap: () { + showDialog( + context: context, + builder: (_) => AssetGiffyDialog( + title: Text( + "", + style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), + ), + image: Image.asset('assets/images/BloodChrt_EN.png'), + buttonCancelText: Text(TranslationBase.of(context).cancel), + buttonCancelColor: Colors.grey, + onlyCancelButton: true, + )); + }, + child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ), ), ), - ), - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + ], + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(20), - child: DefaultButton(TranslationBase.of(context).save, () async { - if (_selectedHospital == null) { - AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); - return; - } - bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; - bloodDetails.cityCode = _selectedHospital.iD.toString(); - bloodDetails.gender = gender == Gender.Male ? 1 : 2; - await model.updateBloodGroup(bloodDetails); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); - } else { - AppToast.showErrorToast(message: model.error); - } - }), - )), - ); - } - - void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { - showDialog( - context: context, - child: SelectBeneficiaryDialog( - beneficiaryType: beneficiaryType, - onValueSelected: (value) { - setState(() { - if (value == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - beneficiaryType = value; - }); - }, - ), - ); - } - - void confirmSelectBloodDialog() { - showDialog( - context: context, - child: SelectBloodDialog( - bloodType: blood, - onValueSelected: (value) { - setState(() { - if (value == Blood.Oplus) { - bloodDetails.bloodGroup = "O+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Ominus) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.bloodGroup = "O-"; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABplus) { - bloodDetails.bloodGroup = "AB+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABminus) { - bloodDetails.bloodGroup = "AB-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aplus) { - bloodDetails.bloodGroup = "A+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aminus) { - bloodDetails.bloodGroup = "A-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bplus) { - bloodDetails.bloodGroup = "B+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bminus) { - bloodDetails.bloodGroup = "B-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - // beneficiaryType = value; - blood = value; - }); - }, - ), - ); - } - - void confirmSelectGenderDialog() { - showDialog( - context: context, - child: SelectGenderDialog( - beneficiaryType: gender, - onValueSelected: (value) { - setState(() { - if (value == Gender.Male) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.patientType = 1; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - // _fileTextController.text = ""; - { - bloodDetails.gender = 2; - } - - // beneficiaryType = value; - gender = value; - }); - }, + DefaultButton( + TranslationBase.of(context).save, + checkedValue + ? () async { + if (_selectedHospital == null) { + AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + return; + } + bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; + bloodDetails.cityCode = _selectedHospital.iD.toString(); + bloodDetails.gender = _selectedGenderIndex; + bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); + await model.updateBloodGroup(bloodDetails); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); + } else { + AppToast.showErrorToast(message: model.error); + } + } + : null, + disabledColor: CustomColors.grey2, + ).insideContainer + ], + ), ), ); } -//void confirmSelectHospitalDialog(List hospitals) { - void confirmSelectHospitalDialog(List hospitals) { - showDialog( - context: context, - child: SelectCiteisDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); - }, - ), - ); - } - - void confirmSelectPatientDialog(List patientInfoList) { - showDialog( - context: context, - child: SelectPatientInfoDialog( - patientInfoList: patientInfoList, - selectedPatientInfo: _selectedPatientInfo, - onValueSelected: (value) { - setState(() { - advanceModel.depositorName = value.fullName; - _selectedPatientInfo = value; - }); - }, - ), - ); - } - - void confirmSelectFamilyDialog(List getAllSharedRecordsByStatusList) { - showDialog( - context: context, - child: SelectPatientFamilyDialog( - getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, - selectedPatientFamily: selectedPatientFamily, - onValueSelected: (value) { - setState(() { - selectedPatientFamily = value; - _fileTextController.text = selectedPatientFamily.patientID.toString(); - advanceModel.depositorName = value.patientName; - }); - }, - ), - ); - } - - String getBeneficiaryType() { - switch (beneficiaryType) { - case BeneficiaryType.MyAccount: - return TranslationBase.of(context).myAccount; - case BeneficiaryType.MyFamilyFiles: - return TranslationBase.of(context).myFamilyFiles; - break; - case BeneficiaryType.OtherAccount: - return TranslationBase.of(context).otherAccount; - break; - case BeneficiaryType.NON: - return TranslationBase.of(context).selectBeneficiary; - } - return TranslationBase.of(context).selectBeneficiary; - } - - String getGender(BuildContext context) { - switch (gender) { - case Gender.Male: - return TranslationBase.of(context).male; - case Gender.Female: - return TranslationBase.of(context).female; - break; - - case Gender.NON: - return TranslationBase.of(context).selectGender; - } - return TranslationBase.of(context).selectGender; - } - - String getBlood() { - switch (blood) { - case Blood.Oplus: + String getBlood(int index) { + switch (index) { + case 0: return "O+"; break; - case Blood.Ominus: + case 1: return "O-"; break; - case Blood.ABplus: + case 2: return "AB+"; break; - case Blood.ABminus: + case 3: return "AB-"; break; - case Blood.Aplus: + case 4: return "A+"; break; - case Blood.Aminus: + case 5: return "A-"; break; - case Blood.Bplus: + case 6: return "B-"; break; - case Blood.Bminus: + case 7: return "B-"; break; - case Blood.Bplus: + case 8: return "B+"; break; - case Blood.NON: - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; + default: + return ""; } - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { @@ -484,32 +320,5 @@ class _BloodDonationPageState extends State { return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; else return TranslationBase.of(context).selectCity; - // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; - } - - String getPatientName() { - if (_selectedPatientInfo != null) - return _selectedPatientInfo.fullName; - else - return TranslationBase.of(context).selectPatientName; } - - getAuthUser() async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - } - - String getFamilyMembersName() { - if (selectedPatientFamily != null) - return selectedPatientFamily.patientName; - else - return TranslationBase.of(context).selectFamilyPatientName; - } - -//================ - } diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index dde431e6..829ac0e2 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -193,7 +193,7 @@ class _SearchByDoctorState extends State { TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, + keyboardType: TextInputType.text, controller: _controller, onChanged: (value) => {_onDocTextChanged(value)}, style: TextStyle( diff --git a/lib/pages/ChildVaccines/new/child_vaccine_page.dart b/lib/pages/ChildVaccines/new/child_vaccine_page.dart index 81f83798..5f55401e 100644 --- a/lib/pages/ChildVaccines/new/child_vaccine_page.dart +++ b/lib/pages/ChildVaccines/new/child_vaccine_page.dart @@ -60,7 +60,7 @@ class _ChildPageState extends State with SingleTickerProviderS borderRadius: BorderRadius.all(Radius.circular(12)), color: Colors.white, gradient: LinearGradient( - colors: model.babyInformationModelList[index].gender == 1 + colors: model.babyInformationModelList[index].gender == 2 ? [ Color(0xFFFDA4B0), Color(0xFFFBC8CC), @@ -94,7 +94,7 @@ class _ChildPageState extends State with SingleTickerProviderS ), ), Text( - model.babyInformationModelList[index].gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male, + model.babyInformationModelList[index].genderDescription, style: TextStyle( fontSize: 11, color: selectedColor, diff --git a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart b/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart deleted file mode 100644 index b31d4a38..00000000 --- a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -// todo 'sikander' remove useless code -// class ConfirmExitPageDialog extends StatelessWidget { -// final GestureTapCallback onTapYes; -// final GestureTapCallback onTapNo; -// -// const ConfirmExitPageDialog({Key key, this.onTapYes, this.onTapNo}) -// : super(key: key); -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// Texts( -// "Are you sure you want to exit this page ?", -// color: Colors.grey, -// ), -// SizedBox( -// height: 5, -// ), -// Divider(), -// SizedBox( -// height: 5.0, -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// InkWell( -// onTap: () { -// onTapNo(); -// }, -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).no, -// color: Colors.red, -// ), -// ), -// ), -// ), -// -// InkWell( -// onTap: () { -// Navigator.pop(context); -// onTapYes(); -// }, -// child: Container( -// child: Center( -// child: Texts(TranslationBase.of(context).yes), -// ), -// ), -// ), -// ], -// ), -// SizedBox( -// height: 20.0, -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/ErService/EdOnline/DdServicesPage.dart b/lib/pages/ErService/EdOnline/DdServicesPage.dart index 457e199c..dc2e8d78 100644 --- a/lib/pages/ErService/EdOnline/DdServicesPage.dart +++ b/lib/pages/ErService/EdOnline/DdServicesPage.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - -import 'ConfirmExitPageDialog.dart'; import 'EdOnlineAgreementPage.dart'; import 'EdOnlineNotesPage.dart'; import 'EdOnlineQuestionsPage.dart'; @@ -104,21 +102,4 @@ class _DdServicesPageState extends State { ), ); } - - // todo 'sikander' remove useless code - // void showConfirmMessage( - // BuildContext context, - // ) { - // showDialog( - // context: context, - // child: ConfirmExitPageDialog( - // onTapYes: () { - // Navigator.pop(context); - // }, - // onTapNo: () { - // Navigator.pop(context); - // }, - // ), - // ); - // } } diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index ccee254b..1cccf517 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; class PaymentMethod extends StatefulWidget { Function onSelectedMethod; @@ -37,7 +36,6 @@ class _PaymentMethodState extends State { children: [ Container( margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0), - child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( @@ -70,15 +68,6 @@ class _PaymentMethodState extends State { padding: EdgeInsets.all(7.0), child: Image.asset("assets/images/new/payment/Mada.png"), ), - // mWidth(12), - // Text( - // "Mada", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "MADA") Container( @@ -128,16 +117,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/visa.png"), ), - // mWidth(12), - // Text( - // "VISA", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ) - // , mFlex(1), if (selectedPaymentMethod == "VISA") Container( @@ -187,15 +166,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/Mastercard.png"), ), - // mWidth(12), - // Text( - // "MasterCard", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "MASTERCARD") Container( @@ -245,15 +215,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/installments.png"), ), - // mWidth(12), - // Text( - // "Installments", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "Installment") Container( @@ -304,15 +265,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/Apple_Pay.png"), ), - // mWidth(12), - // Text( - // "Apple Pay", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "ApplePay") Container( @@ -332,40 +284,6 @@ class _PaymentMethodState extends State { ), ), ) - // Container( - // margin: EdgeInsets.only(top: 25.0), - // child: Flex( - // direction: Axis.horizontal, - // children: [ - // Expanded( - // child: Container( - // child: InkWell( - // onTap: () { - // updateSelectedPaymentMethod("ApplePay"); - // }, - // child: Card( - // elevation: 3.0, - // margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - // color: Colors.white, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: selectedPaymentMethod == "ApplePay" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), - // ), - // child: Container( - // height: 120.0, - // padding: EdgeInsets.all(20.0), - // child: SvgPicture.asset("assets/images/new-design/applepay.svg"), - // ), - // ), - // ), - // ), - // ), - // Expanded( - // child: Container(), - // ), - // ], - // ), - // ) : Container(), SizedBox( height: 150.0, diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index dc1b47f7..298e617e 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -498,42 +498,6 @@ class _SendFeedbackPageState extends State { ); return; - // todo 'sikander' remove useless code - // showDialog( - // context: context, - // child: FeedbackTypeDialog( - // messageTypeDialog: messageType, - // onValueSelected: (MessageType value) { - // if (value == MessageType.ComplaintOnAnAppointment) { - // appoList.clear(); - // GifLoaderDialogUtils.showMyDialog(context); - // service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) { - // GifLoaderDialogUtils.hideDialog(context); - // setState(() { - // if (res['MessageStatus'] == 1) { - // if (res['AppoimentAllHistoryResultList'].length != 0) { - // res['AppoimentAllHistoryResultList'].forEach((v) { - // appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - // }); - // setState(() { - // appointHistory = null; - // isShowListAppointHistory = true; - // }); - // } else {} - // } else {} - // }); - // }).catchError((err) { - // GifLoaderDialogUtils.hideDialog(context); - // // print(err); - // // AppToast.showErrorToast(message: err); - // // Navigator.of(context).pop(); - // }); - // } else { - // isShowListAppointHistory = false; - // } - // setMessageType(value); - // }, - // )); } openSpeechReco() async { @@ -586,239 +550,4 @@ class _SendFeedbackPageState extends State { print(hasSpeech); if (!mounted) return; } -} -// todo 'sikander' remove useless code -// class FeedbackTypeDialog extends StatefulWidget { -// final Function(MessageType) onValueSelected; -// final MessageType messageTypeDialog; -// -// const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key); -// -// @override -// State createState() => new FeedbackTypeDialogState(); -// } -// -// class FeedbackTypeDialogState extends State { -// MessageType messageTypeDialog = MessageType.NON; -// -// setMessageDialogType(MessageType messageType) { -// setState(() { -// messageTypeDialog = messageType; -// }); -// } -// -// @override -// void initState() { -// messageTypeDialog = widget.messageTypeDialog; -// -// super.initState(); -// } -// -// Widget build(BuildContext context) { -// return BaseView( -// builder: (_, model, widge) => SimpleDialog( -// title: Text( -// TranslationBase.of(context).messageType, -// textAlign: TextAlign.center, -// ), -// children: [ -// Container( -// // padding: const EdgeInsets.all(10.0), -// child: Column( -// children: [ -// Divider( -// height: 2.5, -// color: Colors.grey[500], -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.NON), -// child: ListTile( -// title: Texts(TranslationBase.of(context).notClassified), -// leading: Radio( -// value: MessageType.NON, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).complainAppo), -// leading: Radio( -// value: MessageType.ComplaintOnAnAppointment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).complainWithoutAppo), -// leading: Radio( -// value: MessageType.ComplaintWithoutAppointment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Question), -// child: ListTile( -// title: Texts(TranslationBase.of(context).question), -// leading: Radio( -// value: MessageType.Question, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Compliment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).compliment), -// leading: Radio( -// value: MessageType.Compliment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Suggestion), -// child: ListTile( -// title: Texts(TranslationBase.of(context).suggestion), -// leading: Radio( -// value: MessageType.Suggestion, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Divider( -// height: 2.5, -// color: Colors.grey[500], -// ), -// SizedBox( -// height: 5, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel, -// color: CustomColors.accentColor, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// widget.onValueSelected(messageTypeDialog); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok, -// fontWeight: FontWeight.w400, -// )), -// ), -// )), -// ], -// ) -// ], -// ), -// ), -// ], -// ), -// ); -// } -// } +} \ No newline at end of file diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 7fcfecae..4714c208 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; @@ -236,7 +237,7 @@ class _HomePageFragment2State extends State { ), FlatButton( onPressed: () { - Navigator.push(context, FadePage(page: AllHabibMedicalService())); + Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); }, child: Text( TranslationBase.of(context).viewAllServices, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 9498282b..7f4d8621 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -388,13 +388,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } - // todo 'sikander' remove useless code - // showDialogs(String message) { - // ConfirmDialog dialog = new ConfirmDialog( - // context: context, confirmMessage: message, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => {}, cancelFunction: () => {}); - // dialog.showAlertDialog(context); - // } - Future> requestPermissions() async { var permissionResults = [ Permission.location, diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 6ae272e2..aa6f0d1c 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -4,10 +4,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; @@ -146,9 +145,7 @@ class _LandingPagePharmacyState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient() - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", - onSuccess: (dynamic response, int statusCode) { + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -158,8 +155,7 @@ class _LandingPagePharmacyState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast( - message: "Something went wrong, please try again"); + AppToast.showErrorToast(message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 37e7cd74..b233c6a7 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -107,7 +107,7 @@ class ServicesView extends StatelessWidget { FadePage(page: ChildInitialPage()), ); } else if (index == 15) { - Navigator.pop(context); + // Navigator.pop(context); LandingPage.shared.switchToDoFromHMGServices(); } else if (index == 16) { Navigator.push( diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index f91121e3..b0150c03 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingRequest.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; @@ -62,7 +60,24 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt body: Container( child: Column(children: [ TabBar( - labelColor: Colors.black, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ Tab( child: Text( @@ -87,7 +102,6 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt ), ), ], - controller: _tabController, ), Expanded( child: TabBarView( diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 85bae24b..e07c5615 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -28,188 +29,71 @@ class _LiveCareTypeSelectState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).livecare.toUpperCase(), - // appBar: AppBar( - // leading: InkWell( - // onTap: () { - // Navigator.pop(context, null); - // }, - // child: Icon( - // Icons.close, - // color: Colors.white, - // ), - // ), - // title: Text(TranslationBase.of(context).bookAppo, - // style: TextStyle(color: Colors.white)), - // ), body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).livecareService, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0, bottom: 10.0), - child: Image.asset( - languageID == 'ar' - ? "assets/images/new-design/liveCare_ar_bg.png" - : "assets/images/new-design/liveCare_en_bg.png", - width: 120), - ), - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).livecareService, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), - Container( - margin: EdgeInsets.only(top: 0.0), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).livecareServiceDesc, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18.0))), + margin: EdgeInsets.only(top: 7.0), + child: Text(TranslationBase.of(context).livecareServiceDesc, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(TranslationBase.of(context).whyLivecare, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).whyLivecare, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.only(top: 0.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).livecarePoint1, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(TranslationBase.of(context).livecarePoint1, + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns4, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns5, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - TranslationBase.of(context).livecareSummary, - style: TextStyle(fontSize: 12.0))), - InkWell( - onTap: (){ - Navigator.pop(context, "immediate"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red[900], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon_white.svg", - width: 80), - ), - Container( - width: MediaQuery.of(context).size.width * 0.56, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(TranslationBase.of(context).livecareOption1, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - Container( - margin: EdgeInsets.only(top: 0.0), - child: Text(TranslationBase.of(context).livecareOption2, textAlign: TextAlign.start, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), - ), - InkWell( - onTap: (){ - Navigator.pop(context, "schedule"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Image.asset( - "assets/images/new-design/calendar.png", - width: 60), - ), - Container( - width: MediaQuery.of(context).size.width * 0.53, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - children: [ - Container( - child: Text(TranslationBase.of(context).livecareOption3, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption4, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).livecareSummary, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), + + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 40.0), + shrinkWrap: true, + children: [ + _loginOptionButton(TranslationBase.of(context).livecareOption1, 'assets/images/new/Live_Care.svg', 1), + _loginOptionButton(TranslationBase.of(context).livecareOption4, 'assets/images/new/book appointment.svg', 2), + ], ), SizedBox( height: 40.0, @@ -221,6 +105,44 @@ class _LiveCareTypeSelectState extends State { ); } + Widget _loginOptionButton(String _title, String _icon, int _loginIndex) { + return InkWell( + onTap: () { + if (_loginIndex == 1) { + Navigator.pop(context, "immediate"); + } else { + Navigator.pop(context, "schedule"); + } + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: _loginIndex == 1 ? 60 : 50, + width: _loginIndex == 1 ? 60 : 50, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); + } + getLanguageID() async { var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 6a7573d7..49337ee4 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; @@ -14,11 +15,7 @@ class ClinicCard extends StatefulWidget { var languageID; int isOnline; - ClinicCard( - {this.isSelected, - this.languageID, - this.isOnline, - @required this.patientERGetClinicsList}); + ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList}); @override _State createState() => _State(); @@ -35,90 +32,69 @@ class _State extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 8.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : widget.patientERGetClinicsList.isOnline == 1 ? Colors.white : Colors.grey, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + return Container( + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - child: Container( - width: MediaQuery.of(context).size.width * 0.75, - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + border: Border.all(width: 2, color: widget.isSelected ? CustomColors.green : Color(0xffEFEFEF)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Container( + padding: EdgeInsets.fromLTRB(12.0, 25.0, 12.0, 25.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text(widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16)), + ), + Row( + children: [ Container( - child: Text( - widget.languageID == 'ar' - ? widget.patientERGetClinicsList.serviceNameN - : widget.patientERGetClinicsList.serviceName, - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), + child: Text(".", style: TextStyle(fontSize: 30.0)), + ), + Container( + child: Text("Online"), ), ], ), - ), - ), - InkWell( - onTap: () { - getClinicTimings(widget.patientERGetClinicsList); - }, - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - child: Container( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Icon(Icons.access_time, size: 26.0, color: Colors.red[800]), - ], - ), - ), - ), + ], ), - ], + ), ); } getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) - .then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - clinicsServiceTimingsResponse = - ClinicsServiceTimingsResponse.fromJson(res); - print(clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList.length); + clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res); + print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length); showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { - final curvedValue = - Curves.easeInOutBack.transform(a1.value) - 1.0; + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; return Transform( - transform: - Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), child: Opacity( opacity: a1.value, child: ClinicTimingsDialog( clinicName: patientERGetClinicsList.serviceName, - patientERGetClinicsServiceTimingsList: - clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList, + patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, ), ), ); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index afb41ea2..9a463150 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -76,11 +76,8 @@ class _clinic_listState extends State { if (LiveCareHome.isLiveCareTypeSelected != true) { openLiveCareSelectionDialog(); } else { - print("LiveCare Type Selected"); setState(() { currentSelectedLiveCareType = "immediate"; - // isDataLoaded = true; - // print(liveCareOnlineClinicsListResponse.length); getLiveCareClinicsList(); }); } @@ -440,33 +437,35 @@ class _clinic_listState extends State { isDataLoaded ? Container( height: MediaQuery.of(context).size.height * 0.7, - child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); - }, - child: ScheduleClinicCard( - isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, - clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], - languageID: languageID, + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); + }, + child: ScheduleClinicCard( + isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, + clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], + languageID: languageID, + ), + ); + }, ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - ): getNoDataWidget(context), + Container( + height: 10.0, + ), + ], + ) + : getNoDataWidget(context), ) : Container(), isDataLoaded @@ -509,16 +508,11 @@ class _clinic_listState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).onlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, + padding: const EdgeInsets.only(top: 16.0), itemCount: liveCareOnlineClinicsListResponse.length, itemBuilder: (context, index) { return InkWell( @@ -533,10 +527,10 @@ class _clinic_listState extends State { ); }, ), - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), + // Container( + // margin: EdgeInsets.all(15.0), + // child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 08df2e6c..1903e561 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -21,6 +23,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -34,13 +37,12 @@ import 'package:intl/intl.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/pages/login/register_new.dart'; class ConfirmLogin extends StatefulWidget { final Function changePageViewIndex; + const ConfirmLogin({Key key, this.changePageViewIndex}) : super(key: key); + @override _ConfirmLogin createState() => _ConfirmLogin(); } @@ -640,15 +642,14 @@ class _ConfirmLogin extends State { if (result.isNeedUserAgreement == true) { //move to agreement page. } else { - insertIMEI(); + goToHome(); } } insertIMEI() { - authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) { + authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { print(err); }); - // authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); } getToDoCount() { @@ -670,7 +671,7 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - getToDoCount(); + // getToDoCount(); appointmentRateViewModel .getIsLastAppointmentRatedList() @@ -694,13 +695,12 @@ class _ConfirmLogin extends State { page: LandingPage(), ), (r) => false) - } + }, + insertIMEI() }) .catchError((err) { print(err); - //GifLoaderDialogUtils.hideDialog(context); }); - // SMSOTP.showLoadingDialog(context, false), } loading(flag) { @@ -752,37 +752,6 @@ class _ConfirmLogin extends State { ), ), ); - - // return InkWell( - // onTap: () { - // if (_flag == 0) { - // setState(() { - // isMoreOption = true; - // }); - // } else { - // authenticateUser(4, isActive: _loginIndex); - // } - // }, - // child: RoundedContainer( - // height: 150, - // borderColor: Colors.grey, - // showBorder: true, - // child: Padding( - // padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - // child: Column( - // children: [ - // Image.asset( - // _icon, - // height: SizeConfig.imageSizeMultiplier * 13, - // width: SizeConfig.imageSizeMultiplier * 16, - // ), - // SizedBox( - // height: 20, - // ), - // Texts(_title, fontSize: SizeConfig.textMultiplier * 2, color: Colors.black) - // ], - // ), - // ))); } // todo 'sikander' optimize this after knowing usage diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 389baf24..877c52fc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -111,15 +111,6 @@ class AskDoctorPage extends StatelessWidget { ); } - // todo 'sikander' remove this later - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); return DateUtil.getWeekDay(dateObj.weekday) + diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 7c96dc3e..9eb3e1a5 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -216,30 +216,6 @@ class _AddWeightPageState extends State { ), ); return; - - // todo 'sikander' remove useless code - 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); }) ], ), diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index 7cc6ab01..4fc233db 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -62,10 +62,9 @@ class _SmartWatchInstructionsState extends State { mainAxisSize: MainAxisSize.min, children: [ Flexible( - // margin: EdgeInsets.only(top: 10.0), child: CarouselSlider( carouselController: buttonCarouselController, - options: CarouselOptions(enableInfiniteScroll: false, viewportFraction: 0.95, height: MediaQuery.of(context).size.height * 0.65), + options: CarouselOptions(enableInfiniteScroll: false, viewportFraction: 0.95, height: MediaQuery.of(context).size.height * 0.9), items: [1, 2].map((i) { return Builder( builder: (BuildContext context) { diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index d93c3637..f81b3ef0 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -23,10 +23,9 @@ import 'cart-page/cart-order-preview.dart'; class CartOrderPage extends StatefulWidget { + final Function(int) changeTab; - const CartOrderPage({ Key key}) - : super(key: key); - + const CartOrderPage({Key key, this.changeTab}) : super(key: key); @override _CartOrderPageState createState() => _CartOrderPageState(); @@ -50,10 +49,9 @@ class _CartOrderPageState extends State { final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; AppScaffold appScaffold; return NetworkBaseView( - // baseViewModel: model, isLoading: isLoading, isLocalLoader: true, - child: AppScaffold( + child: appScaffold = AppScaffold( appBarTitle: TranslationBase.of(context).shoppingCart, isShowAppBar: true, isPharmacy: true, @@ -297,7 +295,7 @@ class _OrderBottomWidgetState extends State { Container( height: widget.height * 0.070, color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.only(left: 15.0, right: 15.0), child: Row( children: [ InkWell( @@ -357,7 +355,8 @@ class _OrderBottomWidgetState extends State { ), Container( height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + padding: EdgeInsets.only(left: 20.0, right: 20.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart deleted file mode 100644 index 5d7f10e0..00000000 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ /dev/null @@ -1,420 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class CartOrderPage extends StatefulWidget { - final Function(int) changeTab; - - const CartOrderPage({Key key, this.changeTab}) : super(key: key); - - @override - _CartOrderPageState createState() => _CartOrderPageState(); -} - -class _CartOrderPageState extends State { - bool isLoading = true; - - @override - void initState() { - super.initState(); - getData(); - } - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context); - OrderPreviewViewModel model = Provider.of(context); - - final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - isLoading: isLoading, - isLocalLoader: true, - child: appScaffold = AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - showHomeAppBarIcon: false, - isShowDecPage: true, - baseViewModel: model, - backButtonTab: - widget.changeTab != null ? () => widget.changeTab(0) : null, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? Container( - height: height * 0.85, - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Image.asset( - "assets/images/pharmacy_module/payment_image.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), - SizedBox( - height: 120, - ) - ], - ), - ), - ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, -// 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), - ), - ); - } - - void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); - setState(() { - isLoading = false; - }); - } -} - -class OrderBottomWidget extends StatefulWidget { - final List addresses; - final double height; - - OrderBottomWidget(this.addresses, this.height); - - @override - _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); -} - -class _OrderBottomWidgetState extends State { - bool isAgree = false; - - @override - Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Divider( - color: Color(0xFFD6D6D6), - height: 1, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: widget.height * 0.070, - color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - isAgree = !isAgree; - }); - }, - child: Container( - width: 25.0, - height: widget.height * 0.070, - decoration: new BoxDecoration( - color: !isAgree ? Color(0xffeeeeee) : Colors.green, - shape: BoxShape.circle, - ), - child: !isAgree - ? null - : Padding( - padding: const EdgeInsets.all(0.0), - child: Icon( - Icons.check, - color: Colors.white, - size: 25, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - margin: const EdgeInsets.symmetric(vertical: 4), - child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, - fontSize: 13, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ), - InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, - child: Container( - child: Icon( - Icons.info, - size: 25, - color: Color(0xff005aff), - ), - ), - ), - ], - ), - ), - Container( - height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), - child: Row( - children: [ - Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: projectProvider.isArabic ? 12 : 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), - child: Texts( - "${TranslationBase.of(context).inclusiveVat}", - fontSize: 8, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - RaisedButton( - onPressed: isAgree - ? () => { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } - : null, - child: new Text( - "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), - ), - elevation: 0, - color: Color(0xff005aff), - disabledColor: Color(0xff005aff), - ), - ], - ), - ), - ], - ) - : Container(); - } -} diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart index 9234bb38..6e506458 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -1,26 +1,10 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class SelectPaymentOptionWidget extends StatefulWidget { final OrderPreviewViewModel model; @@ -28,24 +12,21 @@ class SelectPaymentOptionWidget extends StatefulWidget { SelectPaymentOptionWidget(this.model); @override - _SelectPaymentOptionWidgetState createState() => - _SelectPaymentOptionWidgetState(); + _SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState(); } class _SelectPaymentOptionWidgetState extends State { PaymentOption paymentOption; _navigateToPaymentOption() { - Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) - .then((result) => { - setState(() { - if (result != null) { - paymentOption = result; - widget.model.paymentCheckoutData.paymentOption = - paymentOption; - } - }) - }); + Navigator.push(context, FadePage(page: PaymentMethodSelectPage())).then((result) => { + setState(() { + if (result != null) { + paymentOption = result; + widget.model.paymentCheckoutData.paymentOption = paymentOption; + } + }) + }); } @override @@ -75,8 +56,7 @@ class _SelectPaymentOptionWidgetState extends State { ), Expanded( child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).selectPaymentOption, fontSize: 14, diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 8cdbaf3c..92065102 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -1,14 +1,16 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; class PaymentMethodSelectPage extends StatefulWidget { @override - _PaymentMethodSelectPageState createState() => - _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -20,8 +22,9 @@ class _PaymentMethodSelectPageState extends State { double cardWidth = screenSize.width / 2 - 32; return AppScaffold( - title: "Payment method", + appBarTitle: TranslationBase.of(context).paymentMethod, isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, body: Container( width: double.infinity, @@ -30,72 +33,65 @@ class _PaymentMethodSelectPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Center( - child: Texts( + child: Text( TranslationBase.of(context).selectPaymentOption, - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.black, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.black, + ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), child: Column( children: [ - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.meda, - () => { - setState(() { - selectedPaymentOption = PaymentOption.meda; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.sadad, - () => { - setState(() { - selectedPaymentOption = PaymentOption.sadad; - }) - }), - ], - ), - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.visa, - () => { - setState(() { - selectedPaymentOption = PaymentOption.visa; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.mastercard, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.mastercard; - }) - }), - ], - ), PaymentMethodCard( - (cardWidth * 2 + 32), + cardWidth, + selectedPaymentOption, + PaymentOption.meda, + () => { + setState(() { + selectedPaymentOption = PaymentOption.meda; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.visa, + () => { + setState(() { + selectedPaymentOption = PaymentOption.visa; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.mastercard, + () => { + setState(() { + selectedPaymentOption = PaymentOption.mastercard; + }) + }), + PaymentMethodCard( + cardWidth, selectedPaymentOption, PaymentOption.installments, () => { setState(() { - selectedPaymentOption = - PaymentOption.installments; + selectedPaymentOption = PaymentOption.installments; }) }), + if (Platform.isIOS) + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.applepay, + () => { + setState(() { + selectedPaymentOption = PaymentOption.applepay; + }) + }), ], ), ), @@ -103,18 +99,12 @@ class _PaymentMethodSelectPageState extends State { ), ), bottomSheet: Container( - height: screenSize.height * 0.08, - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: BorderedButton( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), + child: DefaultButton( TranslationBase.of(context).next, - backgroundColor: Color(0xff5AB154), - textColor: Colors.white, - fontSize: 16, - hPadding: 8, - vPadding: 12, - handler: selectedPaymentOption != null - ? () => {Navigator.pop(context, selectedPaymentOption)} - : null, + selectedPaymentOption != null ? () => {Navigator.pop(context, selectedPaymentOption)} : null, + color: Color(0xff5AB154), ), ), ); @@ -127,61 +117,102 @@ class PaymentMethodCard extends StatelessWidget { final PaymentOption paymentOption; final Function selectMethod; - PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, - this.paymentOption, this.selectMethod); + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod); @override Widget build(BuildContext context) { bool isSelected = false; - if (selectedPaymentOption != null && - selectedPaymentOption == paymentOption) { + if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) { isSelected = true; } - return InkWell( - onTap: selectMethod, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), - child: Stack( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), - margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), - decoration: new BoxDecoration( - color: Colors.grey.shade100, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.fromBorderSide(BorderSide( - color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, - width: 0.8, - )), - ), - width: cardWidth, - child: Image.asset( - getPaymentOptionImage(paymentOption), - fit: BoxFit.cover, - ), - ), - if (isSelected) - Positioned( - right: 1, - child: Icon( - Icons.check_circle, - color: Color(0xff20BC11), - size: 30, + return Container( + width: MediaQuery.of(context).size.width * 0.99, + child: InkWell( + onTap: selectMethod, + child: Card( + elevation: 0.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ), - ], + mWidth(12), + Container( + height: 70.0, + width: 70.0, + child: Image.asset(getPaymentOptionImage(paymentOption)), + ), + mFlex(1), + if (isSelected) + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), + ), ), + // Container( + // margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), + // child: Stack( + // children: [ + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + // margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), + // decoration: new BoxDecoration( + // color: Colors.grey.shade100, + // shape: BoxShape.rectangle, + // borderRadius: BorderRadius.circular(8), + // border: Border.fromBorderSide(BorderSide( + // color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, + // width: 0.8, + // )), + // ), + // width: cardWidth, + // child: Image.asset( + // getPaymentOptionImage(paymentOption), + // fit: BoxFit.cover, + // ), + // ), + // if (isSelected) + // Positioned( + // right: 1, + // child: Icon( + // Icons.check_circle, + // color: Color(0xff20BC11), + // size: 30, + // ), + // ), + // ], + // ), + // ), ), ); } String getPaymentOptionImage(PaymentOption paymentOption) { - String assetFile = "assets/images/pharmacy_module/payment/"; + String assetFile = "assets/images/new/payment/"; switch (paymentOption.index) { case 0: - return "${assetFile}mada.png"; + return "${assetFile}Mada.png"; break; case 1: return "${assetFile}sadad.png"; @@ -190,10 +221,13 @@ class PaymentMethodCard extends StatelessWidget { return "${assetFile}visa.png"; break; case 3: - return "${assetFile}mastercard.png"; + return "${assetFile}Mastercard.png"; break; case 4: - return "${assetFile}installment.png"; + return "${assetFile}installments.png"; + break; + case 5: + return "${assetFile}Apple_Pay.png"; break; default: return ""; diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 19286b6a..ca8222ac 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -10,8 +11,6 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; -import '../../cart-page/cart-order-page.dart'; -import '../product-detail.dart'; class FooterWidget extends StatefulWidget { final bool isAvailable; @@ -26,13 +25,8 @@ class FooterWidget extends StatefulWidget { int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, - {this.quantity, - this.isOverQuantity = false, - this.addToCartFunction, - this.addToShoppingCartFunction, - this.model}); + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, + {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -41,8 +35,7 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -77,8 +70,7 @@ class _FooterWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( "Quantity", - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), ), InkWell( @@ -101,11 +93,7 @@ class _FooterWidgetState extends State { SizedBox( width: 5, ), - for (int i = 1; i <= 10; i++) - QuantityBox( - label: i, - onTapFunc: onChangeValue, - isSelected: widget.quantity == i), + for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), Container( width: 100, decoration: BoxDecoration( @@ -113,16 +101,14 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + decoration: InputDecoration(labelText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; } else { setState(() { widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { + if (widget.quantity >= widget.quantityLimit) { widget.isOverQuantity = true; } else { widget.isOverQuantity = false; @@ -187,20 +173,14 @@ class _FooterWidgetState extends State { width: MediaQuery.of(context).size.width * 0.45, child: SecondaryButton( label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity == 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - disableColor: Color(0xFF4CAF50), + disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { Navigator.of(context).pushNamed( WELCOME_LOGIN, ); } else - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); }, fontWeight: FontWeight.w600, borderColor: Color(0xFF4CAF50), @@ -215,14 +195,9 @@ class _FooterWidgetState extends State { width: MediaQuery.of(context).size.width * 0.35, child: SecondaryButton( label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, + disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, onTap: () async { - await widget.addToShoppingCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); Navigator.push( context, FadePage(page: CartOrderPage()), @@ -232,11 +207,7 @@ class _FooterWidgetState extends State { borderColor: Colors.grey[800], borderRadius: 3, disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null - ? Colors.grey - : Colors.grey[800], + color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800], ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 6dc571d6..a9e2a66c 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -12,7 +13,6 @@ import 'package:provider/provider.dart'; import '../../../../../locator.dart'; import '../../../compare-list.dart'; -import '../../cart-page/cart-order-page.dart'; import 'icon_with_bg.dart'; class ProductAppBar extends StatelessWidget with PreferredSizeWidget { diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 28556679..fe8ca977 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -27,30 +25,21 @@ class PrescriptionsWidget extends StatelessWidget { isLocalLoader: true, baseViewModel: model, child: Container( - height: model.prescriptionsList.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, child: Column( children: [ - ViewAllHomeWidget( - TranslationBase.of(context).myPrescription, - HomePrescriptionsPage()), + ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 14.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.only(right: 10.0, left: 10.0), + height: MediaQuery.of(context).size.height * 0.18, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( - height: MediaQuery.of(context).size.height * 0.3, - padding: EdgeInsets.only( - bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), + padding: EdgeInsets.only(left: 8.0, right: 8.0), + margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( border: Border.all( color: Colors.grey, @@ -59,167 +48,130 @@ class PrescriptionsWidget extends StatelessWidget { ), color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( children: [ - Row( - children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 15.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: - Colors.transparent, - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, - ), - ), + Column(children: [ + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 15.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 60, + height: 60, ), - ]), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 1), - padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, - ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( - model.languageID == "ar" - ? model - .prescriptionsList[ - index] - .isInOutPatientDescriptionN - .toString() - : model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( - DateUtil.convertStringToDate( - model - .prescriptionsList[ - index] - .appointmentDate - .toString()) - .toString() - .substring(0, 10), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - ), - ) - ]), - ], ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + ), + ]), + Column( + children: [ Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index] - .doctorTitle - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index] - .doctorName - .toString(), + margin: EdgeInsets.only(left: 1), + padding: EdgeInsets.only(left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0)), + child: Text( + model.languageID == "ar" + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 15.0, - fontWeight: FontWeight.bold, ), - ), - ]), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index] - .clinicDescription - .toString(), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + DateUtil.convertStringToDate(model.prescriptionsList[index].appointmentDate.toString()).toString().substring(0, 10), style: TextStyle( - color: Colors.green, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, ), + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, ), ), - ], + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .prescriptionsList[index] - .actualDoctorRate - .toDouble(), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), // initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ) - ]), - ]), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + ]), + ]), ); }), ), diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 22430242..274ef651 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,5 +1,9 @@ import 'package:flutter/material.dart'; +extension WithContainer on DefaultButton { + Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); +} + class DefaultButton extends StatelessWidget { final String text; final VoidCallback onPress; diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 4c7656f6..f4081c21 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; @@ -7,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dar import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -14,9 +14,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import '../../text.dart'; import 'FlowChartPage.dart'; class LabResultWidget extends StatelessWidget { @@ -81,6 +79,14 @@ class LabResultWidget extends StatelessWidget { ), ) : Container(), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Divider( + height: 1, + color: Color(0xff2E303A), + thickness: 1, + ), + ), ], ), ); @@ -152,10 +158,10 @@ class LabResultWidget extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnTitle(TranslationBase.of(context).description), - Utils.tableColumnTitle(TranslationBase.of(context).value), - Utils.tableColumnTitle(TranslationBase.of(context).range), - Utils.tableColumnTitle(""), + Utils.tableColumnTitle(TranslationBase.of(context).description, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).value, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).range, showDivider: false), + Utils.tableColumnTitle("", showDivider: false), ], ), ); diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 198e25de..4cbfdcc4 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -13,8 +13,9 @@ class RadioSelectionDialog extends StatefulWidget { final Function(int) onValueSelected; final List listData; final int selectedIndex; + final bool isScrollable; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex}) : super(key: key); + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -68,36 +69,41 @@ class RadioSelectionDialogState extends State { TranslationBase.of(context).pleaseSelectFromBelowOptions, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.only(bottom: 42, top: 10), - itemBuilder: (context, index) { - return Row( - children: [ - SizedBox( - width: 22, - height: 22, - child: Radio( - value: widget.listData[index].value, - groupValue: selectedIndex, - onChanged: (value) { - setState(() { - selectedIndex = value; - }); - }, + SizedBox(height: widget.isScrollable ? 12 : 0), + SizedBox( + height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, + child: ListView.separated( + physics: widget.isScrollable ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), + shrinkWrap: !widget.isScrollable, + padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10), + itemBuilder: (context, index) { + return Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: widget.listData[index].value, + groupValue: selectedIndex, + onChanged: (value) { + setState(() { + selectedIndex = value; + }); + }, + ), ), - ), - SizedBox(width: 8), - Text( - widget.listData[index].title, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), - ), - ], - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 10), - itemCount: widget.listData.length), + SizedBox(width: 8), + Text( + widget.listData[index].title, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), + ], + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 10), + itemCount: widget.listData.length), + ), + SizedBox(height: widget.isScrollable ? 12 : 0), Row( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index a66d5850..affcb02a 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -36,7 +34,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../config/size_config.dart'; import '../../locator.dart'; diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 600522f3..6fccaec4 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -225,34 +225,6 @@ class SMSOTP { }); } - - // todo 'sikander' remove useless code - // static void showLoadingDialog(BuildContext context, bool _loading) async { - // _context = context; - // //setSignature(); - // if (_loading == false) { - // Navigator.of(context).pop(); - // return; - // } - // _loading = true; - // await showDialog( - // context: _context, - // barrierDismissible: false, - // builder: (BuildContext context) { - // return SimpleDialog( - // elevation: 0.0, - // backgroundColor: Colors.transparent, - // children: [ - // Center( - // child: CircularProgressIndicator( - // valueColor: AlwaysStoppedAnimation(Colors.black), - // ), - // ) - // ], - // ); - // }); - // } - static void hideSMSBox(context) { Navigator.pop(context); } diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index f3654b74..1c2f87cc 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -26,27 +26,27 @@ class productTile extends StatelessWidget { final dynamic productID; final Function onDelete; final dynamic approvedTotalReviews; -// final VoidCallback deleteWishlistItems; - productTile( - {this.productName, - this.productPrice, - this.productRate, - this.productReviews, - this.qyt, - this.totalPrice, - this.isOrderDetails = false, - this.productImage, - this.showLine = true, - this.img, - this.imgs, - this.status, - this.product, - this.productID, - this.onDelete, - this.approvedTotalReviews, +// final VoidCallback deleteWishlistItems; - }); + productTile({ + this.productName, + this.productPrice, + this.productRate, + this.productReviews, + this.qyt, + this.totalPrice, + this.isOrderDetails = false, + this.productImage, + this.showLine = true, + this.img, + this.imgs, + this.status, + this.product, + this.productID, + this.onDelete, + this.approvedTotalReviews, + }); @override Widget build(BuildContext context) { @@ -91,10 +91,7 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: productName, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), ), ), ), @@ -106,19 +103,16 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: 'SAR $productPrice', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ), ), ), ), this.isOrderDetails == false ? Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( margin: EdgeInsets.all(5), child: Align( alignment: Alignment.topLeft, @@ -134,14 +128,12 @@ class productTile extends StatelessWidget { ), ), ), - Text( '$approvedTotalReviews', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), - ), - ], - ) + Text( + '$approvedTotalReviews', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + ), + ], + ) : Container(), ], ), @@ -164,9 +156,11 @@ class productTile extends StatelessWidget { height: 50, ), IconButton( - icon: Icon(Icons.shopping_cart, + icon: Icon( + Icons.shopping_cart, size: 18, - color: Colors.blue,), + color: Colors.blue, + ), onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, productID); @@ -192,13 +186,8 @@ class productTile extends StatelessWidget { margin: EdgeInsets.only(bottom: 5.0), child: RichText( text: TextSpan( - text: TranslationBase.of(context).quantity + - "" + - '$qyt', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + text: TranslationBase.of(context).quantity + "" + '$qyt', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), @@ -224,10 +213,7 @@ class productTile extends StatelessWidget { RichText( text: TextSpan( text: ' $totalPrice SAR', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 15), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15), ), ), ], @@ -268,30 +254,19 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: '($productReviews reviews)', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), ), InkWell( onTap: () { - Navigator.push( - context, FadePage(page: ProductReviewPage(product))); + Navigator.push(context, FadePage(page: ProductReviewPage(product))); }, child: Container( - padding: - EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), height: 30.0, - decoration: BoxDecoration( - border: Border.all( - color: Colors.orange, - style: BorderStyle.solid, - width: 1.0), - color: Colors.transparent, - borderRadius: BorderRadius.circular(5.0)), + decoration: BoxDecoration(border: Border.all(color: Colors.orange, style: BorderStyle.solid, width: 1.0), color: Colors.transparent, borderRadius: BorderRadius.circular(5.0)), child: Text( TranslationBase.of(context).writeReview, style: TextStyle(