|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.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/translations_delegate_base.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';
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'screens/cart-order-page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
|
|
|
|
|
|
|
|
int price = 0;
|
|
|
|
var languageID;
|
|
|
|
bool isOverQuantity = false;
|
|
|
|
bool isInWishlit = false;
|
|
|
|
var itemID;
|
|
|
|
var product;
|
|
|
|
var customerId;
|
|
|
|
CompareList compareItems = new CompareList();
|
|
|
|
PharmacyProduct specificationData;
|
|
|
|
|
|
|
|
class ProductDetailPage extends StatefulWidget {
|
|
|
|
final PharmacyProduct product;
|
|
|
|
ProductDetailPage(this.product);
|
|
|
|
@override
|
|
|
|
__ProductDetailPageState createState() => __ProductDetailPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
bool isTrue = true;
|
|
|
|
bool isDetails = true;
|
|
|
|
bool isReviews = false;
|
|
|
|
bool isAvailabilty = false;
|
|
|
|
dynamic wishlistItems;
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
price = 1;
|
|
|
|
specificationData = widget.product;
|
|
|
|
setState(() {
|
|
|
|
customerId = userInfo(widget.product.id, widget.product);
|
|
|
|
});
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return customerId != null
|
|
|
|
? DetailPageScafold(
|
|
|
|
appBarTitle: 'product detail page',
|
|
|
|
isShowAppBar: true,
|
|
|
|
isPharmacy: true,
|
|
|
|
isShowDecPage: 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: languageID == 'ar'
|
|
|
|
? 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),
|
|
|
|
),
|
|
|
|
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),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Container(
|
|
|
|
child: Text(
|
|
|
|
"there is no data",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
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;
|
|
|
|
isAvailabilty = 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;
|
|
|
|
isAvailabilty = 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;
|
|
|
|
isAvailabilty = true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).availability,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
isAvailabilty
|
|
|
|
? 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: 10,
|
|
|
|
),
|
|
|
|
Divider(height: 1, color: Colors.grey),
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
languageID == 'ar'
|
|
|
|
? widget.product.fullDescriptionn
|
|
|
|
: widget.product
|
|
|
|
.fullDescription ??
|
|
|
|
"",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontFamily: 'WorkSans-Regular'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
|
|
|
// Container(
|
|
|
|
// child: Text(
|
|
|
|
// languageID == 'ar'
|
|
|
|
// ? widget.product.fullDescriptionn
|
|
|
|
// : widget.product.fullDescription,
|
|
|
|
// 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(
|
|
|
|
// languageID == 'ar'
|
|
|
|
// ? widget.product.shortDescriptionn
|
|
|
|
// : widget.product.shortDescription,
|
|
|
|
// 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('No Reviews Available'),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: isAvailabilty
|
|
|
|
? BaseView<ProductDetailViewModel>(
|
|
|
|
onModelReady: (model) =>
|
|
|
|
model.getProductLocationData(),
|
|
|
|
builder: (_, model, wi) => model
|
|
|
|
.productLocationService
|
|
|
|
.length ==
|
|
|
|
0
|
|
|
|
? Container(
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
'No location Available'),
|
|
|
|
)
|
|
|
|
: 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(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
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" +
|
|
|
|
fixingString(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(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomSheet: footerWidget(
|
|
|
|
widget.product.stockAvailability != 'Out of stock',
|
|
|
|
widget.product.orderMaximumQuantity,
|
|
|
|
widget.product.orderMinimumQuantity,
|
|
|
|
widget.product.stockQuantity,
|
|
|
|
widget.product),
|
|
|
|
)
|
|
|
|
: AppScaffold(
|
|
|
|
appBarTitle: 'product detail page',
|
|
|
|
isShowAppBar: true,
|
|
|
|
isPharmacy: true,
|
|
|
|
isShowDecPage: 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: languageID == 'ar'
|
|
|
|
? 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),
|
|
|
|
),
|
|
|
|
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;
|
|
|
|
isAvailabilty = 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;
|
|
|
|
isAvailabilty = 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;
|
|
|
|
isAvailabilty = true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).availability,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
isAvailabilty
|
|
|
|
? 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(
|
|
|
|
languageID == 'ar'
|
|
|
|
? 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(
|
|
|
|
languageID == 'ar'
|
|
|
|
? 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('No Reviews Available'),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: isAvailabilty
|
|
|
|
? 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(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
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" +
|
|
|
|
fixingString(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(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomSheet: footerWidget(
|
|
|
|
widget.product.stockAvailability != 'Out of stock',
|
|
|
|
widget.product.orderMaximumQuantity,
|
|
|
|
widget.product.orderMinimumQuantity,
|
|
|
|
widget.product.stockQuantity,
|
|
|
|
widget.product),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class footerWidget extends StatefulWidget {
|
|
|
|
final bool isAvailble;
|
|
|
|
final int maxQuantity;
|
|
|
|
final int minQuantity;
|
|
|
|
final int quantityLimit;
|
|
|
|
final PharmacyProduct item;
|
|
|
|
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
|
|
|
|
this.quantityLimit, this.item);
|
|
|
|
@override
|
|
|
|
_footerWidgetState createState() => _footerWidgetState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _footerWidgetState extends State<footerWidget> {
|
|
|
|
double quantityUI = 70;
|
|
|
|
bool showUI = false;
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: quantityUI,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
showUI
|
|
|
|
? Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 90,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).quantity,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 15, fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// ListView(
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
// children: [
|
|
|
|
// itemQuantity(),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
Container(
|
|
|
|
// margin: EdgeInsets.symmetric(vertical: 20.0),
|
|
|
|
height: 50.0,
|
|
|
|
child: ListView(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
children: <Widget>[
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'1',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 1;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'2',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 2;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'3',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 3;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'4',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 4;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'5',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 5;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'6',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 6;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'7',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 7;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'8',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 8;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'9',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 9;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 50.0,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Text(
|
|
|
|
'10',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
price = 10;
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
return price;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: 50.0,
|
|
|
|
child: TextField(
|
|
|
|
decoration:
|
|
|
|
InputDecoration(labelText: 'quantity #'),
|
|
|
|
onChanged: (text) {
|
|
|
|
print(price);
|
|
|
|
print(widget.quantityLimit);
|
|
|
|
if (int.tryParse(text) == null) {
|
|
|
|
text = '';
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
price = int.parse(text);
|
|
|
|
if (price >= widget.quantityLimit) {
|
|
|
|
isOverQuantity = true;
|
|
|
|
} else {
|
|
|
|
isOverQuantity = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: 70,
|
|
|
|
height: 50,
|
|
|
|
child: FlatButton(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 4,
|
|
|
|
child: Text(
|
|
|
|
price.toString(),
|
|
|
|
style: TextStyle(fontSize: 20),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 5,
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).quantityShortcut,
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
if (showUI) {
|
|
|
|
quantityUI = 70;
|
|
|
|
showUI = false;
|
|
|
|
} else {
|
|
|
|
quantityUI = 150;
|
|
|
|
showUI = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
!widget.isAvailble && price > 0 || price > widget.quantityLimit
|
|
|
|
? Container(
|
|
|
|
width: 190,
|
|
|
|
height: 46,
|
|
|
|
color: Colors.grey,
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).addToCart,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 15),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
addToCartFunction(price, widget.item.id);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 190,
|
|
|
|
height: 46,
|
|
|
|
color: Colors.green,
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).addToCart,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 15),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
!widget.isAvailble && price > 0 || price > widget.quantityLimit
|
|
|
|
? Container(
|
|
|
|
width: 120,
|
|
|
|
height: 46,
|
|
|
|
color: Colors.grey,
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).buyNow,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 15),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
print('buy now');
|
|
|
|
addToCartFunction(price, widget.item.id);
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => CartOrderPage()),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 120,
|
|
|
|
height: 46,
|
|
|
|
color: Colors.blue,
|
|
|
|
child: Text(
|
|
|
|
TranslationBase.of(context).buyNow,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 15),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class productNameAndPrice extends StatefulWidget {
|
|
|
|
BuildContext context;
|
|
|
|
PharmacyProduct item;
|
|
|
|
productNameAndPrice(this.context, this.item);
|
|
|
|
@override
|
|
|
|
_productNameAndPriceState createState() => _productNameAndPriceState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _productNameAndPriceState extends State<productNameAndPrice> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
widget.item.price.toString(),
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 40,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
widget.item.stockAvailability,
|
|
|
|
style: widget.item.stockAvailability == 'Out of stock'
|
|
|
|
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
|
|
|
|
: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold, color: Colors.green),
|
|
|
|
),
|
|
|
|
SizedBox(width: 20),
|
|
|
|
widget.item.stockAvailability == 'Out of stock' &&
|
|
|
|
customerId != null
|
|
|
|
? InkWell(
|
|
|
|
onTap: () =>
|
|
|
|
notifyMeWhenAvailable(context, widget.item.id),
|
|
|
|
child: Row(children: [
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).notifyMe,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.blue,
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(width: 4),
|
|
|
|
Icon(
|
|
|
|
FontAwesomeIcons.bell,
|
|
|
|
color: Colors.blue,
|
|
|
|
size: 15.0,
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
: 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: () {
|
|
|
|
setState(() {
|
|
|
|
addToWishlistFunction(widget.item.id);
|
|
|
|
});
|
|
|
|
// MyStatelessWidget();
|
|
|
|
},
|
|
|
|
)
|
|
|
|
: IconButton(
|
|
|
|
icon: Icon(Icons.favorite),
|
|
|
|
color: Colors.red,
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
deleteFromWishlistFunction(widget.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'
|
|
|
|
? widget.item.fullDescriptionn
|
|
|
|
: widget.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: widget.item.rxMessage != null
|
|
|
|
? Text(
|
|
|
|
languageID == 'ar'
|
|
|
|
? widget.item.rxMessagen.toString()
|
|
|
|
: widget.item.rxMessage.toString(),
|
|
|
|
style: TextStyle(color: Colors.red, fontSize: 10),
|
|
|
|
)
|
|
|
|
: Container()),
|
|
|
|
),
|
|
|
|
widget.item.rxMessage != null
|
|
|
|
? Icon(
|
|
|
|
FontAwesomeIcons.questionCircle,
|
|
|
|
color: Colors.red,
|
|
|
|
size: 15.0,
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//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,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Container(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 15.0),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
top: BorderSide(width: 0.5, color: Colors.grey),
|
|
|
|
left: BorderSide(width: 0.5, color: Colors.grey),
|
|
|
|
right: BorderSide(width: 0.5, color: Colors.grey),
|
|
|
|
bottom: BorderSide(width: 0.5, color: Colors.grey),
|
|
|
|
),
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
child: const Text('1',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(color: Color(0xFF000000))),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
fixingString(txt) {
|
|
|
|
String stringTxt;
|
|
|
|
String newTxt;
|
|
|
|
stringTxt = txt.toString();
|
|
|
|
newTxt = stringTxt.split('.')[1];
|
|
|
|
|
|
|
|
return newTxt;
|
|
|
|
}
|
|
|
|
|
|
|
|
getLanguageID() async {
|
|
|
|
languageID = await sharedPref.getString(APP_LANGUAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
getSpecificationData(itemID) async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
specificationData = await x.productSpecificationData(itemID);
|
|
|
|
}
|
|
|
|
|
|
|
|
addToCartFunction(quantity, itemID) async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
await x.addToCartData(quantity, itemID);
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyMeWhenAvailable(context, itemId) async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
await x.notifyMe(customerId, itemId);
|
|
|
|
}
|
|
|
|
|
|
|
|
addToWishlistFunction(itemID) async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
isInWishlit = true;
|
|
|
|
await x.addToWishlistData(itemID);
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteFromWishlistFunction(itemID) async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
isInWishlit = false;
|
|
|
|
await x.addToWishlistData(itemID);
|
|
|
|
}
|
|
|
|
|
|
|
|
checkWishlist() async {
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
await x.checkWishlistData();
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class sttingModalBottomSheet extends StatelessWidget {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
settingModalBottomSheet(context) {
|
|
|
|
showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext bc) {
|
|
|
|
return Container(
|
|
|
|
child: new Wrap(
|
|
|
|
children: <Widget>[
|
|
|
|
new ListTile(
|
|
|
|
leading: new Icon(Icons.shopping_cart),
|
|
|
|
title: new Text('Add to cart'),
|
|
|
|
onTap: () => {
|
|
|
|
if (price > 0)
|
|
|
|
{addToCartFunction(price, itemID)}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
message: "you should add quantity")
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new ListTile(
|
|
|
|
leading: new Icon(Icons.favorite_border),
|
|
|
|
title: new Text('Add to wishlist'),
|
|
|
|
onTap: () => {addToWishlistFunction(itemID)},
|
|
|
|
),
|
|
|
|
new ListTile(
|
|
|
|
leading: new Icon(Icons.compare),
|
|
|
|
title: new Text('Compare'),
|
|
|
|
onTap: () => {
|
|
|
|
Provider.of<CompareList>(context, listen: false)
|
|
|
|
.addItem(specificationData),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|