|
|
|
|
@ -1,23 +1,22 @@
|
|
|
|
|
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/pages/pharmacies/compare-list.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.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:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.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;
|
|
|
|
|
@ -30,7 +29,9 @@ PharmacyProduct specificationData;
|
|
|
|
|
|
|
|
|
|
class ProductDetailPage extends StatefulWidget {
|
|
|
|
|
final PharmacyProduct product;
|
|
|
|
|
|
|
|
|
|
ProductDetailPage(this.product);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
__ProductDetailPageState createState() => __ProductDetailPageState();
|
|
|
|
|
}
|
|
|
|
|
@ -42,8 +43,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
bool isAvailabilty = false;
|
|
|
|
|
dynamic wishlistItems;
|
|
|
|
|
var model;
|
|
|
|
|
|
|
|
|
|
// String ProductId="4561";
|
|
|
|
|
String productId = "";
|
|
|
|
|
|
|
|
|
|
checkWishlist() async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
|
@ -62,6 +65,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
price = 1;
|
|
|
|
|
specificationData = widget.product;
|
|
|
|
|
@ -613,21 +617,20 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
Container(
|
|
|
|
|
width: 410,
|
|
|
|
|
height: 50,
|
|
|
|
|
// margin: EdgeInsets.only(bottom: 5),
|
|
|
|
|
// 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,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
@ -636,208 +639,252 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
|
|
|
|
|
height: 210,
|
|
|
|
|
margin: EdgeInsets.only(bottom: 75),
|
|
|
|
|
padding: EdgeInsets.only(bottom: 5),
|
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
|
|
|
|
child: BaseView<PharmacyModuleViewModel>(
|
|
|
|
|
onModelReady: (model) =>
|
|
|
|
|
model.getRecommendedProducts(widget.product.id.toString()),
|
|
|
|
|
builder: (_, model, wi) =>
|
|
|
|
|
Container(
|
|
|
|
|
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);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
//
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
|
0, 16, 10, 16),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
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(),
|
|
|
|
|
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,
|
|
|
|
|
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(
|
|
|
|
|
// 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),
|
|
|
|
|
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(),
|
|
|
|
|
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()})",
|
|
|
|
|
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,
|
|
|
|
|
fontSize:
|
|
|
|
|
12,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
// child: Text("NO DATA"),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -1341,8 +1388,10 @@ class footerWidget extends StatefulWidget {
|
|
|
|
|
final int minQuantity;
|
|
|
|
|
final int quantityLimit;
|
|
|
|
|
final PharmacyProduct item;
|
|
|
|
|
|
|
|
|
|
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
|
|
|
|
|
this.quantityLimit, this.item);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_footerWidgetState createState() => _footerWidgetState();
|
|
|
|
|
}
|
|
|
|
|
@ -1350,6 +1399,7 @@ class footerWidget extends StatefulWidget {
|
|
|
|
|
class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
double quantityUI = 70;
|
|
|
|
|
bool showUI = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
@ -1752,7 +1802,7 @@ class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
addToCartFunction(price, widget.item.id);
|
|
|
|
|
addToCartFunction(price, widget.item.id, context);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
@ -1792,11 +1842,10 @@ class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
print('buy now');
|
|
|
|
|
addToCartFunction(price, widget.item.id);
|
|
|
|
|
addToCartFunction(price, widget.item.id, context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page:
|
|
|
|
|
CartOrderPage()),
|
|
|
|
|
FadePage(page: CartOrderPage()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -1824,7 +1873,9 @@ class _footerWidgetState extends State<footerWidget> {
|
|
|
|
|
class productNameAndPrice extends StatefulWidget {
|
|
|
|
|
BuildContext context;
|
|
|
|
|
PharmacyProduct item;
|
|
|
|
|
|
|
|
|
|
productNameAndPrice(this.context, this.item);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_productNameAndPriceState createState() => _productNameAndPriceState();
|
|
|
|
|
}
|
|
|
|
|
@ -2014,9 +2065,12 @@ getSpecificationData(itemID) async {
|
|
|
|
|
specificationData = await x.productSpecificationData(itemID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addToCartFunction(quantity, itemID) async {
|
|
|
|
|
addToCartFunction(quantity, itemID, BuildContext context) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ProductDetailViewModel x = new ProductDetailViewModel();
|
|
|
|
|
await x.addToCartData(quantity, itemID);
|
|
|
|
|
await x.addToCartData(quantity, itemID).then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notifyMeWhenAvailable(context, itemId) async {
|
|
|
|
|
@ -2071,7 +2125,7 @@ settingModalBottomSheet(context) {
|
|
|
|
|
title: Text('Add to cart'),
|
|
|
|
|
onTap: () => {
|
|
|
|
|
if (price > 0)
|
|
|
|
|
{addToCartFunction(price, itemID)}
|
|
|
|
|
{addToCartFunction(price, itemID, context)}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
|