|
|
|
|
@ -105,8 +105,7 @@ class __ProductDetailPageState extends State<ProductDetailPage>
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return customerId != null
|
|
|
|
|
? AppScaffold(
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).productDetails,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
@ -399,500 +398,8 @@ class __ProductDetailPageState extends State<ProductDetailPage>
|
|
|
|
|
isOverQuantity: isOverQuantity,
|
|
|
|
|
addToCartFunction: addToCartFunction,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).productDetails,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
showPharmacyCart: false,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Image.network(
|
|
|
|
|
widget.product.images[0].src.trim(),
|
|
|
|
|
),
|
|
|
|
|
widget.product.discountDescription != null
|
|
|
|
|
? Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 50,
|
|
|
|
|
color: Colors.yellowAccent,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
child: projectViewModel.isArabic
|
|
|
|
|
? Text(
|
|
|
|
|
widget.product
|
|
|
|
|
.discountDescriptionn,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 17),
|
|
|
|
|
)
|
|
|
|
|
: Text(
|
|
|
|
|
widget.product
|
|
|
|
|
.discountDescription,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 17),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 0,
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Image(
|
|
|
|
|
image: AssetImage(
|
|
|
|
|
'assets/images/offer.png'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: 500,
|
|
|
|
|
height: 150,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: ProductNameAndPrice(
|
|
|
|
|
context,
|
|
|
|
|
widget.product,
|
|
|
|
|
customerId: customerId,
|
|
|
|
|
addToWishlistFunction: addToWishlistFunction,
|
|
|
|
|
deleteFromWishlistFunction: deleteFromWishlistFunction,
|
|
|
|
|
notifyMeWhenAvailable: notifyMeWhenAvailable,
|
|
|
|
|
isInWishList: isInWishList,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: 500,
|
|
|
|
|
height: 120,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).specification,
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(color: Colors.grey)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: 500,
|
|
|
|
|
margin: EdgeInsets.only(bottom: 100),
|
|
|
|
|
// height: 350,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
FlatButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isDetails = true;
|
|
|
|
|
isReviews = false;
|
|
|
|
|
isAvailability = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).details,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isDetails
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
FlatButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isDetails = false;
|
|
|
|
|
isReviews = true;
|
|
|
|
|
isAvailability = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).reviews,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isReviews
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
FlatButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isDetails = false;
|
|
|
|
|
isReviews = false;
|
|
|
|
|
isAvailability = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).availability,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
isAvailability
|
|
|
|
|
? Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
height: 5,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
isDetails
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).description,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 17,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1, color: Colors.grey),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? widget.product.shortDescriptionn
|
|
|
|
|
: widget.product.shortDescription,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontFamily: 'WorkSans-Regular'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).howToUse,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 17,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 6,
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 2, color: Colors.grey),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? widget.product.fullDescriptionn
|
|
|
|
|
: widget.product.fullDescription,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontFamily: 'WorkSans-Regular'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: isReviews
|
|
|
|
|
? BaseView<ProductDetailViewModel>(
|
|
|
|
|
onModelReady: (model) =>
|
|
|
|
|
model.getProductReviewsData(
|
|
|
|
|
widget.product.id),
|
|
|
|
|
builder: (_, model, wi) => model
|
|
|
|
|
.productDetailService
|
|
|
|
|
.length !=
|
|
|
|
|
0 &&
|
|
|
|
|
model.productDetailService[0]
|
|
|
|
|
.reviews.length !=
|
|
|
|
|
0
|
|
|
|
|
? ListView.builder(
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
itemCount: model
|
|
|
|
|
.productDetailService[0]
|
|
|
|
|
.reviews
|
|
|
|
|
.length,
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (BuildContext context,
|
|
|
|
|
int index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
model
|
|
|
|
|
.productDetailService[
|
|
|
|
|
0]
|
|
|
|
|
.reviews[
|
|
|
|
|
index]
|
|
|
|
|
.customerId
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 17,
|
|
|
|
|
color: Colors
|
|
|
|
|
.grey,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(
|
|
|
|
|
left: 210),
|
|
|
|
|
child: RatingBar
|
|
|
|
|
.readOnly(
|
|
|
|
|
initialRating: model
|
|
|
|
|
.productDetailService[
|
|
|
|
|
0]
|
|
|
|
|
.reviews[
|
|
|
|
|
index]
|
|
|
|
|
.rating
|
|
|
|
|
.toDouble(),
|
|
|
|
|
size: 15.0,
|
|
|
|
|
filledColor:
|
|
|
|
|
Colors.yellow[
|
|
|
|
|
700],
|
|
|
|
|
emptyColor: Colors
|
|
|
|
|
.grey[500],
|
|
|
|
|
isHalfAllowed:
|
|
|
|
|
true,
|
|
|
|
|
halfFilledIcon:
|
|
|
|
|
Icons
|
|
|
|
|
.star_half,
|
|
|
|
|
filledIcon:
|
|
|
|
|
Icons.star,
|
|
|
|
|
emptyIcon:
|
|
|
|
|
Icons.star,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Text(
|
|
|
|
|
model
|
|
|
|
|
.productDetailService[
|
|
|
|
|
0]
|
|
|
|
|
.reviews[index]
|
|
|
|
|
.reviewText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 50,
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1,
|
|
|
|
|
color: Colors.grey),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.noReviewsAvailable),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: isAvailability
|
|
|
|
|
? BaseView<ProductDetailViewModel>(
|
|
|
|
|
onModelReady: (model) =>
|
|
|
|
|
model.getProductLocationData(),
|
|
|
|
|
builder: (_, model, wi) =>
|
|
|
|
|
ListView.builder(
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: model
|
|
|
|
|
.productLocationService.length,
|
|
|
|
|
itemBuilder: (BuildContext context,
|
|
|
|
|
int index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Image.network(model
|
|
|
|
|
.productLocationService[
|
|
|
|
|
index]
|
|
|
|
|
.projectImageUrl),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: Text(
|
|
|
|
|
model
|
|
|
|
|
.productLocationService[
|
|
|
|
|
index]
|
|
|
|
|
.locationDescription +
|
|
|
|
|
"\n" +
|
|
|
|
|
convertCityName(
|
|
|
|
|
model
|
|
|
|
|
.productLocationService[
|
|
|
|
|
0]
|
|
|
|
|
.cityName
|
|
|
|
|
.toString(),
|
|
|
|
|
),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(Icons
|
|
|
|
|
.location_on),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon:
|
|
|
|
|
Icon(Icons.phone),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
height: 1.2,
|
|
|
|
|
color: Colors.grey)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: FooterWidget(
|
|
|
|
|
widget.product.stockAvailability != 'Out of stock',
|
|
|
|
|
widget.product.orderMaximumQuantity,
|
|
|
|
|
widget.product.orderMinimumQuantity,
|
|
|
|
|
widget.product.stockQuantity,
|
|
|
|
|
widget.product,
|
|
|
|
|
price: price,
|
|
|
|
|
isOverQuantity: isOverQuantity,
|
|
|
|
|
addToCartFunction: addToCartFunction,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|