|
|
|
|
@ -1,9 +1,13 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart';
|
|
|
|
|
@ -18,8 +22,7 @@ int price = 0;
|
|
|
|
|
var languageID;
|
|
|
|
|
bool isOverQuantity = false;
|
|
|
|
|
bool isInWishlit = false;
|
|
|
|
|
var itemID;
|
|
|
|
|
var product;
|
|
|
|
|
String itemID;
|
|
|
|
|
var customerId;
|
|
|
|
|
CompareList compareItems = new CompareList();
|
|
|
|
|
PharmacyProduct specificationData;
|
|
|
|
|
@ -37,16 +40,48 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
bool isReviews = false;
|
|
|
|
|
bool isAvailabilty = false;
|
|
|
|
|
dynamic wishlistItems;
|
|
|
|
|
var model;
|
|
|
|
|
// String ProductId="4561";
|
|
|
|
|
String productId = "";
|
|
|
|
|
checkWishlist() async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
|
await x.checkWishlistData();
|
|
|
|
|
|
|
|
|
|
// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < x.wishListItems.length; i++) {
|
|
|
|
|
if (itemID == x.wishListItems[i].product.id) {
|
|
|
|
|
isInWishlit = true;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
isInWishlit = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
void initState() {
|
|
|
|
|
price = 1;
|
|
|
|
|
specificationData = widget.product;
|
|
|
|
|
setState(() {
|
|
|
|
|
customerId = userInfo(widget.product.id, widget.product);
|
|
|
|
|
});
|
|
|
|
|
userInfo();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void userInfo() async {
|
|
|
|
|
print(specificationData);
|
|
|
|
|
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
|
|
|
|
if (customerId != null) {
|
|
|
|
|
itemID = widget.product.id;
|
|
|
|
|
checkWishlist();
|
|
|
|
|
// getSpecificationData(itemID);
|
|
|
|
|
}
|
|
|
|
|
print("customerId:$customerId");
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
// getSpecificationData(itemID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return customerId != null
|
|
|
|
|
? DetailPageScafold(
|
|
|
|
|
@ -160,7 +195,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: 500,
|
|
|
|
|
margin: EdgeInsets.only(bottom: 100),
|
|
|
|
|
margin: EdgeInsets.only(bottom: 6),
|
|
|
|
|
// height: 350,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -565,7 +600,248 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// Container(
|
|
|
|
|
// width: 500,
|
|
|
|
|
// height: 100,
|
|
|
|
|
// margin: EdgeInsets.only(bottom: 100),
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// child: Text("ENAD TEST"),
|
|
|
|
|
// ),
|
|
|
|
|
Container(
|
|
|
|
|
width: 410,
|
|
|
|
|
height: 50,
|
|
|
|
|
// margin: EdgeInsets.only(bottom: 5),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(context).recommended,
|
|
|
|
|
bold: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
height: 210,
|
|
|
|
|
margin: EdgeInsets.only(bottom: 75),
|
|
|
|
|
padding: EdgeInsets.only(bottom: 5),
|
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
|
|
|
|
child: BaseView<PharmacyModuleViewModel>(
|
|
|
|
|
onModelReady: (model) =>
|
|
|
|
|
model.getRecommendedProducts(widget.product.id.toString()),
|
|
|
|
|
builder: (_, model, wi) =>
|
|
|
|
|
Container(
|
|
|
|
|
child:
|
|
|
|
|
// Text(model.recommendedProductList[0].id),
|
|
|
|
|
model.recommendedProductList.length != null
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: model.recommendedProductList.length,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Card(
|
|
|
|
|
elevation: 2,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
side: BorderSide(
|
|
|
|
|
color: Colors.grey[300], width: 2),
|
|
|
|
|
borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 8,
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(15),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
|
|
|
width: MediaQuery.of(context).size.width / 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Stack(children: [
|
|
|
|
|
Container(
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
|
child: //true
|
|
|
|
|
itemID.contains(model.recommendedProductList[index].id)
|
|
|
|
|
// !isInWishlist
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons
|
|
|
|
|
.favorite_border),
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
iconSize: 30,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
addToWishlistFunction(itemID);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.favorite),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
iconSize: 30,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
deleteFromWishlistFunction(itemID);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
//
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
|
0, 16, 10, 16),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
// padding: EdgeInsets.only(left: 25, bottom: 20),
|
|
|
|
|
child: (model.recommendedProductList[index].images != null &&
|
|
|
|
|
model.recommendedProductList[index].images.length > 0)
|
|
|
|
|
? Image.network(
|
|
|
|
|
model.recommendedProductList[index].images[0].src.toString(),
|
|
|
|
|
// item.images[0].src,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: 60,
|
|
|
|
|
)
|
|
|
|
|
: Image.asset(
|
|
|
|
|
"assets/images/no_image.png",
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: 60,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: model
|
|
|
|
|
.recommendedProductList[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
5
|
|
|
|
|
: 0,
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
topLeft: Radius.circular(6)),
|
|
|
|
|
),
|
|
|
|
|
child: Texts(
|
|
|
|
|
model.recommendedProductList[index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? model
|
|
|
|
|
.recommendedProductList[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage
|
|
|
|
|
: "",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 6,
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
? model.recommendedProductList[index].namen
|
|
|
|
|
: model.recommendedProductList[index].name,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
// padding: const EdgeInsets.only(top: 15, bottom: 10),
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
top: 10, bottom: 5),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.recommendedProductList[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(right: 10),
|
|
|
|
|
// margin: EdgeInsets.only(left: 5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: RatingBar.readOnly(
|
|
|
|
|
initialRating: model
|
|
|
|
|
.recommendedProductList[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum
|
|
|
|
|
.toDouble(),
|
|
|
|
|
// initialRating: productRate,
|
|
|
|
|
size: 13.0,
|
|
|
|
|
filledColor:
|
|
|
|
|
Colors.yellow[700],
|
|
|
|
|
emptyColor: Colors.grey[500],
|
|
|
|
|
isHalfAllowed: true,
|
|
|
|
|
halfFilledIcon:
|
|
|
|
|
Icons.star_half,
|
|
|
|
|
filledIcon: Icons.star,
|
|
|
|
|
emptyIcon: Icons.star,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
|
|
|
|
|
// bold: true,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
// child: Text("NO DATA"),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -1455,7 +1731,9 @@ class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
!widget.isAvailble && price > 0 || price > widget.quantityLimit
|
|
|
|
|
!widget.isAvailble && price > 0 ||
|
|
|
|
|
price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null
|
|
|
|
|
? Container(
|
|
|
|
|
width: 190,
|
|
|
|
|
height: 46,
|
|
|
|
|
@ -1492,7 +1770,9 @@ class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 5,
|
|
|
|
|
),
|
|
|
|
|
!widget.isAvailble && price > 0 || price > widget.quantityLimit
|
|
|
|
|
!widget.isAvailble && price > 0 ||
|
|
|
|
|
price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null
|
|
|
|
|
? Container(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 46,
|
|
|
|
|
@ -1559,7 +1839,7 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
widget.item.price.toString(),
|
|
|
|
|
widget.item.price.toString() + " " + "SAR",
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -1604,27 +1884,24 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
|
),
|
|
|
|
|
child: !isInWishlit
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons.favorite_border),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
addToWishlistFunction(widget.item.id);
|
|
|
|
|
});
|
|
|
|
|
// MyStatelessWidget();
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(Icons.favorite),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
deleteFromWishlistFunction(widget.item.id);
|
|
|
|
|
});
|
|
|
|
|
// MyStatelessWidget();
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(!isInWishlit
|
|
|
|
|
? Icons.favorite_border
|
|
|
|
|
: Icons.favorite),
|
|
|
|
|
color: !isInWishlit ? Colors.white : Colors.red,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (customerId != null) {
|
|
|
|
|
if (!isInWishlit) {
|
|
|
|
|
await addToWishlistFunction(widget.item.id);
|
|
|
|
|
} else {
|
|
|
|
|
await deleteFromWishlistFunction(widget.item.id);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -1691,135 +1968,6 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//productNameAndPrice(BuildContext context, item) {
|
|
|
|
|
// return Column(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// item.price.toString(),
|
|
|
|
|
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// width: 40,
|
|
|
|
|
// ),
|
|
|
|
|
// Text(
|
|
|
|
|
// item.stockAvailability,
|
|
|
|
|
// style: item.stockAvailability == 'Out of stock'
|
|
|
|
|
// ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
|
|
|
|
|
// : TextStyle(fontWeight: FontWeight.bold, color: Colors.green),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(width: 20),
|
|
|
|
|
// item.stockAvailability == 'Out of stock'
|
|
|
|
|
// ? Text(
|
|
|
|
|
// TranslationBase.of(context).notifyMe,
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
// color: Colors.blue,
|
|
|
|
|
// decoration: TextDecoration.underline,
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// : Container(),
|
|
|
|
|
// item.stockAvailability == 'Out of stock'
|
|
|
|
|
// ? Icon(
|
|
|
|
|
// FontAwesomeIcons.bell,
|
|
|
|
|
// color: Colors.blue,
|
|
|
|
|
// size: 15.0,
|
|
|
|
|
// )
|
|
|
|
|
// : Container(),
|
|
|
|
|
//
|
|
|
|
|
// Container(
|
|
|
|
|
// margin: languageID=='ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25),
|
|
|
|
|
// width: 40,
|
|
|
|
|
// height: 40,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: Colors.grey,
|
|
|
|
|
// borderRadius: BorderRadius.circular(30),
|
|
|
|
|
// ),
|
|
|
|
|
// child: !isInWishlit ?IconButton(
|
|
|
|
|
// icon: Icon(Icons.favorite_border),
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// addToWishlistFunction(item.id);
|
|
|
|
|
//// MyStatelessWidget();
|
|
|
|
|
//
|
|
|
|
|
// },
|
|
|
|
|
// ):IconButton(
|
|
|
|
|
// icon: Icon(Icons.favorite),
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// deleteFromWishlistFunction(item.id);
|
|
|
|
|
//// MyStatelessWidget();
|
|
|
|
|
//
|
|
|
|
|
// },
|
|
|
|
|
// )
|
|
|
|
|
// ),
|
|
|
|
|
//
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(left: 5),
|
|
|
|
|
// child: Align(
|
|
|
|
|
// alignment:
|
|
|
|
|
// languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
|
|
|
|
|
// child: Text(
|
|
|
|
|
// languageID == 'ar' ? item.fullDescriptionn : item.fullDescription,
|
|
|
|
|
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 2,
|
|
|
|
|
// child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(right: 150),
|
|
|
|
|
// child: Align(
|
|
|
|
|
// alignment: Alignment.bottomLeft,
|
|
|
|
|
// child: RatingBar.readOnly(
|
|
|
|
|
// initialRating: 3,
|
|
|
|
|
// size: 15.0,
|
|
|
|
|
// filledColor: Colors.yellow[700],
|
|
|
|
|
// emptyColor: Colors.grey[500],
|
|
|
|
|
// isHalfAllowed: true,
|
|
|
|
|
// halfFilledIcon: Icons.star_half,
|
|
|
|
|
// filledIcon: Icons.star,
|
|
|
|
|
// emptyIcon: Icons.star,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: Container(
|
|
|
|
|
// child: item.rxMessage != null
|
|
|
|
|
// ? Text(
|
|
|
|
|
// languageID == 'ar'
|
|
|
|
|
// ? item.rxMessagen.toString()
|
|
|
|
|
// : item.rxMessage.toString(),
|
|
|
|
|
// style: TextStyle(color: Colors.red, fontSize: 10),
|
|
|
|
|
// )
|
|
|
|
|
// : Container()),
|
|
|
|
|
// ),
|
|
|
|
|
// item.rxMessage != null
|
|
|
|
|
// ? Icon(
|
|
|
|
|
// FontAwesomeIcons.questionCircle,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// size: 15.0,
|
|
|
|
|
// )
|
|
|
|
|
// : Container(),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
slideDetail() {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
@ -1884,23 +2032,21 @@ addToWishlistFunction(itemID) async {
|
|
|
|
|
deleteFromWishlistFunction(itemID) async {
|
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
|
isInWishlit = false;
|
|
|
|
|
await x.addToWishlistData(itemID);
|
|
|
|
|
await x.deletWishlistData(itemID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkWishlist() async {
|
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
|
await x.checkWishlistData();
|
|
|
|
|
|
|
|
|
|
// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < x.wishListItems.length; i++) {
|
|
|
|
|
print("---------Enad----wishlist---------------");
|
|
|
|
|
print(itemID);
|
|
|
|
|
print(x.wishListItems[i].product.id);
|
|
|
|
|
if (itemID == x.wishListItems[i].product.id) {
|
|
|
|
|
isInWishlit = true;
|
|
|
|
|
// print('in wishlist');
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
isInWishlit = false;
|
|
|
|
|
// print('not in wishlist');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1920,8 +2066,8 @@ settingModalBottomSheet(context) {
|
|
|
|
|
child: new Wrap(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new ListTile(
|
|
|
|
|
leading: new Icon(Icons.shopping_cart),
|
|
|
|
|
title: new Text('Add to cart'),
|
|
|
|
|
leading: Icon(Icons.shopping_cart),
|
|
|
|
|
title: Text('Add to cart'),
|
|
|
|
|
onTap: () => {
|
|
|
|
|
if (price > 0)
|
|
|
|
|
{addToCartFunction(price, itemID)}
|
|
|
|
|
@ -1931,14 +2077,14 @@ settingModalBottomSheet(context) {
|
|
|
|
|
message: "you should add quantity")
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
new ListTile(
|
|
|
|
|
leading: new Icon(Icons.favorite_border),
|
|
|
|
|
title: new Text('Add to wishlist'),
|
|
|
|
|
ListTile(
|
|
|
|
|
leading: Icon(Icons.favorite_border),
|
|
|
|
|
title: Text('Add to wishlist'),
|
|
|
|
|
onTap: () => {addToWishlistFunction(itemID)},
|
|
|
|
|
),
|
|
|
|
|
new ListTile(
|
|
|
|
|
leading: new Icon(Icons.compare),
|
|
|
|
|
title: new Text('Compare'),
|
|
|
|
|
ListTile(
|
|
|
|
|
leading: Icon(Icons.compare),
|
|
|
|
|
title: Text('Compare'),
|
|
|
|
|
onTap: () => {
|
|
|
|
|
Provider.of<CompareList>(context, listen: false)
|
|
|
|
|
.addItem(specificationData),
|
|
|
|
|
@ -1949,15 +2095,3 @@ settingModalBottomSheet(context) {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future userInfo(id, product) async {
|
|
|
|
|
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
|
|
|
|
|
if (customerId != null) {
|
|
|
|
|
itemID = id;
|
|
|
|
|
product = product;
|
|
|
|
|
checkWishlist();
|
|
|
|
|
}
|
|
|
|
|
print("customerId:$customerId");
|
|
|
|
|
return customerId;
|
|
|
|
|
// getSpecificationData(itemID);
|
|
|
|
|
}
|
|
|
|
|
|