|
|
|
|
@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
|
|
|
|
|
@ -15,8 +14,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
@ -111,8 +108,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
await addToWishlistFunction(itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
deleteFromWishlistFunction: () async {
|
|
|
|
|
await deleteFromWishlistFunction(
|
|
|
|
|
itemID: itemID, model: model);
|
|
|
|
|
await deleteFromWishlistFunction(itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
isInWishList: isInWishList,
|
|
|
|
|
addToCartFunction: addToCartFunction,
|
|
|
|
|
@ -133,8 +129,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (widget.product.discountDescription != null)
|
|
|
|
|
DiscountDescription(product: widget.product)
|
|
|
|
|
if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -152,21 +147,15 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
deleteFromWishlistFunction: (item) {
|
|
|
|
|
deleteFromWishlistFunction(
|
|
|
|
|
itemID: item, model: model);
|
|
|
|
|
deleteFromWishlistFunction(itemID: item, model: model);
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
notifyMeWhenAvailable: (context, itemId) {
|
|
|
|
|
notifyMeWhenAvailable(
|
|
|
|
|
itemId: itemId,
|
|
|
|
|
customerId: customerId,
|
|
|
|
|
model: model);
|
|
|
|
|
notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model);
|
|
|
|
|
},
|
|
|
|
|
isInWishList: isInWishList,
|
|
|
|
|
isStockAvailable: model.isStockAvailable,
|
|
|
|
|
stockAvailability: projectViewModel.isArabic
|
|
|
|
|
? model.stockAvailabilityn
|
|
|
|
|
: model.stockAvailability,
|
|
|
|
|
stockAvailability: projectViewModel.isArabic ? model.stockAvailabilityn : model.stockAvailability,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -179,8 +168,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
vertical: 15, horizontal: 10),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(context).specification,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
@ -217,16 +205,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).details,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isDetails
|
|
|
|
|
? Colors.green
|
|
|
|
|
: Colors.transparent,
|
|
|
|
|
color: isDetails ? Colors.green : Colors.transparent,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -237,14 +221,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
children: [
|
|
|
|
|
FlatButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (widget.product.approvedTotalReviews >
|
|
|
|
|
0) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getProductReviewsData(
|
|
|
|
|
widget.product.id);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context);
|
|
|
|
|
if (widget.product.approvedTotalReviews > 0) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getProductReviewsData(widget.product.id);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
} else {
|
|
|
|
|
model.clearReview();
|
|
|
|
|
}
|
|
|
|
|
@ -256,16 +236,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).reviews,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isReviews
|
|
|
|
|
? Colors.green
|
|
|
|
|
: Colors.transparent,
|
|
|
|
|
color: isReviews ? Colors.green : Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -276,9 +252,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
children: [
|
|
|
|
|
FlatButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getProductLocationData();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getProductLocationData(widget.product.sku);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -289,16 +264,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).availability,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
CustomDivider(
|
|
|
|
|
color: isAvailability
|
|
|
|
|
? Colors.green
|
|
|
|
|
: Colors.transparent,
|
|
|
|
|
color: isAvailability ? Colors.green : Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -327,24 +298,22 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
RecommendedProducts(
|
|
|
|
|
product: widget.product,
|
|
|
|
|
productDetailViewModel: model,
|
|
|
|
|
addToWishlistFunction: (itemID) async {
|
|
|
|
|
await addToWishlistFunction(
|
|
|
|
|
itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
deleteFromWishlistFunction: (itemID) async {
|
|
|
|
|
await deleteFromWishlistFunction(
|
|
|
|
|
itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
if (projectViewModel.isLogin)
|
|
|
|
|
RecommendedProducts(
|
|
|
|
|
product: widget.product,
|
|
|
|
|
productDetailViewModel: model,
|
|
|
|
|
addToWishlistFunction: (itemID) async {
|
|
|
|
|
await addToWishlistFunction(itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
deleteFromWishlistFunction: (itemID) async {
|
|
|
|
|
await deleteFromWishlistFunction(itemID: itemID, model: model);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// : AppCircularProgressIndicator(),
|
|
|
|
|
bottomSheet: model.state == ViewState.Idle ||
|
|
|
|
|
model.state == ViewState.ErrorLocal
|
|
|
|
|
bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal
|
|
|
|
|
? FooterWidget(
|
|
|
|
|
model.isStockAvailable,
|
|
|
|
|
widget.product.orderMaximumQuantity,
|
|
|
|
|
@ -361,8 +330,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToShoppingCartFunction(
|
|
|
|
|
{quantity, itemID, ProductDetailViewModel model}) async {
|
|
|
|
|
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.addToCartData(quantity, itemID, context);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
@ -392,7 +360,6 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notifyMeWhenAvailable(
|
|
|
|
|
{itemId, customerId, ProductDetailViewModel model, context}) async {
|
|
|
|
|
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async {
|
|
|
|
|
await model.notifyMe(customerId, itemId, context);
|
|
|
|
|
}
|
|
|
|
|
|