From f20883184eba23730b50d5341962a2e274f8dcf0 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Wed, 15 Sep 2021 10:32:11 +0300 Subject: [PATCH] CMC 1.5 --- .../NewCMC/cmc_location_page.dart | 177 +++++++++--------- .../NewCMC/new_cmc_step_three_page.dart | 19 +- .../NewCMC/new_cmc_step_tow_page.dart | 6 +- 3 files changed, 104 insertions(+), 98 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index e8b1f2c0..0f9fe6dd 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -49,96 +49,97 @@ class _CMCLocationPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) {}, - builder: (_, model, widget) => AppScaffold( - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - showNewAppBar: true, - showNewAppBarTitle: true, - backgroundColor: CustomColors.appBackgroudGreyColor, - 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).addNewAddress, - 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: CustomColors.accentColor, - textColor: Colors.white, - onTap: () async { - print(selectedPlace); - AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: selectedPlace.formattedAddress, - address2: selectedPlace.formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBar: true, + showNewAppBarTitle: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + 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).addNewAddress, + 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: CustomColors.accentColor, + textColor: Colors.white, + onTap: () async { + print(selectedPlace); + 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; - } - }); + 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(); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), + 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(); + }, + label: TranslationBase.of(context).addNewAddress, ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + ), + ); } } 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 77291083..3b7e5a22 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 @@ -132,15 +132,16 @@ class _NewCMCStepThreePageState extends State { // _controller.complete(controller); // }, // ), - child: Image.network("https://maps.googleapis.com/maps/api/staticmap?center=" + - widget.cmcInsertPresOrderRequestModel.latitude.toString() + - "," + - widget.cmcInsertPresOrderRequestModel.longitude.toString() + - "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + - widget.cmcInsertPresOrderRequestModel.latitude.toString() + - "," + - widget.cmcInsertPresOrderRequestModel.longitude.toString() + - "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=" + + widget.cmcInsertPresOrderRequestModel.latitude.toString() + + "," + + widget.cmcInsertPresOrderRequestModel.longitude.toString() + + "&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" + + widget.cmcInsertPresOrderRequestModel.latitude.toString() + + "," + + widget.cmcInsertPresOrderRequestModel.longitude.toString() + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8", width: double.infinity, height: double.infinity, fit: BoxFit.cover, 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 4525d89b..1f327e98 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 @@ -194,7 +194,11 @@ class _NewCMCStepTowPageState extends State { longitude: longitude, ), ), - ); + ).then((value) { + setState(() { + + }); + }); }, child: Padding( padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),