fixed recommended products new design

merge-requests/277/head
Fatimah Alshammari 5 years ago
commit c629fcb85c

@ -227,7 +227,7 @@ const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactions
const CHANNEL = 3;
const GENERAL_ID = 'Cs2020@2016\$2958';
const IP_ADDRESS = '10.20.10.20';
const VERSION_ID = 6.1;
const VERSION_ID = 8.8;
const SETUP_ID = '91877';
const LANGUAGE = 2;
const PATIENT_OUT_SA = 0;

@ -385,4 +385,175 @@ class BaseAppClient {
return params;
}
pharmacyPost(String endPoint,
{Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
bool isAllowAny = false,
bool isExternal = false}) async {
String url;
if (isExternal) {
url = endPoint;
} else {
url = BASE_PHARMACY_URL + endPoint;
}
try {
//Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (!isExternal) {
String token = await sharedPref.getString(TOKEN);
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var user = await sharedPref.getObject(USER_PROFILE);
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
? body['SetupID']
: SETUP_ID
: SETUP_ID;
}
body['VersionID'] = VERSION_ID;
body['Channel'] = CHANNEL;
body['LanguageID'] = languageID == 'ar' ? 1 : 2;
body['IPAdress'] = IP_ADDRESS;
body['generalid'] = GENERAL_ID;
body['PatientOutSA'] = body.containsKey('PatientOutSA')
? body['PatientOutSA'] != null
? body['PatientOutSA']
: PATIENT_OUT_SA
: PATIENT_OUT_SA;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = DeviceTypeID;
if (!body.containsKey('IsPublicRequest')) {
body['PatientType'] = body.containsKey('PatientType')
? body['PatientType'] != null
? body['PatientType']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE
: PATIENT_TYPE;
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE_ID
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
body['PatientID'] = body['PatientID'] != null
? body['PatientID']
: user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = SESSION_ID; //getSessionId(token);
}
}
}
print("URL : $url");
print("Body : ${json.encode(body)}");
var ss = json.encode(body);
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(),
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
});
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {
var parsed = json.decode(response.body.toString());
if (parsed['Response_Message'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['ErrorType'] == 4) {
navigateToAppUpdate(
AppGlobal.context, parsed['ErrorEndUserMessage']);
}
if (isAllowAny) {
onSuccess(parsed, statusCode);
} else if (parsed['IsAuthenticated'] == null) {
if (parsed['isSMSSent'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else if (parsed['Result'] == 'OK') {
onSuccess(parsed, statusCode);
} else {
if (parsed != null) {
onSuccess(parsed, statusCode);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
}
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 &&
parsed['IsAuthenticated']) {
if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) {
if(parsed['ErrorSearchMsg'] == null ){
onFailure("Server Error found with no available message",
statusCode);
}else {
onFailure(parsed['ErrorSearchMsg'],
statusCode);
}
} else {
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
}
} else if (!parsed['IsAuthenticated']) {
await logout();
//helpers.showErrorToast('Your session expired Please login agian');
} else {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
}
}
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
} catch (e) {
print(e);
onFailure(e.toString(), -1);
}
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';

@ -139,7 +139,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
getRecommendedProducts(productId) async {
hasError = false;
setState(ViewState.Busy);
await _recommendedProductService.getRecommendedProducts(productId.toString());
await _recommendedProductService.getRecommendedProducts(productId);
if (_recommendedProductService.hasError) {
error = _recommendedProductService.error;
setState(ViewState.Error);

@ -24,7 +24,6 @@ class ProductDetailViewModel extends BaseViewModel{
Future getProductReviewsData(productID) async {
print('ENAD REview');
hasError = false;
setState(ViewState.Busy);
await _productDetailService.getProductReviews(productID);
@ -36,7 +35,6 @@ class ProductDetailViewModel extends BaseViewModel{
}
Future getProductLocationData() async {
print('ENAD in model view');
hasError = false;
setState(ViewState.Busy);
await _productDetailService.getProductAvailabiltyDetail();

@ -154,7 +154,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
PharmacyPage(),
PharmacyCategorisePage(),
// OffersCategorisePage(),
WishlistPage(),
WishlistPage(false),
PharmacyProfilePage(),
// Container(
// child: Text('text'),

@ -196,7 +196,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[0].name,
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].name :
"No data",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
@ -211,7 +213,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[1].name,
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].name :
"No data",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
@ -234,7 +238,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[2].name,
text:widget.data[index].specifications != null ?
widget.data[index].specifications[2].name :
"No data",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
@ -249,7 +255,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[3].name,
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].name :
"No data",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
@ -272,7 +280,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[4].name,
text:widget.data[index].specifications != null ?
widget.data[index].specifications[4].name :
"No data",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
@ -287,7 +297,9 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[5].name,
text:widget.data[index].specifications != null ?
widget.data[index].specifications[5].name :
"No data",
style: TextStyle(
color: Colors.black54,
fontSize: 15,

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/pages/final_products_page.dart';
import 'package:diplomaticquarterapp/pages/login/register-info.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart';
@ -61,7 +62,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 220,
width: double.infinity,
color: Colors.white,
child: topBrand(),
child: topBrand(context),
),
SizedBox(
height: 10,
@ -103,7 +104,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 10,
),
Container(
height: 230,
height: 290,
width: double.infinity,
color: Colors.white,
child: ListView.builder(
@ -125,7 +126,11 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
),
),
onTap: (){
print("ENAD");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FinalProductsPage(id: model.brandsListList[index].id.toString(),)),
);
},
);
}),
@ -139,7 +144,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
}
topBrand() {
topBrand(BuildContext context) {
return BaseView<BrandsViewModel>(
onModelReady: (model) => model.getTopBrandsData(),
builder: (_, model, wi) => GridView.count(
@ -180,7 +185,11 @@ topBrand() {
),
),
onTap: (){
print("ENAD");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FinalProductsPage(id: model.topBrandsListList[index].id.toString(),)),
);
},
),
],

