From e890c80831db498412fd8db85cf62258b30bd8ac Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Tue, 14 Sep 2021 12:18:02 +0300 Subject: [PATCH] CMC 1.3 --- .../AlHabibMedicalService/cmc_service.dart | 107 ++--- .../AlHabibMedicalService/cmc_view_model.dart | 73 ++-- .../Dialog/confirm_cancel_order_dialog.dart | 55 ++- .../Dialog/confirm_dialog.dart | 98 +++++ .../NewCMC/new_cmc_page.dart | 396 +++++------------- .../NewCMC/new_cmc_step_one_page.dart | 14 +- .../NewCMC/new_cmc_step_three_page.dart | 192 +++++---- .../NewCMC/new_cmc_step_tow_page.dart | 261 ++++++------ .../dialogs/select_location_dialog.dart | 43 +- lib/widgets/drawer/app_drawer_widget.dart | 2 +- 10 files changed, 614 insertions(+), 627 deletions(-) create mode 100644 lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 9e99f3ad..11c306dc 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -23,12 +23,9 @@ class CMCService extends BaseService { bool isOrderUpdated; Future getCMCAllServices() async { - - - GetCMCServicesRequestModel getCMCServicesRequestModel= new GetCMCServicesRequestModel(genderID: user.gender, identificationNo: user.patientIdentificationNo); + GetCMCServicesRequestModel getCMCServicesRequestModel = new GetCMCServicesRequestModel(genderID: user.gender, identificationNo: user.patientIdentificationNo); hasError = false; - await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, onSuccess: (dynamic response, int statusCode) { cmcAllServicesList.clear(); response['PatientER_CMC_GetAllServicesList'].forEach((data) { cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); @@ -39,79 +36,67 @@ class CMCService extends BaseService { }, body: getCMCServicesRequestModel.toJson()); } - - Future getCmcAllPresOrders() async { - - GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel= GetHHCAllPresOrdersRequestModel(); + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; - await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, - onSuccess: (dynamic response, int statusCode) { - cmcAllPresOrdersList.clear(); - cmcAllOrderDetail.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) - cmcAllPresOrdersList - .add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { + cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); + response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getHHCAllPresOrdersRequestModel.toJson()); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); } Future getOrderDetailByOrderID(GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel) async { - hasError = false; - await baseAppClient.post(GET_CMC_ORDER_DETAIL_BY_ID, - onSuccess: (dynamic response, int statusCode) { - cmcAllOrderDetail.clear(); - response['PatientER_CMC_GetTransactionsForOrderList'].forEach((data) { - cmcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getOrderDetailByOrderIDRequestModel.toJson()); + await baseAppClient.post(GET_CMC_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { + cmcAllOrderDetail.clear(); + response['PatientER_CMC_GetTransactionsForOrderList'].forEach((data) { + cmcAllOrderDetail.add(GetOrderDetailByOrderIDResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getOrderDetailByOrderIDRequestModel.toJson()); } - Future getCheckupItems(CMCGetItemsRequestModel cMCGetItemsRequestModel) async { - hasError = false; - await baseAppClient.post(GET_CHECK_UP_ITEMS, - onSuccess: (dynamic response, int statusCode) { - checkupItemsList.clear(); - response['GetCheckUpItemsList'].forEach((data) { - checkupItemsList.add(CMCGetItemsResponseModel.fromJson(data)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: cMCGetItemsRequestModel.toJson()); + await baseAppClient.post(GET_CHECK_UP_ITEMS, onSuccess: (dynamic response, int statusCode) { + checkupItemsList.clear(); + response['GetCheckUpItemsList'].forEach((data) { + checkupItemsList.add(CMCGetItemsResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: cMCGetItemsRequestModel.toJson()); } Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { - hasError = false; - await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - isOrderUpdated = true; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: updatePresOrderRequestModel.toJson()); + await baseAppClient.post(PATIENT_ER_UPDATE_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); } - Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { - + Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - isOrderUpdated = true; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: order.toJson()); + String reqId=""; + await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + reqId=response['RequestNo'].toString(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + return reqId; } } diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index 65fffe33..26f2fe85 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -17,34 +17,28 @@ import '../../../locator.dart'; import 'add_new_address_Request_Model.dart'; class CMCViewModel extends BaseViewModel { - CMCService _cMCService = - locator(); - CustomerAddressesService _customerAddressesService = - locator(); - List get addressesList => - _customerAddressesService.addressesList; - List get cmcAllServicesList => + CMCService _cMCService = locator(); + CustomerAddressesService _customerAddressesService = locator(); - _cMCService.cmcAllServicesList; + List get addressesList => _customerAddressesService.addressesList; - List get cmcAllPresOrders => - _cMCService.cmcAllPresOrdersList; + List get cmcAllServicesList => _cMCService.cmcAllServicesList; - List get cmcAllOrderDetail => - _cMCService.cmcAllOrderDetail; - List get checkupItems => - _cMCService.checkupItemsList; + List get cmcAllPresOrders => _cMCService.cmcAllPresOrdersList; - PharmacyModuleService _pharmacyModuleService = locator(); + List get cmcAllOrderDetail => _cMCService.cmcAllOrderDetail; + + List get checkupItems => _cMCService.checkupItemsList; + + PharmacyModuleService _pharmacyModuleService = locator(); bool get isOrderUpdated => _cMCService.isOrderUpdated; Future getCMCAllServices() async { - await _cMCService - .getCMCAllServices(); + await _cMCService.getCMCAllServices(); CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: cmcAllServicesList[0].iD); - await getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel,isFirst: true); + await getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel, isFirst: true); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); @@ -52,16 +46,15 @@ class CMCViewModel extends BaseViewModel { setState(ViewState.Idle); } } + Future getCheckupItems({CMCGetItemsRequestModel cMCGetItemsRequestModel, bool isFirst = false}) async { - if(!isFirst) - setState(ViewState.Busy); + if (!isFirst) setState(ViewState.Busy); await _cMCService.getCheckupItems(cMCGetItemsRequestModel); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); } - if(!isFirst) - setState(ViewState.Idle); + if (!isFirst) setState(ViewState.Idle); } Future getCmcAllPresOrders() async { @@ -71,9 +64,7 @@ class CMCViewModel extends BaseViewModel { error = _cMCService.error; setState(ViewState.Error); } else { - var pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere( - (element) => element.status == 1 || element.status == 2, - orElse: () => null); + var pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); if (pendingOrder != null) { await getOrderDetailByOrderID(pendingOrder); setState(ViewState.Idle); @@ -83,11 +74,9 @@ class CMCViewModel extends BaseViewModel { } } - Future updateCmcPresOrder( - UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.BusyLocal); - await _cMCService.updateCmcPresOrder( - updatePresOrderRequestModel); + await _cMCService.updateCmcPresOrder(updatePresOrderRequestModel); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.ErrorLocal); @@ -97,23 +86,24 @@ class CMCViewModel extends BaseViewModel { } Future getOrderDetailByOrderID(GetHHCAllPresOrdersResponseModel order) async { - GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = - GetOrderDetailByOrderIDRequestModel(presOrderID: order.iD); - await _cMCService - .getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); + GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = GetOrderDetailByOrderIDRequestModel(presOrderID: order.iD); + await _cMCService.getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } + //TODO check it in uat - Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { + Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { setState(ViewState.Busy); order.createdBy = user.patientID; order.orderServiceID = OrderService.Comprehensive_Medical_Checkup.getIdOrderService(); - await _cMCService.insertPresPresOrder(order: order); + String requestId = await _cMCService.insertPresPresOrder(order: order); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.ErrorLocal); } else { getCmcAllPresOrders(); } + + return requestId; } Future getCustomerAddresses() async { @@ -129,7 +119,7 @@ class CMCViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async{ + await _pharmacyModuleService.generatePharmacyToken().then((value) async { await _customerAddressesService.getCustomerInfo(); }); if (_customerAddressesService.hasError) { @@ -140,14 +130,9 @@ class CMCViewModel extends BaseViewModel { } } - Future addAddressInfo( - {AddNewAddressRequestModel addNewAddressRequestModel}) async { - - + Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { setState(ViewState.Busy); - await _customerAddressesService.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel - ); + await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); @@ -155,4 +140,4 @@ class CMCViewModel extends BaseViewModel { setState(ViewState.Idle); } } -} \ No newline at end of file +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart index 549f90b8..f302f7a2 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart @@ -10,9 +10,7 @@ class ConfirmCancelOrderDialog extends StatefulWidget { final CMCViewModel model; final Function onTap; - - ConfirmCancelOrderDialog( - {Key key, this.model, this.onTap}); + ConfirmCancelOrderDialog({Key key, this.model, this.onTap}); @override _ConfirmCancelOrderDialogState createState() => _ConfirmCancelOrderDialogState(); @@ -27,11 +25,13 @@ class _ConfirmCancelOrderDialogState extends State { @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, + contentPadding: EdgeInsets.fromLTRB(28.0, 2.0, 28.0, 0.0), + title: Text( + TranslationBase.of(context).confirm, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, ), ), children: [ @@ -39,13 +39,13 @@ class _ConfirmCancelOrderDialogState extends State { children: [ Divider(), Center( - child: Texts( - TranslationBase.of(context).cancelOrderMsg , - color: Colors.grey, + child: Text( + TranslationBase.of(context).cancelOrderMsg, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, letterSpacing: -0.46, color: Colors.grey[600]), ), ), SizedBox( - height: 5.0, + height: 12.0, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -60,9 +60,14 @@ class _ConfirmCancelOrderDialogState extends State { padding: const EdgeInsets.all(8.0), child: Container( child: Center( - child: Texts( + child: Text( TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w700, + letterSpacing: -0.46, + color: Colors.red, + ), ), ), ), @@ -77,28 +82,32 @@ class _ConfirmCancelOrderDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ + onTap: () async { widget.onTap(); Navigator.pop(context); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + child: Text( + TranslationBase.of(context).ok.toUpperCase(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w700, + letterSpacing: -0.46, + ), + )), ), ), ), ], - ) + ), + SizedBox( + height: 5.0, + ), ], ) ], ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart new file mode 100644 index 00000000..f7e2ebef --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart @@ -0,0 +1,98 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:flutter/material.dart'; +import 'package:progress_hud_v2/generated/i18n.dart'; + +Future showCMCConfirmDialog(BuildContext context, String requestId, {Function onClick}) async { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ConfirmDialog(requestId,onClick: onClick,), + ], + ), + ); + }, + ); +} + +class ConfirmDialog extends StatelessWidget { + String requestId; + Function onClick; + + ConfirmDialog(this.requestId, {this.onClick}); + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + mFlex(1), + IconButton( + icon: Icon( + Icons.close, + ), + onPressed: () { + onClick(); + Navigator.pop(context); + }, + ), + ], + ), + Text( + "Request has been sent successfully. You will be contacted soon.", + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), + ), + mHeight(20), + Text( + "Request ID", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey[600], + letterSpacing: -0.46, + ), + ), + Text( + requestId ?? "", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.black, + letterSpacing: -0.46, + ), + ), + mHeight(20), + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + label: TranslationBase.of(context).ok.toUpperCase(), + color: CustomColors.accentColor, + onTap: () async { + onClick(); + Navigator.pop(context); + }, + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 5ce0cc3e..27170cab 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -47,19 +48,14 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { price: widget.model.cmcAllServicesList[0].price, serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), selectedServiceName: widget.model.cmcAllServicesList[0].description, - selectedServiceNameAR: - widget.model.cmcAllServicesList[0].descriptionN, + selectedServiceNameAR: widget.model.cmcAllServicesList[0].descriptionN, recordID: 1, totalPrice: widget.model.cmcAllServicesList[0].totalPrice, vAT: widget.model.cmcAllServicesList[0].vAT); - cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel( - patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); } - cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel( - patientERCMCInsertServicesList: patientERCMCInsertServicesList != null - ? [patientERCMCInsertServicesList] - : []); + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: patientERCMCInsertServicesList != null ? [patientERCMCInsertServicesList] : []); _controller = new PageController(); @@ -89,26 +85,18 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage( - CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { showDialog( context: context, child: ConfirmCancelOrderDialog( model: model, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, - editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); await model.updateCmcPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast( - message: - TranslationBase.of(context).processDoneSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); await model.getCmcAllPresOrders(); } }, @@ -119,282 +107,118 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { 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.cmcAllOrderDetail.length != 0 - ? FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( - child: Column( + child: widget.model.cmcAllOrderDetail.length != 0 + ? Column( + children: [ + 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: [ + Text( + TranslationBase.of(context).OrderStatus + + ' ' + + (projectViewModel.isArabic ? widget.model.cmcAllOrderDetail[0].descriptionN : widget.model.cmcAllOrderDetail[0].description), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + color: Color(0xffcd9e1b), + fontWeight: FontWeight.w700, + ), + ), + mHeight(12), + Text( + TranslationBase.of(context).requestID + ' ' + widget.model.cmcAllOrderDetail[0].iD.toString(), + style: TextStyle( + fontSize: 16, + letterSpacing: -0.48, + fontWeight: FontWeight.w700, + ), + ), + Text( + TranslationBase.of(context).serviceName, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w500, + ), + ), + Text( + !projectViewModel.isArabic ? widget.model.cmcAllOrderDetail[0].description.toString() : widget.model.cmcAllOrderDetail[0].descriptionN.toString(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w700, + ), + ), + ], + ), + ), + Column( children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, width: 1), - borderRadius: - BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model - .cmcAllOrderDetail[0].iD - .toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget - .model - .cmcAllOrderDetail[0] - .descriptionN - : widget - .model - .cmcAllOrderDetail[0] - .description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate( - widget - .model - .cmcAllOrderDetail[ - 0] - .createdOn)), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .serviceName, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic - ? widget - .model - .cmcAllOrderDetail[0] - .description - .toString() - : widget - .model - .cmcAllOrderDetail[0] - .descriptionN - .toString(), - fontSize: 22, - ), - ], - ), - ), - SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery.of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of( - context) - .cancel - .toUpperCase(), - onTap: () { - showConfirmMessage( - widget.model, - widget.model - .cmcAllOrderDetail[0]); - }, - color: Colors.red[800], - disabled: false, - textColor: Theme.of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 22, - ), - ], + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.cmcAllOrderDetail[0].createdOn)), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w700, ), ), - SizedBox( - height: 22, - ), + mHeight(8), + SecondaryButton( + onTap: () { + showConfirmMessage(widget.model, widget.model.cmcAllOrderDetail[0]); + }, + label: TranslationBase.of(context).cancel, + color: Colors.red[900], + small: true, + ) ], ), - ), - ) - : Container( - color: Colors.red, - child: NewCMCStepOnePage( - changePageViewIndex: changePageViewIndex, - cMCInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), + ], + ), ), - NewCMCStepTowPage( - longitude: _longitude, - latitude: _latitude, - changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), - NewCMCStepThreePage( - changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, + ), ), ], + ) + : Container( + color: Colors.red, + child: NewCMCStepOnePage( + changePageViewIndex: changePageViewIndex, + cMCInsertPresOrderRequestModel: cMCInsertPresOrderRequestModel, + model: widget.model, + latitude: _latitude, + longitude: _longitude, + ), ), - ), - ], - ), ), ), ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 5bf65ef4..cbbda9b8 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -14,12 +14,16 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'new_cmc_step_tow_page.dart'; + class NewCMCStepOnePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; final Function changePageViewIndex; final CMCViewModel model; - const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key); + final double latitude; + final double longitude; + const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex,this.latitude,this.longitude}) : super(key: key); @override _NewCMCStepOnePageState createState() => _NewCMCStepOnePageState(); @@ -178,7 +182,13 @@ class _NewCMCStepOnePageState extends State { if (widget.model.state == ViewState.ErrorLocal) { Utils.showErrorToast(); } else { - widget.changePageViewIndex(1); + navigateTo(context,NewCMCStepTowPage( + longitude: widget.longitude, + latitude: widget.latitude, + cmcInsertPresOrderRequestModel: widget.cMCInsertPresOrderRequestModel, + model: widget.model, + )); + // widget.changePageViewIndex(1); } } }, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index 75699a5c..7017122d 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -2,9 +2,13 @@ import 'dart:async'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -15,14 +19,9 @@ import 'package:provider/provider.dart'; class NewCMCStepThreePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; - final Function changePageViewIndex; final CMCViewModel model; - NewCMCStepThreePage( - {Key key, - this.changePageViewIndex, - this.model, - this.cmcInsertPresOrderRequestModel}); + NewCMCStepThreePage({Key key, this.model, this.cmcInsertPresOrderRequestModel}); @override _NewCMCStepThreePageState createState() => _NewCMCStepThreePageState(); @@ -44,15 +43,12 @@ class _NewCMCStepThreePageState extends State { markers.add( Marker( markerId: MarkerId( - widget.cmcInsertPresOrderRequestModel.latitude.hashCode - .toString(), + widget.cmcInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, - widget.cmcInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, - widget.cmcInsertPresOrderRequestModel.longitude), + target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude), zoom: 14.4746, ); } @@ -63,7 +59,15 @@ class _NewCMCStepThreePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowDecPage: false, + isShowAppBar: true, + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), + ], + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, baseViewModel: widget.model, body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -74,79 +78,93 @@ class _NewCMCStepThreePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).orderDetails, - fontWeight: FontWeight.bold, + Text( + TranslationBase.of(context).orderSummary, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), ), SizedBox( height: 12, ), - Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(12)), - padding: EdgeInsets.all(8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).orderLocation + " : ", - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 12, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - height: 200, - child: GoogleMap( - mapType: MapType.normal, - markers: markers, - initialCameraPosition: _kGooglePlex, - onMapCreated: (GoogleMapController controller) { - _controller.complete(controller); - }, + Card( + shape: cardRadius(12), + elevation: 4, + child: Container( + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderDetails + " : ", + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + color: CustomColors.grey, ), ), - ), - SizedBox( - height: 12, - ), - Texts(TranslationBase.of(context).selectedService), - ...List.generate( - widget.cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList.length, - (index) => Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), - Texts( - projectViewModel.isArabic - ? widget - .cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList[index] - .selectedServiceNameAR - : widget - .cmcInsertPresOrderRequestModel - .patientERCMCInsertServicesList[index] - .selectedServiceName, - fontSize: 15, - bold: true, + SizedBox( + height: 6, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + height: 200, + decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey), + clipBehavior: Clip.antiAlias, + child: Card( + shape: cardRadius(12), + clipBehavior: Clip.antiAlias, + elevation: 0, + margin: const EdgeInsets.all(0), + child: GoogleMap( + mapType: MapType.normal, + markers: markers, + initialCameraPosition: _kGooglePlex, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, ), - ], + ), + ), + ), + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).selectedService, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + color: CustomColors.grey, ), ), - ) - ], + ...List.generate( + widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList.length, + (index) => Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + projectViewModel.isArabic + ? widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceNameAR + : widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + letterSpacing: -0.46, + ), + ), + ], + ), + ), + ) + ], + ), ), ) ], @@ -156,18 +174,30 @@ class _NewCMCStepThreePageState extends State { bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, + color: Colors.white, child: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: TranslationBase.of(context).confirm, - color: Colors.grey[800], + color: CustomColors.green, onTap: () async { - await widget.model.insertPresPresOrder( - order: widget.cmcInsertPresOrderRequestModel); + String requestId = await widget.model.insertPresPresOrder(order: widget.cmcInsertPresOrderRequestModel); if (widget.model.state != ViewState.ErrorLocal) { - widget.changePageViewIndex(0); + //show scuccess dialog + showCMCConfirmDialog( + context, + requestId, + onClick: () { + Navigator.pop(context); + Navigator.pop(context); + }, + ); + + } else { + } }, textColor: Theme.of(context).backgroundColor), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 12e1b622..02dbc735 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -1,9 +1,14 @@ +import 'dart:async'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -18,24 +23,16 @@ import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; import 'cmc_location_page.dart'; +import 'new_cmc_step_three_page.dart'; class NewCMCStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; final double longitude; final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; - final Function changePageViewIndex; final CMCViewModel model; - const NewCMCStepTowPage( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.cmcInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}) - : super(key: key); + const NewCMCStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.cmcInsertPresOrderRequestModel, this.model}) : super(key: key); @override _NewCMCStepTowPageState createState() => _NewCMCStepTowPageState(); @@ -47,6 +44,14 @@ class _NewCMCStepTowPageState extends State { AddressInfo _selectedAddress; bool showCurrentLocation = false; + Completer _controller = Completer(); + static CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + + final Set markers = new Set(); + @override void initState() { if (widget.cmcInsertPresOrderRequestModel.latitude == null) { @@ -54,29 +59,43 @@ class _NewCMCStepTowPageState extends State { } else { latitude = widget.cmcInsertPresOrderRequestModel.latitude; longitude = widget.cmcInsertPresOrderRequestModel.longitude; + setMap(); } super.initState(); } - setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { - if (latLong == null){ - if(widget.model.addressesList.isEmpty) { + setMap() { + markers.clear(); + markers.add( + Marker( + markerId: MarkerId( + latitude.hashCode.toString(), + ), + position: LatLng(latitude, longitude)), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); + } + setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { + if (latLong == null) { + if (widget.model.addressesList.isEmpty) { setState(() { showCurrentLocation = true; }); } else { - latLong = widget - .model.addressesList[widget.model.addressesList.length - 1].latLong; + latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong; } - } - if(!showCurrentLocation) { + if (!showCurrentLocation) { List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); + setMap(); } } @@ -84,113 +103,119 @@ class _NewCMCStepTowPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowDecPage: false, - body: Stack( + isShowAppBar: true, + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), + ], + appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( children: [ - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: CMCLocationPage( - latitude: latitude, - longitude: longitude, - ), - ), - ); - }, - label: TranslationBase.of(context) - .addNewAddress, - ), - SizedBox( - height: 10, - ), - SecondaryButton( - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.cmcInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.cmcInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, - ), - ], - )), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - if(widget.model.addressesList.isNotEmpty) - - Container( - child: InkWell( - onTap: () => - confirmSelectLocationDialog(widget.model.addressesList), + if (widget.model.addressesList.isNotEmpty) + Card( + margin: EdgeInsets.only(left: 12, right: 12, bottom: 12), + shape: cardRadius(12), + elevation: 3, child: Container( - padding: EdgeInsets.all(10), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Theme.of(context).primaryColor), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Texts( - getAddressName(), - fontSize: 14, - ), + child: InkWell( + onTap: () => confirmSelectLocationDialog(widget.model.addressesList), + child: Container( + padding: EdgeInsets.all(8), + width: double.infinity, + // height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + getAddressName(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.45, + ), + ), + ), + Icon(Icons.arrow_drop_down) + ], ), - Icon(Icons.arrow_drop_down) - ], + ), ), + height: 50, + width: double.infinity, + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: CMCLocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), + child: Row( + children: [ + Icon(Icons.add_circle_outline_sharp), + mWidth(12), + Text( + TranslationBase.of(context).addNewAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + ], ), ), - height: 56, - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - ) + ), + Expanded( + child: GoogleMap( + mapType: MapType.normal, + markers: markers, + zoomControlsEnabled: false, + initialCameraPosition: _kGooglePlex, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + child: SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.cmcInsertPresOrderRequestModel.latitude = latitude; + widget.cmcInsertPresOrderRequestModel.longitude = longitude; + }); + // widget.changePageViewIndex(3); + navigateTo( + context, + NewCMCStepThreePage( + + cmcInsertPresOrderRequestModel: widget.cmcInsertPresOrderRequestModel, + model: widget.model, + ), + ); + }, + label: TranslationBase.of(context).continues, + ), + ), ], ), ); diff --git a/lib/widgets/dialogs/select_location_dialog.dart b/lib/widgets/dialogs/select_location_dialog.dart index 77916ddc..df33a963 100644 --- a/lib/widgets/dialogs/select_location_dialog.dart +++ b/lib/widgets/dialogs/select_location_dialog.dart @@ -10,8 +10,7 @@ class SelectLocationDialog extends StatefulWidget { final Function(AddressInfo) onValueSelected; AddressInfo selectedAddress; - SelectLocationDialog( - {Key key, this.addresses, this.onValueSelected, this.selectedAddress}); + SelectLocationDialog({Key key, this.addresses, this.onValueSelected, this.selectedAddress}); @override _SelectLocationDialogState createState() => _SelectLocationDialogState(); @@ -27,7 +26,14 @@ class _SelectLocationDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - title: Texts(TranslationBase.of(context).selectAddress), + title: Text( + TranslationBase.of(context).selectAddress, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), children: [ Column( children: [ @@ -39,7 +45,7 @@ class _SelectLocationDialogState extends State { Divider(), ...List.generate( widget.addresses.length, - (index) => Column( + (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( @@ -56,7 +62,13 @@ class _SelectLocationDialogState extends State { }); }, child: ListTile( - title: Text(widget.addresses[index].address1), + title: Text( + widget.addresses[index].address1, + style: TextStyle( + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), leading: Radio( value: widget.addresses[index], groupValue: widget.selectedAddress, @@ -98,9 +110,14 @@ class _SelectLocationDialogState extends State { padding: const EdgeInsets.all(8.0), child: Container( child: Center( - child: Texts( + child: Text( TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + color: Colors.red, + ), ), ), ), @@ -122,10 +139,14 @@ class _SelectLocationDialogState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + child: Text( + TranslationBase.of(context).ok.toUpperCase(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + )), ), ), ), diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 6fa0a4ec..f5e633ec 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -163,7 +163,7 @@ class _AppDrawerState extends State { } else { projectProvider.changeLanguage('ar'); } - var themeNotifier = Provider.of(context, listen: true); + var themeNotifier = Provider.of(context, listen: false); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); }, ),