From c87a391a2350946aea061fa1545ec3dd2383a3a8 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 17 Nov 2021 11:06:19 +0300 Subject: [PATCH 1/2] fixed wishlist issue --- lib/pages/pharmacies/ProductCheckTypeWidget.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 46c5e7a3..d0a112c6 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -31,7 +31,8 @@ class _ProductCheckTypeWidgetState extends State { ? widget.model.wishListList[index].product.namen : widget.model.wishListList[index].product.name, productPrice: widget.model.wishListList[index].subtotal, - productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + // productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + productRate: widget.model.wishListList[index].product.approvedRatingSum.toDouble(), approvedTotalReviews:widget.model.wishListList[index].product.approvedTotalReviews, productImage: widget.model.wishListList[index].product.images[0].src, productID: widget.model.wishListList[index].product.id, From ffc2f2b4bb70fa2fa2510bde49254d7d99ed2d11 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 17 Nov 2021 15:43:13 +0300 Subject: [PATCH 2/2] fix issues --- .../screens/product-details/availability_info.dart | 10 ++++++++-- .../screens/product-details/product-detail.dart | 12 +++++++++++- .../screens/product-details/reviews_info.dart | 8 +++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 13e94c87..2c10c8bf 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -49,7 +51,9 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.location_on), color: Colors.red, - onPressed: () {}, + onPressed: () { + MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].latitude), previousModel.productLocationService[index].locationDescription); + }, ), ), Expanded( @@ -57,7 +61,9 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.phone), color: Colors.red, - onPressed: () {}, + onPressed: () { + launch("tel://" + previousModel.productLocationService[index].phoneNumber); + }, ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index b838f2dd..4ca6476b 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -288,10 +288,20 @@ class __ProductDetailPageState extends State { product: widget.product, previousModel: model, ) - : isAvailability + : isAvailability && widget.product.stockAvailability != "Out of stock" ? AvailabilityInfo( previousModel: model ) + : isAvailability && widget.product.stockAvailability == "Out of stock" + ? Container( + // padding: EdgeInsets.all(15), + padding: EdgeInsets.fromLTRB(15,15,15,20), + margin: EdgeInsets.only(bottom: 20), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) : Container(), ], ), diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index bc1e865c..e3050927 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -32,9 +32,11 @@ class ReviewsInfo extends StatelessWidget { children: [ Expanded( child: Container( - child: Text( - previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " - + previousModel.productDetailService[0].reviews[index].customer.lastName.toString(), + child: Text(previousModel.productDetailService[0].reviews[index].customer.firstName != null + && previousModel.productDetailService[0].reviews[index].customer.firstName != null + ? previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " + + previousModel.productDetailService[0].reviews[index].customer.lastName.toString() + :"", // previousModel.productDetailService[0] // .reviews[index].customerId // .toString(),