From 169aafa26b8e526f5dee1edb1c3a22b7cc6f1ad7 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 12 Sep 2021 15:36:10 +0300 Subject: [PATCH] hmc services design fixed --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 4 +- .../NewHomeHealthCare/location_page.dart | 187 +++--- .../new_Home_health_care_step_one_page.dart | 182 +++--- .../new_Home_health_care_step_three_page.dart | 90 ++- .../new_Home_health_care_step_tow_page.dart | 341 +++++++---- .../new_home_health_care_page.dart | 555 +++++++++--------- .../HomeHealthCare/home_health_care_page.dart | 90 +-- lib/uitl/utils.dart | 6 + 9 files changed, 771 insertions(+), 688 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d7bb78b7..dd9711b3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f11315da..55feaf4f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1225,7 +1225,7 @@ const Map localizedValues = { "en": "Choose one of the following symptoms to show the right doctors or choose a consultation to show all", "ar": "اختر أحد الأعراض التالية لتظهر للأطباء المناسبين أو اختر استشارة لإظهار الكل" }, - "continue": {"en": "CONTINUE", "ar": "إستمرار"}, + "continue": {"en": "Continue", "ar": "إستمرار"}, "skip": {"en": "SKIP", "ar": "تخطى"}, "calorieCalcDesc": { "en": "Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity ", @@ -1461,5 +1461,5 @@ const Map localizedValues = { "sys/dias": {"en": "SBP/DBP", "ar": "إنقباض/إنبساط"}, "arm": {"en": "Arm", "ar": "الذراع"}, "remove-measure": {"en": "Remove this measure", "ar": "إزالة هذا القياس؟"}, - "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"} + "select-arm": {"en": "Select the Arm", "ar": "إختر الذراع"}, }; diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index 0e013ebf..58d66b3d 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -21,132 +21,115 @@ class LocationPage extends StatefulWidget { final double longitude; final dynamic model; - const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) - : super(key: key); + const LocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); @override - _LocationPageState createState() => - _LocationPageState(); + _LocationPageState createState() => _LocationPageState(); } -class _LocationPageState - extends State { +class _LocationPageState extends State { double latitude = 0; double longitude = 0; bool showCurrentLocation = false; @override void initState() { - latitude = widget.latitude; longitude = widget.longitude; - if(latitude == 0.0 && longitude == 0.0) { + if (latitude == 0.0 && longitude == 0.0) { showCurrentLocation = true; } super.initState(); } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) {}, builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).addAddress, - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - AddNewAddressRequestModel - addNewAddressRequestModel = - new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: - selectedPlace.formattedAddress, - address2: selectedPlace - .formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); - - selectedPlace.addressComponents.forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel.customer - .addresses[0].country = e.longName; - } - if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer - .addresses[0].zipPostalCode = - e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel.customer - .addresses[0].city = - e.longName; - } - }); + appBarTitle: TranslationBase.of(context).addAddress, + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "$latitude,$longitude", + email: "") + ]), + ); + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); - await model.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: "Address Added Successfully"); - } - Navigator.of(context).pop(addNewAddressRequestModel); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), - ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(addNewAddressRequestModel); + }, + label: TranslationBase.of(context).addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + )); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 86ee791b..442a5530 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -5,43 +5,33 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; class NewHomeHealthCareStepOnePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepOnePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.model, - this.changePageViewIndex}) - : super(key: key); + const NewHomeHealthCareStepOnePage({Key key, this.patientERInsertPresOrderRequestModel, this.model, this.changePageViewIndex}) : super(key: key); @override - _NewHomeHealthCareStepOnePageState createState() => - _NewHomeHealthCareStepOnePageState(); + _NewHomeHealthCareStepOnePageState createState() => _NewHomeHealthCareStepOnePageState(); } -class _NewHomeHealthCareStepOnePageState - extends State { +class _NewHomeHealthCareStepOnePageState extends State { PickResult _result; @override void initState() { - if (widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList == - null) - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList = []; + if (widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList == null) widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = []; super.initState(); } @@ -55,30 +45,25 @@ class _NewHomeHealthCareStepOnePageState body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), + margin: EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05), child: Center( child: FractionallySizedBox( widthFactor: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 12, - ), - Texts( - TranslationBase.of(context).selectHomeHealthCareServices, - textAlign: TextAlign.center, - ), + // Texts( + // TranslationBase.of(context).selectHomeHealthCareServices, + // textAlign: TextAlign.center, + // ), Column( children: widget.model.hhcAllServicesList.map((service) { return Container( - margin: EdgeInsets.only(top: 15), + margin: EdgeInsets.only(top: 10), decoration: BoxDecoration( - border: Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), + // border: Border.all(color: Colors.grey, width: 1), + borderRadius: BorderRadius.circular(12), + ), child: Column( children: [ Row( @@ -86,21 +71,14 @@ class _NewHomeHealthCareStepOnePageState Checkbox( value: isServiceSelected(service.serviceID), activeColor: Colors.red[800], + tristate: false, onChanged: (bool newValue) { setState(() { - if (!isServiceSelected( - service.serviceID)) - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .add(PatientERHHCInsertServicesList( - recordID: widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length, - serviceID: service.serviceID, - serviceName: - service.description)); + if (!isServiceSelected(service.serviceID)) + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.add(PatientERHHCInsertServicesList( + recordID: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, + serviceID: service.serviceID, + serviceName: service.description)); else removeSelected(service.serviceID); // widget.patientERInsertPresOrderRequestModel @@ -109,22 +87,27 @@ class _NewHomeHealthCareStepOnePageState }), Expanded( child: Padding( - padding: const EdgeInsets.all(20.0), + padding: const EdgeInsets.only(left: 0.0, right: 10), child: Texts( - projectViewModel.isArabic - ? service.descriptionN - : service.description, + projectViewModel.isArabic ? service.descriptionN : service.description.toLowerCase()?.capitalize(), fontSize: 15, + style: 'letterSpacing: -0.48', + fontWeight: FontWeight.bold, ), ), ), ], ), + Divider( + height: 1, + color: Colors.grey, + ) ], ), ); }).toList(), - ) + ), + SizedBox(height: 70) ], ), ), @@ -132,44 +115,73 @@ class _NewHomeHealthCareStepOnePageState ), ), bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.10, - width: double.infinity, - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.9, - child: SecondaryButton( - label: TranslationBase.of(context).next, - disabled: this - .widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList - .length == - 0 || - widget.model.state == ViewState.BusyLocal, - color: Colors.grey[800], - loading: widget.model.state == ViewState.BusyLocal, - onTap: () async { - await widget.model.getCustomerInfo(); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(); - } else { - widget.changePageViewIndex(1); - } - }, - textColor: Theme.of(context).backgroundColor), - ), - ], + width: MediaQuery.of(context).size.width, + height: 70.0, + margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), + child: Button( + onTap: () async { + await widget.model.getCustomerInfo(); + if (widget.model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(); + } else { + Navigator.push( + context, + FadePage( + page: NewHomeHealthCareStepTowPage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ), + ); + + // widget.changePageViewIndex(1); + } + }, + label: TranslationBase.of(context).next, + backgroundColor: Colors.red[900], + disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal, + loading: widget.model.state == ViewState.BusyLocal, ), ), + + // Container( + // height: MediaQuery.of(context).size.height * 0.10, + // width: double.infinity, + // child: Column( + // children: [ + // Container( + // width: MediaQuery.of(context).size.width * 0.9, + // child: SecondaryButton( + // label: TranslationBase.of(context).next, + // disabled: this.widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0 || widget.model.state == ViewState.BusyLocal, + // color: Colors.grey[800], + // loading: widget.model.state == ViewState.BusyLocal, + // onTap: () async { + // await widget.model.getCustomerInfo(); + // if (widget.model.state == ViewState.ErrorLocal) { + // Utils.showErrorToast(); + // } else { + // Navigator.push( + // context, + // FadePage( + // page: NewHomeHealthCareStepTowPage(), + // ), + // ); + + // // widget.changePageViewIndex(1); + // } + // }, + // textColor: Theme.of(context).backgroundColor), + // ), + // ], + // ), + // ), ); } isServiceSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) { return true; } @@ -178,15 +190,11 @@ class _NewHomeHealthCareStepOnePageState removeSelected(int serviceId) { Iterable patientERHHCInsertServicesList = - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .where((element) => serviceId == element.serviceID); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.where((element) => serviceId == element.serviceID); if (patientERHHCInsertServicesList.length > 0) setState(() { - widget - .patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList - .remove(patientERHHCInsertServicesList.first); + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.remove(patientERHHCInsertServicesList.first); }); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart index 5e9bd04d..c4729257 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart @@ -12,26 +12,21 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart'; class NewHomeHealthCareStepThreePage extends StatefulWidget { - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - NewHomeHealthCareStepThreePage( - {Key key, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}); + NewHomeHealthCareStepThreePage({Key key, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}); @override - _NewHomeHealthCareStepThreePageState createState() => - _NewHomeHealthCareStepThreePageState(); + _NewHomeHealthCareStepThreePageState createState() => _NewHomeHealthCareStepThreePageState(); } -class _NewHomeHealthCareStepThreePageState - extends State { +class _NewHomeHealthCareStepThreePageState extends State { Completer _controller = Completer(); static CameraPosition _kGooglePlex = CameraPosition( @@ -42,22 +37,17 @@ class _NewHomeHealthCareStepThreePageState @override void initState() { - if (widget.patientERInsertPresOrderRequestModel.latitude != null) { markers.clear(); markers.add( Marker( markerId: MarkerId( - widget.patientERInsertPresOrderRequestModel.latitude.hashCode - .toString(), + widget.patientERInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng( - widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, - widget.patientERInsertPresOrderRequestModel.longitude), + target: LatLng(widget.patientERInsertPresOrderRequestModel.latitude, widget.patientERInsertPresOrderRequestModel.longitude), zoom: 14.4746, ); } @@ -71,6 +61,9 @@ class _NewHomeHealthCareStepThreePageState return AppScaffold( isShowDecPage: false, baseViewModel: widget.model, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( @@ -79,19 +72,20 @@ class _NewHomeHealthCareStepThreePageState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderDetails, fontWeight: FontWeight.bold,), - SizedBox( - height: 12, - ), Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), + padding: EdgeInsets.all(20), + child: Texts( + TranslationBase.of(context).RRTSummary, + fontWeight: FontWeight.bold, + fontSize: 22, + )), + Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), padding: EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).orderLocation, fontWeight: FontWeight.bold), + Texts(TranslationBase.of(context).selectedLocation, fontWeight: FontWeight.bold), SizedBox( height: 12, ), @@ -112,29 +106,32 @@ class _NewHomeHealthCareStepThreePageState SizedBox( height: 12, ), - Texts(TranslationBase.of(context).selectedService + " : ", fontWeight: FontWeight.bold), + Texts(TranslationBase.of(context).selectedService), ...List.generate( - widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length, + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts( - TranslationBase.of(context).serviceName, - fontSize: 12, - ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // ), SizedBox( height: 5, ), - Texts( - widget - .patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList[index] - .serviceName, - fontSize: 15, - bold: true, - ), + Row( + children: [ + Texts( + (index + 1).toString() + '. ', + fontSize: 15, + ), + Texts( + widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList[index].serviceName, + fontSize: 15, + ), + ], + ) ], ), ), @@ -158,15 +155,12 @@ class _NewHomeHealthCareStepThreePageState width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( label: TranslationBase.of(context).confirm, - disabled: widget.patientERInsertPresOrderRequestModel - .patientERHHCInsertServicesList.length == - 0, + disabled: widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList.length == 0, color: Colors.grey[800], onTap: () async { - await widget.model.insertPresPresOrder( - order: widget.patientERInsertPresOrderRequestModel); + await widget.model.insertPresPresOrder(order: widget.patientERInsertPresOrderRequestModel); if (widget.model.state != ViewState.ErrorLocal) { - widget.changePageViewIndex(0); + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: NewHomeHealthCarePage)); } }, textColor: Theme.of(context).backgroundColor), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 1b96cdc8..590733c1 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -1,9 +1,12 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -14,41 +17,37 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:provider/provider.dart'; - +import 'dart:async'; import 'location_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart'; class NewHomeHealthCareStepTowPage extends StatefulWidget { final Function(PickResult) onPick; final double latitude; final double longitude; - final PatientERInsertPresOrderRequestModel - patientERInsertPresOrderRequestModel; + final PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel; final Function changePageViewIndex; final HomeHealthCareViewModel model; - const NewHomeHealthCareStepTowPage( - {Key key, - this.onPick, - this.latitude, - this.longitude, - this.patientERInsertPresOrderRequestModel, - this.changePageViewIndex, - this.model}) - : super(key: key); + const NewHomeHealthCareStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.patientERInsertPresOrderRequestModel, this.changePageViewIndex, this.model}) : super(key: key); @override - _NewHomeHealthCareStepTowPageState createState() => - _NewHomeHealthCareStepTowPageState(); + _NewHomeHealthCareStepTowPageState createState() => _NewHomeHealthCareStepTowPageState(); } -class _NewHomeHealthCareStepTowPageState - extends State { +class _NewHomeHealthCareStepTowPageState extends State { double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; bool showCurrentLocation = false; + Completer _controller = Completer(); - + static CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(37.42796133580664, -122.085749655962), + zoom: 14.4746, + ); + final Set markers = new Set(); @override void initState() { if (widget.patientERInsertPresOrderRequestModel.latitude == null) { @@ -57,30 +56,38 @@ class _NewHomeHealthCareStepTowPageState latitude = widget.patientERInsertPresOrderRequestModel.latitude; longitude = widget.patientERInsertPresOrderRequestModel.longitude; } - + markers.clear(); + markers.add( + Marker( + markerId: MarkerId( + latitude.hashCode.toString(), + ), + position: LatLng(latitude, longitude)), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); super.initState(); } setLatitudeAndLongitude({bool isSetState = false, String latLong}) { - if (latLong == null){ - if(widget.model.addressesList.isEmpty) { + if (latLong == null) { + if (widget.model.addressesList.isEmpty) { setState(() { showCurrentLocation = true; }); } else { - latLong = widget.model.addressesList[widget.model.addressesList - .length - 1].latLong; + latLong = widget.model.addressesList[widget.model.addressesList.length - 1].latLong; } - } - if(!showCurrentLocation) { + if (!showCurrentLocation) { List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); } - } @override @@ -88,121 +95,211 @@ class _NewHomeHealthCareStepTowPageState ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).homeHealthCare, body: Stack( children: [ - PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, + Container( + margin: EdgeInsets.only(top: 120), + child: GoogleMap( + mapType: MapType.normal, + markers: markers, + initialCameraPosition: _kGooglePlex, + onMapCreated: (GoogleMapController controller) { + _controller.complete(controller); + }, + ) + + // PlacePicker( + // apiKey: GOOGLE_API_KEY, + // enableMyLocationButton: true, + // automaticallyImplyAppBarLeading: false, + // autocompleteOnTrailingWhitespace: false, + // selectInitialPosition: true, + // autocompleteLanguage: projectViewModel.currentLanguage, + // enableMapTypeButton: false, + // searchForInitialValue: true, + + // // onPlacePicked: (PickResult result) { + // // print(result.adrAddress); + // // widget.changePageViewIndex(3); + // // }, + // selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + // print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + // return isSearchBarFocused + // ? Container() + // : FloatingCard( + // bottomPosition: 0.0, + // leftPosition: 0.0, + // rightPosition: 0.0, + // width: 500, + // borderRadius: BorderRadius.circular(12.0), + // child: Container( + // margin: EdgeInsets.all(12), + // child: Column( + // children: [ + // // SecondaryButton( + // // color: Colors.grey[800], + // // textColor: Colors.white, + // // onTap: () { + // // Navigator.push( + // // context, + // // FadePage( + // // page: LocationPage( + // // latitude: latitude, + // // longitude: longitude, + // // ), + // // ), + // // ); + // // }, + // // label: TranslationBase.of(context).addNewAddress, + // // ), + // // SizedBox( + // // height: 10, + // // ), + // SecondaryButton( + // color: Colors.red[800], + // textColor: Colors.white, + // onTap: () { + // setState(() { + // widget.patientERInsertPresOrderRequestModel.latitude = selectedPlace.geometry.location.lat; + // widget.patientERInsertPresOrderRequestModel.longitude = selectedPlace.geometry.location.lng; + // }); + // widget.changePageViewIndex(3); + // }, + // label: TranslationBase.of(context).confirm, + // ), + // ], + // ), + // ), + // ); + // }, + // initialPosition: LatLng(latitude, longitude), + // useCurrentLocation: showCurrentLocation, + // ) - onPlacePicked: (PickResult result) { - print(result.adrAddress); - widget.changePageViewIndex(3); - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: - LocationPage( - latitude: latitude, - longitude: longitude, - ), - ), - ); - }, - label: TranslationBase.of(context).addNewAddress, + ), + if (widget.model.addressesList.isNotEmpty) + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Container( + height: 60, + width: MediaQuery.of(context).size.width * .9, + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + child: DropdownButtonHideUnderline( + child: ButtonTheme( + alignedDropdown: true, + child: DropdownButton( + hint: Text( + widget.model.addressesList[0].address1, + style: TextStyle(color: CustomColors.black, fontSize: 14), ), - SizedBox(height: 10,), - SecondaryButton( - color: Colors.red[800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.patientERInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.patientERInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, + iconEnabledColor: CustomColors.grey2, + style: TextStyle(color: CustomColors.black, fontSize: 14), + dropdownColor: CustomColors.white, + value: _selectedAddress, + items: widget.model.addressesList.map((AddressInfo value) { + return DropdownMenuItem( + value: value, + child: new AutoSizeText( + value.address1, + ), + ); + }).toList(), + onChanged: (r) {}, + underline: Container( + height: 0, ), - ], + ), ), ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - if(widget.model.addressesList.isNotEmpty) - Container( - child: InkWell( - onTap: () => - confirmSelectLocationDialog(widget.model.addressesList), - child: Container( - padding: EdgeInsets.all(10), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded(child: Texts(getAddressName(), fontSize: 14,),), - Icon(Icons.arrow_drop_down) - ], + ) + ]), + Positioned( + top: 80, + left: 20, + child: Row( + children: [ + Icon( + Icons.add_circle_rounded, + ), + InkWell( + child: Texts( + TranslationBase.of(context).addNewAddress, + fontWeight: FontWeight.bold, + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + ), + ], + )) + // Container( + // child: InkWell( + // onTap: () => confirmSelectLocationDialog(widget.model.addressesList), + // child: Container( + // padding: EdgeInsets.all(10), + // width: double.infinity, + // // height: 65, + // decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Expanded( + // child: Texts( + // getAddressName(), + // fontSize: 14, + // ), + // ), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // height: 56, + // width: double.infinity, + // color: Theme.of(context).scaffoldBackgroundColor, + // ) + ], + ), + bottomSheet: Container( + width: MediaQuery.of(context).size.width, + height: 70.0, + margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0), + child: Button( + onTap: () async { + Navigator.push( + context, + FadePage( + page: NewHomeHealthCareStepThreePage( + patientERInsertPresOrderRequestModel: widget.patientERInsertPresOrderRequestModel, + model: widget.model, ), ), - ), - height: 56, width: double.infinity, color: Theme - .of(context) - .scaffoldBackgroundColor, - - ) - ], + ); + }, + label: TranslationBase.of(context).continues, + backgroundColor: Colors.red[900], + ), ), ); } - void confirmSelectLocationDialog(List addresses) { showDialog( context: context, child: SelectLocationDialog( addresses: addresses, - selectedAddress: _selectedAddress - , + selectedAddress: _selectedAddress, onValueSelected: (value) { setLatitudeAndLongitude(latLong: value.latLong); setState(() { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index ab564cb7..fa9188db 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import '../StepsWidget.dart'; import 'new_Home_health_care_step_one_page.dart'; @@ -28,15 +28,13 @@ class NewHomeHealthCarePage extends StatefulWidget { _NewHomeHealthCarePageState createState() => _NewHomeHealthCarePageState(); } -class _NewHomeHealthCarePageState extends State - with TickerProviderStateMixin { +class _NewHomeHealthCarePageState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 1; double _latitude; double _longitude; - PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = - new PatientERInsertPresOrderRequestModel(); + PatientERInsertPresOrderRequestModel patientERInsertPresOrderRequestModel = new PatientERInsertPresOrderRequestModel(); @override void initState() { @@ -64,32 +62,23 @@ class _NewHomeHealthCarePageState extends State setState(() { _currentIndex = tab; }); - _controller.animateToPage(tab, - duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); + _controller.animateToPage(tab, duration: Duration(milliseconds: 800), curve: Curves.easeOutQuart); } @override Widget build(BuildContext context) { - void showConfirmMessage(HomeHealthCareViewModel model, - GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) { showDialog( context: context, child: ConfirmCancelOrderDialog( model: model, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, - editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast( - message: - TranslationBase.of(context).processDoneSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -106,15 +95,15 @@ class _NewHomeHealthCarePageState extends State height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - Container( - margin: EdgeInsets.only( - left: MediaQuery.of(context).size.width * 0.05, - right: MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: _changeCurrentTab, - ), - ), + // Container( + // margin: EdgeInsets.only( + // left: MediaQuery.of(context).size.width * 0.05, + // right: MediaQuery.of(context).size.width * 0.05), + // child: StepsWidget( + // index: _currentIndex, + // changeCurrentTab: _changeCurrentTab, + // ), + // ), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), @@ -130,248 +119,284 @@ class _NewHomeHealthCarePageState extends State ? FractionallySizedBox( widthFactor: 0.9, child: SingleChildScrollView( - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 12, - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .requestID, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - widget.model.pendingOrder.iD - .toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget.model.pendingOrder - .descriptionN - : widget.model.pendingOrder - .description, - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: - Theme.of(context).primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .pickupDate, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - DateUtil - .getDayMonthYearDateFormatted( - DateUtil - .convertStringToDate( - widget - .model - .pendingOrder - .createdOn)), - fontSize: 22, - ), - ], - ), - ), - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, - bottom: 15, - top: 15, - right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Theme.of(context) - .primaryColor), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context) - .serviceName, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - projectViewModel.isArabic - ? widget - .model - .hhcAllOrderDetail[ - index] - .descriptionN - : widget - .model - .hhcAllOrderDetail[ - index] - .description, - fontSize: 22, - bold: true, - ), - ], - ), - ), - ), - SizedBox( - height: 12, - ), - Center( + child: Row( + children: [ + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20.0)), child: Container( - width: MediaQuery.of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of(context) - .cancel - .toUpperCase(), - onTap: () { - showConfirmMessage( - widget.model, - widget.model - .hhcAllOrderDetail[0]); - }, - color: Colors.red[800], - disabled: false, - textColor: Theme.of(context) - .backgroundColor), - ), - ), - SizedBox( - height: 12, - ), - ], - ), - ), - ), - ) + padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10), + margin: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + decoration: BoxDecoration(boxShadow: [ + BoxShadow(color: Color(0xffcd9e1b), offset: Offset(-10, 0)), + ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).OrderStatus + + ' ' + + (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + bold: false, + fontSize: 12, + color: Color(0xffcd9e1b), + fontWeight: FontWeight.bold, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + fontSize: 14, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + bold: false, + fontSize: 18, + ), + Texts( + TranslationBase.of(context).serviceName, + fontSize: 12, + ), + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic + ? widget.model.hhcAllOrderDetail[index].descriptionN + : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 14, + ), + ), + ), + ], + ), + SecondaryButton( + onTap: () { + showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + }, + label: TranslationBase.of(context).cancel, + color: Colors.red[900], + small: true, + ) + ], + // ) + // ], + // ) + // ], + ), + ], + )) + ], + ))), + ) + ], + )) + + // Row( + // children: [ + // Expanded( + // flex: 1, + // child: ClipRRect( + // borderRadius: const BorderRadius.all(Radius.circular(20.0)), + // child: Container( + // padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20), + // margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), + // decoration: BoxDecoration( + // boxShadow: [ + // BoxShadow(color: Colors.green, offset: Offset(-5, 0)), + // ], + // )))), + // Expanded( + // flex: 5, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // width: double.infinity, + // padding: EdgeInsets.all(5), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus, + // bold: false, + // fontSize: 12, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description, + // fontSize: 12, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).requestID, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // widget.model.pendingOrder.iD.toString(), + // fontSize: 22, + // ), + // ], + // ), + // ), + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).pickupDate, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 22, + // ), + // ], + // ), + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 15, bottom: 15, top: 15, right: 15), + // decoration: BoxDecoration( + // border: Border( + // bottom: BorderSide( + // color: Colors.grey, + // width: 1.0, + // ), + // ), + // // borderRadius: BorderRadius.circular(12), + // color: Theme.of(context).primaryColor), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).serviceName, + // bold: false, + // fontSize: 13, + // ), + // SizedBox( + // height: 4, + // ), + // Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description, + // fontSize: 22, + // bold: true, + // ), + // ], + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // Center( + // child: Container( + // width: MediaQuery.of(context).size.width * 0.85, + // child: SecondaryButton( + // label: TranslationBase.of(context).cancel.toUpperCase(), + // onTap: () { + // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // }, + // color: Colors.red[800], + // disabled: false, + // textColor: Theme.of(context).backgroundColor), + // ), + // ), + // SizedBox( + // height: 12, + // ), + // ], + // ), + // ) + // ], + // ), + //), + ) : NewHomeHealthCareStepOnePage( changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, model: widget.model, ), - NewHomeHealthCareStepTowPage( - latitude: _latitude, - longitude: _longitude, - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ), - NewHomeHealthCareStepThreePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: - patientERInsertPresOrderRequestModel, - model: widget.model, - ) + // NewHomeHealthCareStepTowPage( + // latitude: _latitude, + // longitude: _longitude, + // changePageViewIndex: _changeCurrentTab, + // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + // model: widget.model, + // ), + // NewHomeHealthCareStepThreePage( + // changePageViewIndex: _changeCurrentTab, + // patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + // model: widget.model, + // ) ], ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 001ecbb1..a5979ca2 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -17,8 +17,7 @@ class HomeHealthCarePage extends StatefulWidget { _HomeHealthCarePageState createState() => _HomeHealthCarePageState(); } -class _HomeHealthCarePageState extends State - with SingleTickerProviderStateMixin { +class _HomeHealthCarePageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -43,75 +42,46 @@ class _HomeHealthCarePageState extends State isShowAppBar: true, description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, - imagesInfo: [ - ImagesInfo( - imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', - imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png') - ], + showNewAppBar: true, + showNewAppBarTitle: true, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/HHC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/HHC/en/0.png')], body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( preferredSize: Size.fromHeight(65.0), child: Stack( children: [ - Positioned( - bottom: 1, - left: 0, - right: 0, - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), - height: 70.0, - ), - ), - ), Center( - child: Container( - height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.7), - ), - color: Theme.of(context).primaryColor), - child: Center( - child: TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 5.0, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.red[800], - labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), - unselectedLabelColor: Colors.grey[800], - tabs: [ - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).homeHealthCare, - color: Colors.black, - ), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.tab, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts( + TranslationBase.of(context).homeHealthCare, + color: Colors.black, ), ), - Container( - width: MediaQuery.of(context).size.width * 0.37, - child: Center( - child: Texts( - TranslationBase.of(context).orderLog, - color: Colors.black, - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts( + TranslationBase.of(context).orderLog, + color: Colors.black, ), ), - ], - ), + ), + ], ), ), ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index c9d3f548..d620bcd4 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -931,6 +931,12 @@ String labelFrom({@required String className}) { return result; } +extension StringExtension on String { + String capitalize() { + return this.splitMapJoin(RegExp(r'\w+'), onMatch: (m) => '${m.group(0)}'.substring(0, 1).toUpperCase() + '${m.group(0)}'.substring(1).toLowerCase(), onNonMatch: (n) => ' '); + } +} + /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( GestureDetector(onTap: () {