@ -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);
}

@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
class WishlistPage extends StatefulWidget {
bool showBar;
WishlistPage(this.showBar);
@override
_WishlistPageState createState() => _WishlistPageState();
}
@ -17,9 +19,9 @@ class _WishlistPageState extends State<WishlistPage> {
onModelReady: (model) => model.getWishlistData(),
builder: (_, model, wi) => AppScaffold(
appBarTitle: 'Wishlist page',
isShowAppBar: false,
isShowAppBar: widget.showBar,
isShowDecPage: false,
isPharmacy: false,
isPharmacy: true,
baseViewModel: model,
body: model.wishListList.length == 0
? Container(

@ -247,7 +247,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
context,
MaterialPageRoute(
builder: (context) =>
WishlistPage()));
WishlistPage(true)));
},
child: Column(
children: <Widget>[

@ -88,7 +88,7 @@ class ProductDetailService extends BaseService {
"language_id": 1
}
};
await baseAppClient.post(GET_SHOPPING_CART,
await baseAppClient.pharmacyPost(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear();
response['shopping_carts'].forEach((item) {
@ -121,7 +121,7 @@ class ProductDetailService extends BaseService {
request = {
"shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1}
};
await baseAppClient.post(GET_SHOPPING_CART,
await baseAppClient.pharmacyPost(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
@ -172,6 +172,7 @@ class ProductDetailService extends BaseService {
_productSpecification.clear();
response['specification'].forEach((item) {
_productSpecification.add(SpecificationModel.fromJson(item));
print(_productSpecification);
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -162,7 +163,10 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
icon: Icon(Icons.shopping_cart),
color: Colors.white,
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CartOrderPage()),
);
})
: Container(),
if (showHomeAppBarIcon)

@ -66,8 +66,8 @@ class productTile extends StatelessWidget {
)
: Container(
margin: EdgeInsets.only(left: 10),
child: Image.asset(
"assets/images/no_image.png",
child: Image.network(
productImage,
width: 80,
height: 80,
)

Loading…
Cancel
Save