Merge branch 'fatima-new' into 'development'

Fatima new

See merge request Cloud_Solution/diplomatic-quarter!386
merge-update-with-lab-changes
Mohammad Aljammal 5 years ago
commit 1d7e97a9af

@ -73,6 +73,8 @@ const Map localizedValues = {
}, },
'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'},
'search': {'en': 'Search', 'ar': 'بحث'}, 'search': {'en': 'Search', 'ar': 'بحث'},
'noResultFound': {'en': 'No Result Found', 'ar': 'المنتج غير موجود'},
'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'},
'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'},
'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'},
'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'}, 'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'},
@ -300,6 +302,7 @@ const Map localizedValues = {
"ar": "خطأ في إرسال البريد الإلكتروني" "ar": "خطأ في إرسال البريد الإلكتروني"
}, },
"close": {"en": "Close", "ar": "مغلق"}, "close": {"en": "Close", "ar": "مغلق"},
"closeIt": {"en": "Close", "ar": "اغلاق"},
"booked": {"en": "Booked", "ar": "محجوز"}, "booked": {"en": "Booked", "ar": "محجوز"},
"confirmed": {"en": "Confirmed", "ar": "مؤكد"}, "confirmed": {"en": "Confirmed", "ar": "مؤكد"},
"arrived": {"en": "Arrived", "ar": "تم الحضور"}, "arrived": {"en": "Arrived", "ar": "تم الحضور"},
@ -712,11 +715,16 @@ const Map localizedValues = {
"ar": "ar":
"خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل." "خدمة الاشعة: هذه الخدمة تمكنك من الاطلاع على تقارير وصور الاشعة التي تمت في مجموعة الحبيب الطبية وكذلك ارسال التقرير عن طريق الايميل."
}, },
"noReviewsAvailable": {"en": "No Reviews Available", "ar": "لا يوجد تقييمات"},
"noLocationAvailable": {"en": "No Location Available", "ar": "لا يوجد موقع"},
"orders": {"en": "Orders", "ar": "الطلبات"}, "orders": {"en": "Orders", "ar": "الطلبات"},
"lakum": {"en": "Lakum", "ar": "لكم"}, "lakum": {"en": "Lakum", "ar": "لكم"},
"wishlist": {"en": "Wishlist", "ar": "الرغبات"}, "wishlist": {"en": "Wishlist", "ar": "المفضلة"},
"products": {"en": "Products", "ar": "المنتجات"},
"reviews": {"en": "Reviews", "ar": "التقيمات"}, "reviews": {"en": "Reviews", "ar": "التقيمات"},
// "myPrescriptions": {"en": "My Prescriptions", "ar": "وصفاتي"}, "brands": {"en": "Brands", "ar": "العلامات التجارية"},
"productDetails": {"en": "Product Details", "ar": "تفاصيل المنتج"},
// "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"}, // "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"},
"pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"}, "pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"},
"shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"}, "shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"},
@ -848,7 +856,7 @@ const Map localizedValues = {
}, },
"shopByBrands": {"en": "Shop By Brands", "ar": "تسوق حسب الماركات"}, "shopByBrands": {"en": "Shop By Brands", "ar": "تسوق حسب الماركات"},
"recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"}, "recentlyViewed": {"en": "Recently Viewed", "ar": "شوهدت مؤخرا"},
"bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"}, "bestSellers": {"en": "Best Seller", "ar": "الأكثر مبيعأ"},
"deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"}, "deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"},
"total": {"en": "Total", "ar": "المجموع"}, "total": {"en": "Total", "ar": "المجموع"},
"totalWithColonRight": {"en": "Total:", "ar": ":المجموع"}, "totalWithColonRight": {"en": "Total:", "ar": ":المجموع"},
@ -881,15 +889,18 @@ const Map localizedValues = {
"en": "Drag point to change your age", "en": "Drag point to change your age",
"ar": "اسحب لتغيير عمرك" "ar": "اسحب لتغيير عمرك"
}, },
"refine": {"en": "Refine", "ar": "refine"},
"reset": {"en": "Reset", "ar": "اعادة تعيين"},
"apply": {"en": "Apply", "ar": "تطبيق"},
"viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"},
"categorise": {"en": "Categories", "ar": "التطبيقات"}, "categorise": {"en": "Categories", "ar": "التطبيقات"},
"wishList": {"en": "WishList", "ar": "الرغبات"}, "wishList": {"en": "WishList", "ar": "المفضلة"},
"myAccount": {"en": "My Account", "ar": "حسابي"}, "myAccount": {"en": "My Account", "ar": "حسابي"},
"cart": {"en": "Cart", "ar": "التسوق"}, "cart": {"en": "Cart", "ar": "التسوق"},
"Alhabibapp": {"en": "Al habib app", "ar": "تطبيق الحبيب"}, "Alhabibapp": {"en": "Al habib app", "ar": "تطبيق الحبيب"},
"searchProductHere": { "searchProductHere": {
"en": "Search Product here", "en": "Search Product here",
"ar": "ابحث في الطلب الخاص بك" "ar": "البحث عن منتج"
}, },
"HHCNotAuthMsg": { "HHCNotAuthMsg": {
"en": "en":
@ -1539,7 +1550,10 @@ const Map localizedValues = {
"vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"}, "vaccination": {"en": "Vaccination", "ar": "جدول التطعيمات"},
"welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"}, "welcomeBack": {"en": "Welcome back", "ar": "مرحبا مرة أخرى"},
"quantitySize": {"en": "Quantity", "ar": "كميه"}, "quantitySize": {"en": "Quantity", "ar": "كميه"},
"addToCart": {"en": "add to cart", "ar": "إضفة للسلة"}, "addToCart": {"en": "Add to Cart", "ar": "إضف للسلة"},
"addToWishlist": {"en": "Add to Wishlist", "ar": "اضف للمفضلة"},
"noData": {"en": "There is no data", "ar": "لايوجد بيانات"},
"no_data": {"en": "No data", "ar": "لايوجد بيانات"},
"buyNow": {"en": "buy now", "ar": "إشتري الان"}, "buyNow": {"en": "buy now", "ar": "إشتري الان"},
"quantityShortcut": {"en": "QTY", "ar": "كمية"}, "quantityShortcut": {"en": "QTY", "ar": "كمية"},

@ -14,15 +14,15 @@ class RecommendedProductModel {
// dynamic metaDescription; // dynamic metaDescription;
// dynamic metaTitle; // dynamic metaTitle;
bool allowCustomerReviews; bool allowCustomerReviews;
int approvedRatingSum; dynamic approvedRatingSum;
int notApprovedRatingSum; dynamic notApprovedRatingSum;
int approvedTotalReviews; dynamic approvedTotalReviews;
int notApprovedTotalReviews; dynamic notApprovedTotalReviews;
dynamic sku; dynamic sku;
bool isRx; bool isRx;
bool prescriptionRequired; bool prescriptionRequired;
// dynamic rxMessage; dynamic rxMessage;
// dynamic rxMessagen; dynamic rxMessagen;
// dynamic manufacturerPartNumber; // dynamic manufacturerPartNumber;
// dynamic gtin; // dynamic gtin;
bool isGiftCard; bool isGiftCard;
@ -30,33 +30,33 @@ class RecommendedProductModel {
bool automaticallyAddRequiredProducts; bool automaticallyAddRequiredProducts;
bool isDownload; bool isDownload;
bool unlimitedDownloads; bool unlimitedDownloads;
int maxNumberOfDownloads; dynamic maxNumberOfDownloads;
// dynamic downloadExpirationDays; // dynamic downloadExpirationDays;
bool hasSampleDownload; bool hasSampleDownload;
bool hasUserAgreement; bool hasUserAgreement;
bool isRecurring; bool isRecurring;
int recurringCycleLength; dynamic recurringCycleLength;
int recurringTotalCycles; dynamic recurringTotalCycles;
bool isRental; bool isRental;
int rentalPriceLength; dynamic rentalPriceLength;
bool isShipEnabled; bool isShipEnabled;
bool isFreeShipping; bool isFreeShipping;
bool shipSeparately; bool shipSeparately;
int additionalShippingCharge; dynamic additionalShippingCharge;
bool isTaxExempt; bool isTaxExempt;
bool isTelecommunicationsOrBroadcastingOrElectronicServices; bool isTelecommunicationsOrBroadcastingOrElectronicServices;
bool useMultipleWarehouses; bool useMultipleWarehouses;
int manageInventoryMethodId; dynamic manageInventoryMethodId;
int stockQuantity; dynamic stockQuantity;
dynamic stockAvailability; dynamic stockAvailability;
dynamic stockAvailabilityn; dynamic stockAvailabilityn;
bool displayStockAvailability; bool displayStockAvailability;
bool displayStockQuantity; bool displayStockQuantity;
int minStockQuantity; dynamic minStockQuantity;
int notifyAdminForQuantityBelow; dynamic notifyAdminForQuantityBelow;
bool allowBackInStockSubscriptions; bool allowBackInStockSubscriptions;
int orderMinimumQuantity; dynamic orderMinimumQuantity;
int orderMaximumQuantity; dynamic orderMaximumQuantity;
// Null allowedQuantities; // Null allowedQuantities;
bool allowAddingOnlyExistingAttributeCombinations; bool allowAddingOnlyExistingAttributeCombinations;
bool disableBuyButton; bool disableBuyButton;
@ -64,18 +64,18 @@ class RecommendedProductModel {
bool availableForPreOrder; bool availableForPreOrder;
// dynamic preOrderAvailabilityStartDateTimeUtc; // dynamic preOrderAvailabilityStartDateTimeUtc;
bool callForPrice; bool callForPrice;
double price; dynamic price;
int oldPrice; dynamic oldPrice;
double productCost; dynamic productCost;
// dynamic specialPrice; // dynamic specialPrice;
// dynamic specialPriceStartDateTimeUtc; // dynamic specialPriceStartDateTimeUtc;
// dynamic specialPriceEndDateTimeUtc; // dynamic specialPriceEndDateTimeUtc;
bool customerEntersPrice; bool customerEntersPrice;
int minimumCustomerEnteredPrice; dynamic minimumCustomerEnteredPrice;
int maximumCustomerEnteredPrice; dynamic maximumCustomerEnteredPrice;
bool basepriceEnabled; bool basepriceEnabled;
int basepriceAmount; dynamic basepriceAmount;
int basepriceBaseAmount; dynamic basepriceBaseAmount;
bool hasTierPrices; bool hasTierPrices;
bool hasDiscountsApplied; bool hasDiscountsApplied;
// dynamic discountName; // dynamic discountName;
@ -85,30 +85,30 @@ class RecommendedProductModel {
// dynamic discountPercentage; // dynamic discountPercentage;
dynamic currency; dynamic currency;
dynamic currencyn; dynamic currencyn;
double weight; dynamic weight;
int length; dynamic length;
int width; dynamic width;
int height; dynamic height;
// dynamic availableStartDateTimeUtc; // dynamic availableStartDateTimeUtc;
// dynamic availableEndDateTimeUtc; // dynamic availableEndDateTimeUtc;
int displayOrder; dynamic displayOrder;
bool published; bool published;
bool deleted; bool deleted;
dynamic createdOnUtc; dynamic createdOnUtc;
dynamic updatedOnUtc; dynamic updatedOnUtc;
dynamic productType; dynamic productType;
int parentGroupedProductId; dynamic parentGroupedProductId;
// List<dynamic> roleIds; // List<dynamic> roleIds;
// List<dynamic> discountIds; // List<dynamic> discountIds;
// List<dynamic> storeIds; // List<dynamic> storeIds;
List<int> manufacturerIds; List<dynamic> manufacturerIds;
// List<dynamic> reviews; // List<dynamic> reviews;
List<Images> images; List<Images> images;
// List<dynamic> attributes; // List<dynamic> attributes;
List<Specifications> specifications; List<Specifications> specifications;
// List<dynamic> associatedProductIds; // List<dynamic> associatedProductIds;
// List<dynamic> tags; // List<dynamic> tags;
int vendorId; dynamic vendorId;
dynamic seName; dynamic seName;
bool isinwishlist; bool isinwishlist;
@ -135,8 +135,8 @@ class RecommendedProductModel {
this.sku, this.sku,
this.isRx, this.isRx,
this.prescriptionRequired, this.prescriptionRequired,
// this.rxMessage, this.rxMessage,
// this.rxMessagen, this.rxMessagen,
// this.manufacturerPartNumber, // this.manufacturerPartNumber,
// this.gtin, // this.gtin,
this.isGiftCard, this.isGiftCard,
@ -254,8 +254,8 @@ class RecommendedProductModel {
sku = json['sku']; sku = json['sku'];
isRx = json['is_rx']; isRx = json['is_rx'];
prescriptionRequired = json['prescription_required']; prescriptionRequired = json['prescription_required'];
// rxMessage = json['rx_message']; rxMessage = json['rx_message'];
// rxMessagen = json['rx_messagen']; rxMessagen = json['rx_messagen'];
// manufacturerPartNumber = json['manufacturer_part_number']; // manufacturerPartNumber = json['manufacturer_part_number'];
// gtin = json['gtin']; // gtin = json['gtin'];
isGiftCard = json['is_gift_card']; isGiftCard = json['is_gift_card'];
@ -353,7 +353,7 @@ class RecommendedProductModel {
// storeIds.add(new Null.fromJson(v)); // storeIds.add(new Null.fromJson(v));
// }); // });
// } // }
manufacturerIds = json['manufacturer_ids'].cast<int>(); manufacturerIds = json['manufacturer_ids'].cast<dynamic>();
// if (json['reviews'] != null) { // if (json['reviews'] != null) {
// reviews = new List<Null>(); // reviews = new List<Null>();
// json['reviews'].forEach((v) { // json['reviews'].forEach((v) {
@ -422,8 +422,8 @@ class RecommendedProductModel {
data['sku'] = this.sku; data['sku'] = this.sku;
data['is_rx'] = this.isRx; data['is_rx'] = this.isRx;
data['prescription_required'] = this.prescriptionRequired; data['prescription_required'] = this.prescriptionRequired;
// data['rx_message'] = this.rxMessage; data['rx_message'] = this.rxMessage;
// data['rx_messagen'] = this.rxMessagen; data['rx_messagen'] = this.rxMessagen;
// data['manufacturer_part_number'] = this.manufacturerPartNumber; // data['manufacturer_part_number'] = this.manufacturerPartNumber;
// data['gtin'] = this.gtin; // data['gtin'] = this.gtin;
data['is_gift_card'] = this.isGiftCard; data['is_gift_card'] = this.isGiftCard;
@ -543,7 +543,7 @@ class RecommendedProductModel {
} }
class LocalizedNames { class LocalizedNames {
int languageId; dynamic languageId;
String localizedName; String localizedName;
LocalizedNames({this.languageId, this.localizedName}); LocalizedNames({this.languageId, this.localizedName});
@ -562,8 +562,8 @@ class LocalizedNames {
} }
class Images { class Images {
int id; dynamic id;
int position; dynamic position;
String src; String src;
String thumb; String thumb;
String attachment; String attachment;
@ -590,8 +590,8 @@ class Images {
} }
class Specifications { class Specifications {
int id; dynamic id;
int displayOrder; dynamic displayOrder;
String defaultValue; String defaultValue;
String defaultValuen; String defaultValuen;
String name; String name;

@ -55,30 +55,30 @@ class OrderPreviewViewModel extends BaseViewModel {
} }
} }
Future changeProductQuantity(ShoppingCart product) async { Future <ShoppingCartResponse> changeProductQuantity(ShoppingCart product) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.changeProductQuantity(product.id, product).then((res) { var resp = await _orderService.changeProductQuantity(product.id, product);
_handleGetShoppingCartResponse(res); var object = _handleGetShoppingCartResponse(resp);
});
if (_orderService.hasError) { if (_orderService.hasError) {
error = _orderService.error; error = _orderService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
return object;
} }
Future deleteProduct(ShoppingCart product) async { Future<ShoppingCartResponse> deleteProduct(ShoppingCart product) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.deleteProduct(product.id).then((res) { var resp = await _orderService.deleteProduct(product.id);
_handleGetShoppingCartResponse(res); var object = _handleGetShoppingCartResponse(resp);
});
if (_orderService.hasError) { if (_orderService.hasError) {
error = _orderService.error; error = _orderService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
return object;
} }
Future deleteShoppingCart() async { Future deleteShoppingCart() async {
@ -94,12 +94,12 @@ class OrderPreviewViewModel extends BaseViewModel {
} }
} }
_handleGetShoppingCartResponse(Map res) { ShoppingCartResponse _handleGetShoppingCartResponse(Map res) {
totalAdditionalShippingCharge = 0; totalAdditionalShippingCharge = 0;
if (res == null) { if (res == null) {
error = "response is null"; error = "response is null";
setState(ViewState.Error); setState(ViewState.Error);
return; return null;
} }
print(res); print(res);
cartResponse.itemCount = res["item_count"]; cartResponse.itemCount = res["item_count"];
@ -115,6 +115,7 @@ class OrderPreviewViewModel extends BaseViewModel {
totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge;
}); });
cartResponse.updateShoppingCard(); cartResponse.updateShoppingCard();
return cartResponse;
} }
String getPaymentOptionImage(PaymentOption paymentOption) { String getPaymentOptionImage(PaymentOption paymentOption) {

@ -33,10 +33,12 @@ class PharmacyModuleViewModel extends BaseViewModel {
List<PharmacyProduct> get lastVisitedProducts => List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts; _pharmacyService.lastVisitedProducts;
List <RecommendedProductModel> get recommendedProductList =>
List<Map<String, dynamic>> get recommendedProductList =>
_recommendedProductService.recommendedList; _recommendedProductService.recommendedList;
// List<Map<String, dynamic>> get recommendedProductList =>
// _recommendedProductService.recommendedList;
List<Prescriptions> get prescriptionsList => List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList; _prescriptionService.prescriptionsList;

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -12,6 +13,8 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage; import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'base/base_view.dart'; import 'base/base_view.dart';
dynamic languageID;
class FinalProductsPage extends StatefulWidget { class FinalProductsPage extends StatefulWidget {
final String id; final String id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
@ -33,6 +36,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
color: Colors.blue, color: Colors.blue,
size: 29.0, size: 29.0,
); );
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
void initState() {
getLanguageID();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
@ -55,7 +67,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) => Widget child) =>
PharmacyAppScaffold( PharmacyAppScaffold(
appBarTitle: "Products", appBarTitle: TranslationBase.of(context).products,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -74,7 +86,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Texts( child: Texts(
'Products', TranslationBase.of(context).products,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -213,11 +225,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
), ),
Container( Container(
width: model width: model.finalProducts[index].rxMessage != null
.finalProducts[
index]
.rxMessage !=
null
? MediaQuery.of( ? MediaQuery.of(
context) context)
.size .size
@ -235,23 +243,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
.circular( .circular(
6)), 6)),
), ),
child: Texts( child:model.finalProducts[index].rxMessage != null
model ? Texts( languageID == 'ar' ? model.finalProducts[index].rxMessagen
.finalProducts[ : model.finalProducts[index].rxMessage,
index]
.rxMessage !=
null
? model
.finalProducts[
index]
.rxMessage
: "",
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ): Texts(""),
), ),
], ],
), ),

@ -43,7 +43,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: currentTab != 4 appBar: currentTab != 4 && currentTab != 3
? AppBar( ? AppBar(
backgroundColor: Color(0xff5AB145), backgroundColor: Color(0xff5AB145),
elevation: 0, elevation: 0,
@ -55,7 +55,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
), ),
child: InkWell( child: InkWell(
child: Padding( child: Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(5.0),
child: Row( child: Row(
//crossAxisAlignment: CrossAxisAlignment.center, //crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -172,7 +172,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print(response); print(response);
var product = PharmacyProduct.fromJson(response["products"][0]); product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product))); Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_mo
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -25,7 +26,8 @@ class ParentCategorisePage extends StatefulWidget {
ParentCategorisePage({this.id, this.titleName}); ParentCategorisePage({this.id, this.titleName});
@override @override
_ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); _ParentCategorisePageState createState() =>
_ParentCategorisePageState(id: id, titleName: titleName);
} }
class _ParentCategorisePageState extends State<ParentCategorisePage> { class _ParentCategorisePageState extends State<ParentCategorisePage> {
@ -56,7 +58,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id), onModelReady: (model) => model.getCategoriseParent(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: titleName, appBarTitle: titleName,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
@ -107,7 +111,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: InkWell( child: InkWell(
child: Container( child: Container(
child: Texts( child: Texts(
'View All Categories', TranslationBase.of(context)
.viewCategorise,
// 'View All Categories',
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
), ),
@ -124,20 +130,37 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.vertical, scrollDirection:
itemCount: model.categoriseParent.length, Axis.vertical,
itemBuilder: (BuildContext context, int index) { itemCount: model
.categoriseParent.length,
itemBuilder:
(BuildContext context,
int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: EdgeInsets.all(4.0), padding:
EdgeInsets.all(4.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
Texts(model.categoriseParent[index].name), Texts(projectViewModel
.isArabic
? model
.categoriseParent[
index]
.namen
: model
.categoriseParent[
index]
.name),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: Colors.black12, color: Colors
.black12,
) )
], ],
), ),
@ -145,9 +168,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: SubCategorisePage( page:
title: model.categoriseParent[index].name, SubCategorisePage(
id: model.categoriseParent[index].id, title: model
.categoriseParent[
index]
.name,
id: model
.categoriseParent[
index]
.id,
parentId: id, parentId: id,
)), )),
); );
@ -181,22 +211,28 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, itemCount: model.categoriseParent.length > 8
? 8
: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0), padding:
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 13.0), padding: EdgeInsets.symmetric(
horizontal: 13.0),
child: Container( child: Container(
height: 60.0, height: 60.0,
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200.withOpacity(0.45), color: Colors.orange.shade200
.withOpacity(0.45),
), ),
child: Center( child: Center(
child: Icon( child: Icon(
@ -207,7 +243,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.197, width: MediaQuery.of(context)
.size
.width *
0.197,
// height: MediaQuery.of(context) // height: MediaQuery.of(context)
// .size // .size
// .height * // .height *
@ -215,8 +254,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Center( child: Center(
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic
? model.categoriseParent[index].namen ? model
: model.categoriseParent[index].name, .categoriseParent[index]
.namen
: model
.categoriseParent[index]
.name,
fontSize: 13.4, fontSize: 13.4,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
maxLines: 3, maxLines: 3,
@ -230,8 +273,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context, context,
FadePage( FadePage(
page: SubCategorisePage( page: SubCategorisePage(
title: model.categoriseParent[index].name, title: model
id: model.categoriseParent[index].id, .categoriseParent[index].name,
id: model
.categoriseParent[index].id,
parentId: id, parentId: id,
)), )),
); );
@ -277,16 +322,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.95, maxChildSize: 0.95,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) { builder: (BuildContext context,
ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of(context).size.height * 1.95, height: MediaQuery.of(context)
.size
.height *
1.95,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -297,7 +347,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Texts( Texts(
'Refine', 'Refine',
fontWeight: FontWeight.w600, fontWeight:
FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
@ -306,11 +357,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
'Close', 'Close',
color: Colors.red, color: Colors.red,
fontWeight: FontWeight.w600, fontWeight:
FontWeight.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(
context);
}, },
), ),
], ],
@ -323,27 +376,37 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts('Categorise'), title:
Texts('Categorise'),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model.categoriseParent, masterList: model
removeHistory: (item) { .categoriseParent,
removeHistory:
(item) {
setState(() { setState(() {
entityList.remove(item); entityList
.remove(
item);
}); });
}, },
addHistory: (history) { addHistory:
(history) {
setState(() { setState(() {
entityList.add(history); entityList.add(
history);
}); });
}, },
addSelectedHistories: () { addSelectedHistories:
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: (master) => isEntityListSelected:
isEntityListSelected(master), (master) =>
isEntityListSelected(
master),
) )
], ],
), ),
@ -356,23 +419,33 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model.brandsList, masterList: model
removeHistory: (item) { .brandsList,
removeHistory:
(item) {
setState(() { setState(() {
entityListBrands.remove(item); entityListBrands
.remove(
item);
}); });
}, },
addHistory: (history) { addHistory:
(history) {
setState(() { setState(() {
entityListBrands.add(history); entityListBrands
.add(
history);
}); });
}, },
addSelectedHistories: () { addSelectedHistories:
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: (master) => isEntityListSelected:
isEntityListSelectedBrands(master), (master) =>
isEntityListSelectedBrands(
master),
) )
], ],
), ),
@ -384,40 +457,63 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
title: Texts('Price'), title: Texts('Price'),
children: [ children: [
Container( Container(
color: Color(0xffEEEEEE), color: Color(
0xffEEEEEE),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment:
MainAxisAlignment
.spaceAround,
children: [ children: [
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment
.start,
children: [ children: [
Texts('Min'), Texts(
'Min'),
Container( Container(
color: Colors.white, color: Colors
width: 200, .white,
height: 40, width:
child: TextFormField( 200,
decoration: InputDecoration( height:
border: OutlineInputBorder(), 40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: minField, controller:
minField,
), ),
), ),
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment
.start,
children: [ children: [
Texts('Max'), Texts(
'Max'),
Container( Container(
color: Colors.white, color: Colors
width: 200, .white,
height: 40, width:
child: TextFormField( 200,
decoration: InputDecoration( height:
border: OutlineInputBorder(), 40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: maxField, controller:
maxField,
), ),
), ),
], ],
@ -432,18 +528,26 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * 0.4, height: MediaQuery.of(
context)
.size
.height *
0.4,
), ),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Container( Container(
width: 100, width: 100,
child: Button( child: Button(
label: 'Reset', label: 'Reset',
backgroundColor: Colors.red, backgroundColor:
Colors.red,
), ),
), ),
SizedBox( SizedBox(
@ -452,38 +556,65 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
onTap: () async { onTap:
String categoriesId = ""; () async {
for (CategoriseParentModel category in entityList) { String
if (categoriesId == "") { categoriesId =
categoriesId = category.id; "";
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category
.id;
} else { } else {
categoriesId = "$categoriesId,${category.id}"; categoriesId =
"$categoriesId,${category.id}";
} }
} }
String brandIds = ""; String
brandIds =
"";
for (CategoriseParentModel brand for (CategoriseParentModel brand
in entityListBrands) { in entityListBrands) {
if (brandIds == "") { if (brandIds ==
brandIds = brand.id; "") {
brandIds =
brand
.id;
} else { } else {
brandIds = "$brandIds,${brand.id}"; brandIds =
"$brandIds,${brand.id}";
} }
} }
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils
.showMyDialog(
context);
await model.getFilteredProducts( await model.getFilteredProducts(
min: minField.text.toString(), min: minField
max: maxField.text.toString(), .text
categoryId: categoriesId, .toString(),
brandId: brandIds); max: maxField
GifLoaderDialogUtils.hideDialog(context); .text
.toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(context); Navigator.pop(
context);
}, },
label: 'Apply', label: 'Apply',
backgroundColor: Colors.green, backgroundColor:
Colors
.green,
), ),
), ),
], ],
@ -549,10 +680,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, height: model.parentProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
@ -564,7 +698,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
baseViewModel: model, baseViewModel: model,
child: InkWell( child: InkWell(
child: Card( child: Card(
color: model.parentProducts[index].discountName != null color: model.parentProducts[index]
.discountName !=
null
? Color(0xffFFFF00) ? Color(0xffFFFF00)
: Colors.white, : Colors.white,
elevation: 0, elevation: 0,
@ -597,62 +733,111 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.symmetric(horizontal: 0), padding: EdgeInsets.symmetric(
width: MediaQuery.of(context).size.width / 3, horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Stack( Stack(
children: [ children: [
if (model.parentProducts[index].discountName != null) if (model
.parentProducts[
index]
.discountName !=
null)
RotatedBox( RotatedBox(
quarterTurns: 4, quarterTurns: 4,
child: Container( child: Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
right: 5.0, right: 5.0,
top: 20.0, top: 20.0,
bottom: 5.0, bottom: 5.0,
), ),
child: Texts( child: Texts(
'offer'.toUpperCase(), 'offer'
.toUpperCase(),
color: Colors.red, color: Colors.red,
fontSize: 13.0, fontSize: 13.0,
fontWeight: FontWeight.w900, fontWeight:
FontWeight
.w900,
), ),
), ),
transform: new Matrix4.rotationZ(5.837200), transform: new Matrix4
.rotationZ(
5.837200),
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0), margin:
alignment: Alignment.center, EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.parentProducts[index].images.isNotEmpty model
? model.parentProducts[index].images[0].thumb .parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
), ),
), ),
Container( Container(
width: model.parentProducts[index].rxMessage != null width: model
? MediaQuery.of(context).size.width / 5 .parentProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: Texts( child: Texts(
model.parentProducts[index].rxMessage != null model
? model.parentProducts[index].rxMessage .parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "", : "",
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
), ),
), ),
], ],
@ -663,32 +848,59 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
if (model.parentProducts[index].discountName != null) if (model
.parentProducts[
index]
.discountName !=
null)
Container( Container(
width: double.infinity, width:
double.infinity,
height: 13.0, height: 13.0,
decoration: BoxDecoration( decoration:
color: Color(0xff5AB145), BoxDecoration(
color: Color(
0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
model.parentProducts[index].discountName, model
.parentProducts[
index]
.discountName,
regular: true, regular: true,
color: Colors.white, color:
Colors.white,
fontSize: 10.4, fontSize: 10.4,
), ),
), ),
), ),
Texts( Texts(
model.parentProducts[index].name, projectViewModel
.isArabic
? model
.parentProducts[
index]
.namen
: model
.parentProducts[
index]
.name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w700, fontWeight:
FontWeight.w700,
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4), padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.parentProducts[index].price}", "SAR ${model.parentProducts[index].price}",
bold: true, bold: true,
@ -698,21 +910,26 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: totalAverage: model
model.parentProducts[index].approvedRatingSum > 0 .parentProducts[
? (model.parentProducts[index].approvedRatingSum index]
.toDouble() / .approvedRatingSum >
model.parentProducts[index] 0
.approvedRatingSum ? (model.parentProducts[index].approvedRatingSum
.toDouble()) .toDouble() /
.toDouble() model
: 0, .parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true), forceStars: true),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
) )
], ],
), ),
@ -727,7 +944,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage(model.parentProducts[index]), page: ProductDetailPage(model
.parentProducts[index]),
)), )),
}, },
)); ));
@ -735,11 +953,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
) )
: Container( : Container(
height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, height: model.parentProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
child: Row( child: Row(
@ -749,9 +970,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
@ -759,11 +982,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0), margin:
alignment: Alignment.center, EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.parentProducts[index].images.isNotEmpty model
? model.parentProducts[index].images[0].thumb .parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.contain, fit: BoxFit.contain,
height: 80, height: 80,
@ -774,22 +1008,44 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
width: model.parentProducts[index].rxMessage != null width: model
? MediaQuery.of(context).size.width / 5 .parentProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: Texts( child: Texts(
model.parentProducts[index].rxMessage != null model
? model.parentProducts[index].rxMessage .parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "", : "",
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
), ),
), ),
], ],
@ -802,19 +1058,35 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.65, width:
MediaQuery.of(context)
.size
.width *
0.65,
child: Texts( child: Texts(
model.parentProducts[index].name, projectViewModel.isArabic
? model
.parentProducts[
index]
.namen
: model
.parentProducts[
index]
.name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight:
FontWeight.w500,
maxLines: 5, maxLines: 5,
), ),
), ),
@ -822,7 +1094,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
height: 8.0, height: 8.0,
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4), padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${model.parentProducts[index].price}", "SAR ${model.parentProducts[index].price}",
bold: true, bold: true,
@ -832,20 +1106,30 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: totalAverage: model
model.parentProducts[index].approvedRatingSum > 0 .parentProducts[
? (model.parentProducts[index].approvedRatingSum index]
.toDouble() / .approvedRatingSum >
model.parentProducts[index].approvedRatingSum 0
.toDouble()) ? (model
.toDouble() .parentProducts[
: 0, index]
.approvedRatingSum
.toDouble() /
model
.parentProducts[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true), forceStars: true),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
) )
], ],
), ),
@ -859,7 +1143,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage(model.parentProducts[index]), page: ProductDetailPage(
model.parentProducts[index]),
)), )),
}, },
); );
@ -873,7 +1158,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id); Iterable<CategoriseParentModel> history =
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
@ -881,7 +1167,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id); Iterable<CategoriseParentModel> history =
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -1,47 +1,67 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
var languageID; var languageID;
class ProductCheckTypeWidget extends StatelessWidget {
class ProductCheckTypeWidget extends StatefulWidget {
final List<dynamic> wishlist; final List<dynamic> wishlist;
final bool isTrue; final bool isTrue;
ProductCheckTypeWidget(this.isTrue, this.wishlist); ProductCheckTypeWidget(this.isTrue, this.wishlist);
@override
_ProductCheckTypeWidgetState createState() => _ProductCheckTypeWidgetState();
}
class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
void initState() { void initState() {
getLanguageID(); getLanguageID();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return isTrue return widget.isTrue
? ListView.builder( ? ListView.builder(
itemCount: wishlist.length, itemCount: widget.wishlist.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Column( return Column(
children: [ children: [
Container( Container(
child: isTrue child: widget.isTrue
? productTile( ? productTile(
productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, productName: languageID == 'ar'
productPrice: wishlist[index].subtotal, ? widget.wishlist[index].product.namen
productRate: : widget.wishlist[index].product.name,
double.parse(wishlist[index].subtotalVatRate), productPrice: widget.wishlist[index].subtotal,
productImage: wishlist[index].product.images[0].src, productRate: double.parse(
showLine: isTrue, widget.wishlist[index].subtotalVatRate),
productID: wishlist[index].product.id, productImage:
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
productID: widget.wishlist[index].product.id,
onDelete: deleteWishListItem,
) )
: productTile( : productTile(
productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name, productName: languageID == 'ar'
productPrice: wishlist[index].subtotal, ? widget.wishlist[index].product.namen
productRate: : widget.wishlist[index].product.name,
double.parse(wishlist[index].subtotalVatRate), productPrice: widget.wishlist[index].subtotal,
productImage: wishlist[index].product.images[0].src, productRate: double.parse(
showLine: isTrue, widget.wishlist[index].subtotalVatRate),
productImage:
widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
onDelete: deleteWishListItem,
), ),
), ),
Divider(height: 1, color: Colors.grey) Divider(height: 1, color: Colors.grey)
@ -51,20 +71,43 @@ class ProductCheckTypeWidget extends StatelessWidget {
: GridView.count( : GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
children: List.generate( children: List.generate(
wishlist.length, widget.wishlist.length,
(index) => productTile( (index) => productTile(
productName: wishlist[index].product.name, productName: widget.wishlist[index].product.name,
productPrice: wishlist[index].subtotal, productPrice: widget.wishlist[index].subtotal,
productRate: productRate:
double.parse(wishlist[index].subtotalVatRate), double.parse(widget.wishlist[index].subtotalVatRate),
productImage: wishlist[index].product.images[0].src, productImage:
showLine: isTrue, widget.wishlist[index].product.images[0].src,
showLine: widget.isTrue,
)), )),
); );
} }
deleteWishListItem(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
GifLoaderDialogUtils.showMyDialog(context);
await x.deletWishlistData(itemID);
setState(()
async{
await
//getWishlistData();
Navigator.push(context,
FadePage(page: WishlistPage(false)),
);
});
GifLoaderDialogUtils.hideDialog(context);
print("Delete");
}
getWishlistData() async {
WishListViewModel x = new WishListViewModel();
await x.getWishlistData();
}
} }
getLanguageID() async { getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE); languageID = await sharedPref.getString(APP_LANGUAGE);
} }

@ -1,3 +1,5 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:carousel_slider/carousel_slider.dart';
@ -5,9 +7,11 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
int counter = 0;
int counter = 0;
dynamic languageID;
class ComparePage extends StatefulWidget { class ComparePage extends StatefulWidget {
@override @override
_ComparePageState createState() => _ComparePageState(); _ComparePageState createState() => _ComparePageState();
@ -15,14 +19,24 @@ class ComparePage extends StatefulWidget {
//CompareList compareItems = CompareList(); //CompareList compareItems = CompareList();
class _ComparePageState extends State<ComparePage> { class _ComparePageState extends State<ComparePage> {
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
void initState() {
getLanguageID();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: 'Reviews page', appBarTitle: TranslationBase.of(context).compare,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
body: Container( body: SingleChildScrollView(
child: compareList(), child: Container(
child: compareList(),
),
), ),
); );
} }
@ -50,8 +64,8 @@ class compareList extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(TranslationBase.of(context).noData,
'There is no data', // 'There is no data',
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),
) )
@ -105,7 +119,7 @@ class _slideDetailState extends State<slideDetail> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( Container(
height: 550, height: 750,
width: 150, width: 150,
margin: EdgeInsets.symmetric(horizontal: 10.0), margin: EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -157,7 +171,14 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text: widget.data[index].namen,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
: TextSpan(
text: widget.data[index].name, text: widget.data[index].name,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -173,7 +194,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].price.toString(), text: "SAR ${widget.data[index].price.toString()}",
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: 15, fontSize: 15,
@ -195,10 +216,21 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
:TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].name : widget.data[index].specifications[0].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.black, color: Colors.black,
@ -212,10 +244,82 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Container(
height: 1.0,
width: 300.0,
color: Colors.grey,
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
):TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].name : widget.data[index].specifications[1].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: 15, fontSize: 15,
@ -237,10 +341,20 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text:widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].name : widget.data[index].specifications[2].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.black, color: Colors.black,
@ -254,10 +368,82 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Container(
height: 1.0,
width: 300.0,
color: Colors.grey,
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
):TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].name : widget.data[index].specifications[3].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: 15, fontSize: 15,
@ -279,10 +465,20 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text:widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].name : widget.data[index].specifications[4].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.black, color: Colors.black,
@ -296,10 +492,82 @@ class _slideDetailState extends State<slideDetail> {
child: Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: TextSpan( text: languageID == "ar"? TextSpan(
text:widget.data[index].specifications != null ? text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Container(
height: 1.0,
width: 300.0,
color: Colors.grey,
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].nameN :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].name : widget.data[index].specifications[5].name :
"No data", // "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: languageID == "ar"? TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].defaultValuen :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
):TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].defaultValue :
// "No data",
TranslationBase.of(context).no_data,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: 15, fontSize: 15,

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/review_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
@ -22,7 +23,7 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
return BaseView<ReviewViewModel>( return BaseView<ReviewViewModel>(
onModelReady: (model) => model.getReviewData(), onModelReady: (model) => model.getReviewData(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: 'My Reviews', appBarTitle: TranslationBase.of(context).reviews,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
baseViewModel: model, baseViewModel: model,

@ -31,7 +31,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
allowAny: true, allowAny: true,
onModelReady: (model) => model.getBrandsData(), onModelReady: (model) => model.getBrandsData(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: 'Brands page', appBarTitle: TranslationBase.of(context).brands,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,

@ -17,9 +17,10 @@ import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'screens/cart-order-page.dart'; import 'screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
int price = 0; int price = 0;
var languageID; dynamic languageID;
bool isOverQuantity = false; bool isOverQuantity = false;
bool isInWishlit = false; bool isInWishlit = false;
//int isSelected = 1; //int isSelected = 1;
@ -35,7 +36,7 @@ class ProductDetailPage extends StatefulWidget {
// final Products recommendedProducts; // final Products recommendedProducts;
ProductDetailPage(this.product, ); ProductDetailPage(this.product );
@override @override
@ -43,15 +44,20 @@ class ProductDetailPage extends StatefulWidget {
} }
class __ProductDetailPageState extends State<ProductDetailPage> { class __ProductDetailPageState extends State<ProductDetailPage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isTrue = true; bool isTrue = true;
bool isDetails = true; bool isDetails = true;
bool isReviews = false; bool isReviews = false;
bool isAvailabilty = false; bool isAvailabilty = false;
dynamic wishlistItems; dynamic wishlistItems;
var model; //var model;
// String ProductId="4561"; // String ProductId="4561";
String productId = ""; // String productId = "";
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
checkWishlist() async { checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -72,11 +78,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
setState(() {}); setState(() {});
} }
void initState() { void initState() {
getLanguageID();
price = 1; price = 1;
specificationData = widget.product; specificationData = widget.product;
userInfo(); userInfo();
// recommendedData= widget.recommendedProducts;
super.initState(); super.initState();
} }
@ -97,7 +104,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return customerId != null return customerId != null
? DetailPageScafold( ? DetailPageScafold(
appBarTitle: 'product detail page', appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
@ -125,7 +132,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
flex: 1, flex: 1,
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: languageID == 'ar' child: languageID == "ar"
? Text( ? Text(
widget.product widget.product
.discountDescriptionn, .discountDescriptionn,
@ -166,7 +173,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
width: 500, width: 500,
height: 150, height: 220,
color: Colors.white, color: Colors.white,
child: productNameAndPrice(context, widget.product), child: productNameAndPrice(context, widget.product),
), ),
@ -175,7 +182,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
width: 500, width: 500,
height: 120, height: 100,
color: Colors.white, color: Colors.white,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -195,7 +202,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Container( child: Container(
child: Text( child: Text(
"there is no data", TranslationBase.of(context).noData,
// "there is no data",
), ),
), ),
), ),
@ -335,10 +343,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
languageID == 'ar' languageID == "ar"
? widget.product.fullDescriptionn ? widget.product.fullDescriptionn
: widget.product : widget.product.fullDescription ??
.fullDescription ??
"", "",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
@ -507,7 +514,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
: Container( : Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
alignment: Alignment.center, alignment: Alignment.center,
child: Text('No Reviews Available'), child: Text(TranslationBase.of(context).noReviewsAvailable,),
// Text('No Reviews Available'),
), ),
) )
: isAvailabilty : isAvailabilty
@ -521,8 +529,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
? Container( ? Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(TranslationBase.of(context).noLocationAvailable,),
'No location Available'), // Text('No location Available'),
) )
: ListView.builder( : ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
@ -614,14 +622,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Row( Row(
children: [ children: [
// Container( customerId != null ? Container(
// width: 500,
// height: 100,
// margin: EdgeInsets.only(bottom: 100),
// color: Colors.white,
// child: Text("ENAD TEST"),
// ),
Container(
width: 410, width: 410,
height: 50, height: 50,
// margin: EdgeInsets.only(bottom: 5), // margin: EdgeInsets.only(bottom: 5),
@ -630,7 +631,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
TranslationBase.of(context).recommended, TranslationBase.of(context).recommended,
bold: true, bold: true,
), ),
), )
: Container(),
], ],
), ),
SingleChildScrollView( SingleChildScrollView(
@ -653,7 +655,6 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
onModelReady: (model) => model.getRecommendedProducts(widget.product.id), onModelReady: (model) => model.getRecommendedProducts(widget.product.id),
builder: (_, model, wi) => Container( builder: (_, model, wi) => Container(
child: child:
// Text(model.recommendedProductList[0].id),
model.recommendedProductList.length != null model.recommendedProductList.length != null
? Expanded( ? Expanded(
child: ListView.builder( child: ListView.builder(
@ -666,12 +667,17 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return InkWell( return InkWell(
onTap: () onTap: ()
{ async {
Navigator.push( GifLoaderDialogUtils.showMyDialog(context);
RecommendedProductModel data = model.recommendedProductList[index];
var json = data.toJson();
PharmacyProduct product = new PharmacyProduct.fromJson(json);
await Navigator.pushReplacement(
context, context,
FadePage( FadePage(
page: ProductDetailPage(widget.product.id), page: ProductDetailPage(product),
)); ));
GifLoaderDialogUtils.hideDialog(context);
}, },
child: Card( child: Card(
elevation: 2, elevation: 2,
@ -700,26 +706,26 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
child: Align( child: Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: IconButton( child: IconButton(
icon: Icon(model.recommendedProductList[index]['isinwishlist'] != true ? Icons.favorite_border : Icons.favorite), icon: Icon(model.recommendedProductList[index].isinwishlist != true ? Icons.favorite_border : Icons.favorite),
color: model.recommendedProductList[index]['isinwishlist'] != true ? Colors.grey : Colors.red, color: model.recommendedProductList[index].isinwishlist != true ? Colors.grey : Colors.red,
onPressed: () async { onPressed: () async {
if (customerId != null ) { if (customerId != null ) {
if (!isInWishlit && model.recommendedProductList[index]['isinwishlist'] != true) { if (!isInWishlit && model.recommendedProductList[index].isinwishlist != true) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await addToWishlistFunction(model.recommendedProductList[index]['id']); await addToWishlistFunction(model.recommendedProductList[index].id);
// checkWishlist(); // checkWishlist();
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
setState((){ setState((){
model.recommendedProductList[index]['isinwishlist'] = true; model.recommendedProductList[index].isinwishlist= true;
}); });
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await deleteFromWishlistFunction(model.recommendedProductList[index]['id']); await deleteFromWishlistFunction(model.recommendedProductList[index].id);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
setState((){ setState((){
model.recommendedProductList[index]['isinwishlist'] = false; model.recommendedProductList[index].isinwishlist = false;
}); });
} }
} else { } else {
@ -771,10 +777,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
alignment: alignment:
Alignment.center, Alignment.center,
// padding: EdgeInsets.only(left: 25, bottom: 20), // padding: EdgeInsets.only(left: 25, bottom: 20),
child: (model.recommendedProductList[index]['images'] != null && child: (model.recommendedProductList[index].images != null &&
model.recommendedProductList[index]['images'].length > 0) model.recommendedProductList[index].images.length > 0)
? Image.network( ? Image.network(
model.recommendedProductList[index]['images'][0]['src'].toString(), model.recommendedProductList[index].images[0].src.toString(),
// item.images[0].src, // item.images[0].src,
fit: BoxFit.cover, fit: BoxFit.cover,
height: 60, height: 60,
@ -786,7 +792,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
), ),
Container( Container(
width: model.recommendedProductList[index]['rx_message'] != width: model.recommendedProductList[index].rxMessage !=
null null
? MediaQuery.of(context).size.width / ? MediaQuery.of(context).size.width /
5 5
@ -800,20 +806,16 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
borderRadius: borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)), BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: child: model.recommendedProductList[index].rxMessage != null
Texts( ? Texts(
model.recommendedProductList[index]['rx_message'] != null languageID == "ar"
? model.recommendedProductList[index]['rx_message'] ? model.recommendedProductList[index].rxMessagen
: "", : model.recommendedProductList[index].rxMessage,
color: color: Colors.white,
Colors.white, regular: true,
regular: fontSize: 10,
true, fontWeight: FontWeight.w400,
fontSize: ):Texts (""),
10,
fontWeight:
FontWeight.w400,
),
), ),
]), ]),
Container( Container(
@ -829,10 +831,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
.start, .start,
children: [ children: [
Text( Text(
languageID == languageID == "ar"
"ar" ? model.recommendedProductList[index].namen
? model.recommendedProductList[index]['namen'] : model.recommendedProductList[index].name,
: model.recommendedProductList[index]['name'],
style: style:
TextStyle( TextStyle(
color: color:
@ -851,7 +852,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
5), 5),
child: child:
Texts( Texts(
"SAR ${model.recommendedProductList[index]['price']}", "SAR ${model.recommendedProductList[index].price}",
bold: bold:
true, true,
fontSize: fontSize:
@ -877,8 +878,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Alignment.topLeft, Alignment.topLeft,
child: child:
RatingBar.readOnly( RatingBar.readOnly(
initialRating: initialRating: model.recommendedProductList[index].approvedRatingSum.toDouble(),
model.recommendedProductList[index]['approved_rating_sum'].toDouble(),
// initialRating: productRate, // initialRating: productRate,
size: size:
13.0, 13.0,
@ -898,7 +898,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
), ),
Texts( Texts(
"(${model.recommendedProductList[index]['approved_total_reviews'].toString()})", "(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})",
// bold: true, // bold: true,
fontSize: fontSize:
12, 12,
@ -939,7 +939,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
widget.product), widget.product),
) )
: AppScaffold( : AppScaffold(
appBarTitle: 'product detail page', appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
@ -1319,7 +1319,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
: Container( : Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
alignment: Alignment.center, alignment: Alignment.center,
child: Text('No Reviews Available'), child: Text(TranslationBase.of(context).noReviewsAvailable),
// Text('No Reviews Available'),
), ),
) )
: isAvailabilty : isAvailabilty
@ -1936,7 +1937,8 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
width: 40, width: 40,
), ),
Text( Text(
widget.item.stockAvailability, languageID == 'ar'?
widget.item.stockAvailabilityn : widget.item.stockAvailability ,
style: widget.item.stockAvailability == 'Out of stock' style: widget.item.stockAvailability == 'Out of stock'
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
: TextStyle( : TextStyle(
@ -1982,7 +1984,9 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
onPressed: () async { onPressed: () async {
if (customerId != null) { if (customerId != null) {
if (!isInWishlit) { if (!isInWishlit) {
GifLoaderDialogUtils.showMyDialog(context);
await addToWishlistFunction(widget.item.id); await addToWishlistFunction(widget.item.id);
GifLoaderDialogUtils.hideDialog(context);
} else { } else {
await deleteFromWishlistFunction(widget.item.id); await deleteFromWishlistFunction(widget.item.id);
} }
@ -2094,9 +2098,9 @@ fixingString(txt) {
return newTxt; return newTxt;
} }
getLanguageID() async { //getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE); // languageID = await sharedPref.getString(APP_LANGUAGE);
} //}
getSpecificationData(itemID) async { getSpecificationData(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();
@ -2161,7 +2165,8 @@ settingModalBottomSheet(context) {
children: <Widget>[ children: <Widget>[
new ListTile( new ListTile(
leading: Icon(Icons.shopping_cart), leading: Icon(Icons.shopping_cart),
title: Text('Add to cart'), title: Text(TranslationBase.of(context)
.addToCart,),
onTap: () => { onTap: () => {
if (price > 0) if (price > 0)
{addToCartFunction(price, itemID, context)} {addToCartFunction(price, itemID, context)}
@ -2173,12 +2178,14 @@ settingModalBottomSheet(context) {
}), }),
ListTile( ListTile(
leading: Icon(Icons.favorite_border), leading: Icon(Icons.favorite_border),
title: Text('Add to wishlist'), title: Text(TranslationBase.of(context)
.addToWishlist,),
onTap: () => {addToWishlistFunction(itemID)}, onTap: () => {addToWishlistFunction(itemID)},
), ),
ListTile( ListTile(
leading: Icon(Icons.compare), leading: Icon(Icons.compare),
title: Text('Compare'), title: Text(TranslationBase.of(context)
.compare,),
onTap: () => { onTap: () => {
Provider.of<CompareList>(context, listen: false) Provider.of<CompareList>(context, listen: false)
.addItem(specificationData), .addItem(specificationData),

@ -26,7 +26,7 @@ class CartOrderPage extends StatelessWidget {
return BaseView<OrderPreviewViewModel>( return BaseView<OrderPreviewViewModel>(
onModelReady: (model){ onModelReady: (model){
model.getShoppingCart().then((value){ model.getShoppingCart().then((value){
appScaffold.appBar.badgeUpdater('${model.cartResponse.itemCount ?? 0}'); appScaffold.appBar.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
}); });
}, },
builder: (_, model, wi) => ChangeNotifierProvider.value( builder: (_, model, wi) => ChangeNotifierProvider.value(
@ -69,26 +69,24 @@ class CartOrderPage extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
...List.generate( ...List.generate(
cart.shoppingCarts != null cart.shoppingCarts != null ? cart.shoppingCarts.length : 0,
? cart.shoppingCarts.length
: 0,
(index) => ProductOrderItem( (index) => ProductOrderItem(
cart.shoppingCarts[index], () { cart.shoppingCarts[index], () {print(cart.shoppingCarts[index].quantity);
print(cart.shoppingCarts[index] model.changeProductQuantity(cart.shoppingCarts[index]).then((value) {
.quantity); if (model.state != ViewState.Error) {
model appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
.changeProductQuantity(
cart.shoppingCarts[index])
.then((value) {
if (model.state ==
ViewState.ErrorLocal) {
Utils.showErrorToast(
model.error);
} }
if (model.state ==
ViewState.ErrorLocal) {Utils.showErrorToast(model.error);}
}); });
}, },
() => model.deleteProduct( () {
cart.shoppingCarts[index]))) model.deleteProduct(cart.shoppingCarts[index]).then((value){
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
}
});
}))
], ],
), ),
), ),
@ -202,8 +200,8 @@ class CartOrderPage extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(TranslationBase.of(context).noData,
'There is no data', // 'There is no data',
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),
) )

@ -53,7 +53,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
languageID = await sharedPref.getString(APP_LANGUAGE); languageID = await sharedPref.getString(APP_LANGUAGE);
} }
List<RecommendedProductModel> recommendedProductList = []; // List<RecommendedProductModel> recommendedProductList = [];
List<ProductDetailViewModel> wishList = []; List<ProductDetailViewModel> wishList = [];
var model; var model;
@ -66,8 +66,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
checkWishlist(); checkWishlist();
// userInfo(widget.product.id, widget.product); // userInfo(widget.product.id, widget.product);
userInfo(id, product); userInfo(id, product);
print("-------------this--------------"); getLanguageID();
print(itemID);
} }
@override @override
@ -138,7 +137,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
return Container( return Container(
// width: 160.0, // width: 160.0,
height: height:
MediaQuery.of(context).size.height * 0.6, MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0), bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0), margin: EdgeInsets.only(right: 10.0),
@ -217,16 +216,8 @@ class _PharmacyPageState extends State<PharmacyPage> {
30.0)), 30.0)),
child: Text( child: Text(
languageID == "ar" languageID == "ar"
? model ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString()
.prescriptionsList[ : model.prescriptionsList[index].isInOutPatientDescription.toString(),
index]
.isInOutPatientDescriptionN
.toString()
: model
.prescriptionsList[
index]
.isInOutPatientDescription
.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,

@ -57,10 +57,10 @@ class ProductTileItem extends StatelessWidget {
shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)), shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
vertical: 4, vertical: 0,
), ),
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 0), padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3, width: MediaQuery.of(context).size.width / 3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -92,13 +92,13 @@ class ProductTileItem extends StatelessWidget {
borderRadius: borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)), BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: Texts( child: item.rxMessage != null ? Texts(
item.rxMessage != null ? item.rxMessage : "", projectProvider.isArabic ? item.rxMessagen : item.rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ): Texts(""),
) )
], ],
), ),

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -18,7 +19,7 @@ class _WishlistPageState extends State<WishlistPage> {
return BaseView<WishListViewModel>( return BaseView<WishListViewModel>(
onModelReady: (model) => model.getWishlistData(), onModelReady: (model) => model.getWishlistData(),
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: 'Wishlist page', appBarTitle: TranslationBase.of(context).wishlist,
isShowAppBar: widget.showBar, isShowAppBar: widget.showBar,
isShowDecPage: false, isShowDecPage: false,
isPharmacy: true, isPharmacy: true,

@ -93,11 +93,12 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
}, },
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount, appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: false, isShowAppBar: true,
isShowDecPage: false, isShowDecPage: false,
isPharmacy: true, isPharmacy: true,
body: user != null body: user != null
? Container( ? Container(
color: Colors.white,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -32,7 +33,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) => Widget child) =>
PharmacyAppScaffold( PharmacyAppScaffold(
appBarTitle: 'Search', appBarTitle: TranslationBase.of(context).search,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -53,7 +54,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
key: _formKey, key: _formKey,
child: TextFields( child: TextFields(
autoFocus: true, autoFocus: true,
hintText: 'Search', hintText: TranslationBase.of(context).search,
fontSize: 14.5, fontSize: 14.5,
prefixIcon: Icon(Icons.search), prefixIcon: Icon(Icons.search),
inputAction: TextInputAction.search, inputAction: TextInputAction.search,
@ -62,12 +63,14 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
}, },
onSubmit: (value) { onSubmit: (value) {
searchMedicine(model, context); searchMedicine(model, context);
msg = 'No Result Found'; // msg = 'No Result Found';
msg = TranslationBase.of(context).noResultFound;
}, },
controller: textController, controller: textController,
validator: (value) { validator: (value) {
if (value.isEmpty) { if (value.isEmpty) {
return 'please Enter Product Name'; // return 'please Enter Product Name';
return TranslationBase.of(context).pleaseEnterProductName;
} }
return null; return null;
}, },
@ -79,7 +82,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
), ),
InkWell( InkWell(
child: Texts( child: Texts(
'Cancel', TranslationBase.of(context).cancel,
fontSize: 17.0, fontSize: 17.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -22,7 +23,8 @@ class SubCategorisePage extends StatefulWidget {
SubCategorisePage({this.id, this.parentId, this.title}); SubCategorisePage({this.id, this.parentId, this.title});
@override @override
_SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); _SubCategorisePageState createState() =>
_SubCategorisePageState(id: id, title: title, parentId: parentId);
} }
class _SubCategorisePageState extends State<SubCategorisePage> { class _SubCategorisePageState extends State<SubCategorisePage> {
@ -50,7 +52,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
TextEditingController maxField = TextEditingController(); TextEditingController maxField = TextEditingController();
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id), onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: title, appBarTitle: title,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
@ -82,7 +86,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png'
: parentId == '9' : parentId == '9'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png'
: parentId == '10' : parentId ==
'10'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png'
: '', : '',
fit: BoxFit.fill, fit: BoxFit.fill,
@ -94,12 +99,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
children: [ children: [
InkWell( InkWell(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Container( child: Container(
child: Texts('View All Categories'), child: Texts(TranslationBase.of(context)
.viewCategorise),
), ),
), ),
Icon(Icons.arrow_forward) Icon(Icons.arrow_forward)
@ -111,21 +118,30 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Container( return Container(
height: MediaQuery.of(context).size.height * 0.89, height:
MediaQuery.of(context).size.height *
0.89,
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: model.subCategorise.length, itemCount:
itemBuilder: (BuildContext context, int index) { model.subCategorise.length,
itemBuilder: (BuildContext context,
int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
Texts(model.subCategorise[index].name), Texts(model
.subCategorise[
index]
.name),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: Colors.black12, color: Colors.black12,
@ -136,8 +152,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: FinalProductsPage( page:
id: model.subCategorise[index].id, FinalProductsPage(
id: model
.subCategorise[
index]
.id,
), ),
), ),
); );
@ -170,19 +190,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subCategorise.length, itemCount: model.subCategorise.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0), padding:
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment:
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 13.0), padding: EdgeInsets.symmetric(
horizontal: 13.0),
child: Container( child: Container(
height: 60.0, height: 60.0,
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200.withOpacity(0.45), color: Colors.orange.shade200
.withOpacity(0.45),
), ),
child: Center( child: Center(
child: Icon( child: Icon(
@ -193,8 +217,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.17, width: MediaQuery.of(context)
height: MediaQuery.of(context).size.height * 0.10, .size
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center( child: Center(
child: Texts( child: Texts(
model.subCategorise[index].name, model.subCategorise[index].name,
@ -240,7 +270,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
'Refine', TranslationBase.of(context).refine,
// 'Refine',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
], ],
@ -254,16 +285,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.95, maxChildSize: 0.95,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) { builder: (BuildContext context,
ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of(context).size.height * 1.95, height: MediaQuery.of(context)
.size
.height *
1.95,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -273,21 +309,30 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
'Refine', TranslationBase.of(
fontWeight: FontWeight.w600, context)
.refine,
// 'Refine',
fontWeight:
FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
), ),
InkWell( InkWell(
child: Texts( child: Texts(
'Close', TranslationBase.of(
context)
.closeIt,
// 'Close',
color: Colors.red, color: Colors.red,
fontWeight: FontWeight.w600, fontWeight:
FontWeight.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(
context);
}, },
), ),
], ],
@ -300,27 +345,39 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts('Categorise'), title: Texts(
TranslationBase.of(
context)
.categorise),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model.subCategorise, masterList: model
removeHistory: (item) { .subCategorise,
removeHistory:
(item) {
setState(() { setState(() {
entityList.remove(item); entityList
.remove(
item);
}); });
}, },
addHistory: (history) { addHistory:
(history) {
setState(() { setState(() {
entityList.add(history); entityList.add(
history);
}); });
}, },
addSelectedHistories: () { addSelectedHistories:
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: (master) => isEntityListSelected:
isEntityListSelected(master), (master) =>
isEntityListSelected(
master),
) )
], ],
), ),
@ -329,27 +386,40 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts('Brands'), title: Texts(
TranslationBase.of(
context)
.brands),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model.brandsList, masterList: model
removeHistory: (item) { .brandsList,
removeHistory:
(item) {
setState(() { setState(() {
entityListBrands.remove(item); entityListBrands
.remove(
item);
}); });
}, },
addHistory: (history) { addHistory:
(history) {
setState(() { setState(() {
entityListBrands.add(history); entityListBrands
.add(
history);
}); });
}, },
addSelectedHistories: () { addSelectedHistories:
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: (master) => isEntityListSelected:
isEntityListSelectedBrands(master), (master) =>
isEntityListSelectedBrands(
master),
) )
], ],
), ),
@ -358,43 +428,69 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts('Price'), title: Texts(
TranslationBase.of(
context)
.price),
children: [ children: [
Container( Container(
color: Color(0xffEEEEEE), color: Color(
0xffEEEEEE),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment:
MainAxisAlignment
.spaceAround,
children: [ children: [
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment
.start,
children: [ children: [
Texts('Min'), Texts(
'Min'),
Container( Container(
color: Colors.white, color: Colors
width: 200, .white,
height: 40, width:
child: TextFormField( 200,
decoration: InputDecoration( height:
border: OutlineInputBorder(), 40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: minField, controller:
minField,
), ),
), ),
], ],
), ),
Column( Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment
.start,
children: [ children: [
Texts('Max'), Texts(
'Max'),
Container( Container(
color: Colors.white, color: Colors
width: 200, .white,
height: 40, width:
child: TextFormField( 200,
decoration: InputDecoration( height:
border: OutlineInputBorder(), 40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: maxField, controller:
maxField,
), ),
), ),
], ],
@ -409,18 +505,32 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * 0.4, height: MediaQuery.of(
context)
.size
.height *
0.4,
), ),
Padding( Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Container( Expanded(
width: 100, child: Container(
child: Button( width: 100,
label: 'Reset', child: Button(
backgroundColor: Colors.red, label: TranslationBase.of(
context)
.reset,
// 'Reset',
backgroundColor:
Colors
.red,
),
), ),
), ),
SizedBox( SizedBox(
@ -429,36 +539,66 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
onTap: () async { onTap:
String categoriesId = ""; () async {
for (CategoriseParentModel category in entityList) { String
if (categoriesId == "") { categoriesId =
categoriesId = category.id; "";
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category
.id;
} else { } else {
categoriesId = "$categoriesId,${category.id}"; categoriesId =
"$categoriesId,${category.id}";
} }
} }
String brandIds = ""; String
brandIds =
"";
for (CategoriseParentModel brand for (CategoriseParentModel brand
in entityListBrands) { in entityListBrands) {
if (brandIds == "") { if (brandIds ==
brandIds = brand.id; "") {
brandIds =
brand
.id;
} else { } else {
brandIds = "$brandIds,${brand.id}"; brandIds =
"$brandIds,${brand.id}";
} }
} }
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils
.showMyDialog(
context);
await model.getFilteredSubProducts( await model.getFilteredSubProducts(
min: minField.text.toString(), min: minField
max: maxField.text.toString(), .text
categoryId: categoriesId, .toString(),
brandId: brandIds); max: maxField
GifLoaderDialogUtils.hideDialog(context); .text
Navigator.pop(context); .toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(
context);
}, },
label: 'Apply', label: TranslationBase.of(
backgroundColor: Colors.green, context)
.apply,
// 'Apply',
backgroundColor:
Colors
.green,
), ),
), ),
], ],
@ -524,10 +664,13 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
@ -539,7 +682,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
baseViewModel: model, baseViewModel: model,
child: InkWell( child: InkWell(
child: Card( child: Card(
color: model.subProducts[index].discountName != null color: model.subProducts[index]
.discountName !=
null
? Color(0xffFFFF00) ? Color(0xffFFFF00)
: Colors.white, : Colors.white,
elevation: 0, elevation: 0,
@ -572,41 +717,77 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.symmetric(horizontal: 0), padding: EdgeInsets.symmetric(
width: MediaQuery.of(context).size.width / 3, horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Stack( Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0), margin:
alignment: Alignment.center, EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.subProducts[index].images.isNotEmpty model
? model.subProducts[index].images[0].thumb .subProducts[
index]
.images
.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
), ),
), ),
Container( Container(
width: model.subProducts[index].rxMessage != null width: model
? MediaQuery.of(context).size.width / 5 .subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: Texts( child: Texts(
model.subProducts[index].rxMessage != null model.subProducts[index]
? model.subProducts[index].rxMessage .rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "", : "",
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
), ),
), ),
], ],
@ -617,16 +798,24 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment
.start,
children: [ children: [
Texts( Texts(
model.subProducts[index].name, model.subProducts[index]
.name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4), padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.subProducts[index].price}", "SAR ${model.subProducts[index].price}",
bold: true, bold: true,
@ -636,20 +825,26 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: totalAverage: model
model.subProducts[index].approvedRatingSum > 0 .subProducts[
? (model.subProducts[index].approvedRatingSum index]
.toDouble() / .approvedRatingSum >
model.subProducts[index].approvedRatingSum 0
.toDouble()) ? (model.subProducts[index].approvedRatingSum
.toDouble() .toDouble() /
: 0, model
.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true), forceStars: true),
Texts( Texts(
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
) )
], ],
), ),
@ -664,7 +859,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage(model.subProducts[index]), page: ProductDetailPage(
model.subProducts[index]),
)), )),
}, },
)); ));
@ -672,11 +868,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
) )
: Container( : Container(
height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
child: Row( child: Row(
@ -686,9 +885,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
@ -696,11 +897,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0), margin:
alignment: Alignment.center, EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.subProducts[index].images.isNotEmpty model
? model.subProducts[index].images[0].thumb .subProducts[
index]
.images
.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.contain, fit: BoxFit.contain,
height: 80, height: 80,
@ -711,22 +923,42 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
width: model.subProducts[index].rxMessage != null width: model
? MediaQuery.of(context).size.width / 5 .subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: Texts( child: Texts(
model.subProducts[index].rxMessage != null model.subProducts[index]
? model.subProducts[index].rxMessage .rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "", : "",
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
), ),
), ),
], ],
@ -740,19 +972,28 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.65, width:
MediaQuery.of(context)
.size
.width *
0.65,
child: Texts( child: Texts(
model.subProducts[index].name, model.subProducts[index]
.name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight:
FontWeight.w500,
maxLines: 5, maxLines: 5,
), ),
), ),
@ -760,7 +1001,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: 8.0, height: 8.0,
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4), padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${model.subProducts[index].price}", "SAR ${model.subProducts[index].price}",
bold: true, bold: true,
@ -770,9 +1013,20 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: model.subProducts[index].approvedRatingSum > 0 totalAverage: model
? (model.subProducts[index].approvedRatingSum.toDouble() / .subProducts[
model.subProducts[index].approvedRatingSum index]
.approvedRatingSum >
0
? (model
.subProducts[
index]
.approvedRatingSum
.toDouble() /
model
.subProducts[
index]
.approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
: 0, : 0,
@ -781,7 +1035,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
) )
], ],
), ),
@ -795,7 +1050,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage(model.subProducts[index]), page: ProductDetailPage(
model.subProducts[index]),
)), )),
}, },
); );
@ -809,7 +1065,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id); Iterable<CategoriseParentModel> history =
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
@ -817,7 +1074,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id); Iterable<CategoriseParentModel> history =
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -16,9 +16,11 @@ class RecommendedProductService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser(); AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider(); AuthProvider authProvider = new AuthProvider();
List<Map<String, dynamic>> _recommendedProductList = List(); // List<Map<String, dynamic>> _recommendedProductList = List();
List<Map<String, Object>> get recommendedList => _recommendedProductList; // List<Map<String, Object>> get recommendedList => _recommendedProductList;
List<RecommendedProductModel> _recommendedProductList = List();
List<RecommendedProductModel> get recommendedList => _recommendedProductList;
Future getRecommendedProducts(productId) async { Future getRecommendedProducts(productId) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
@ -28,11 +30,10 @@ class RecommendedProductService extends BaseService{
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_recommendedProductList.clear(); _recommendedProductList.clear();
response['products'].forEach((item) { response['products'].forEach((item) {
_recommendedProductList.add(item); // _recommendedProductList.add(item);
_recommendedProductList.add(RecommendedProductModel.fromJson(item));
}); });
print("---------------------Recommended Product List------------------------");
print(_recommendedProductList.length);
//print(item['name']); //print(item['name']);
print(response); print(response);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {

@ -66,6 +66,8 @@ class TranslationBase {
localizedValues['enterDocName'][locale.languageCode]; localizedValues['enterDocName'][locale.languageCode];
String get search => localizedValues['search'][locale.languageCode]; String get search => localizedValues['search'][locale.languageCode];
String get noResultFound => localizedValues['noResultFound'][locale.languageCode];
String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode];
String get bookNow => localizedValues['bookNow'][locale.languageCode]; String get bookNow => localizedValues['bookNow'][locale.languageCode];
@ -341,6 +343,7 @@ class TranslationBase {
localizedValues['scanQRHospital'][locale.languageCode]; localizedValues['scanQRHospital'][locale.languageCode];
String get sendEmail => localizedValues['sendEmail'][locale.languageCode]; String get sendEmail => localizedValues['sendEmail'][locale.languageCode];
String get close => localizedValues['close'][locale.languageCode]; String get close => localizedValues['close'][locale.languageCode];
String get closeIt => localizedValues['closeIt'][locale.languageCode];
String get booked => localizedValues['booked'][locale.languageCode]; String get booked => localizedValues['booked'][locale.languageCode];
String get confirmed => localizedValues['confirmed'][locale.languageCode]; String get confirmed => localizedValues['confirmed'][locale.languageCode];
String get arrived => localizedValues['arrived'][locale.languageCode]; String get arrived => localizedValues['arrived'][locale.languageCode];
@ -725,7 +728,12 @@ class TranslationBase {
String get orders => localizedValues['orders'][locale.languageCode]; String get orders => localizedValues['orders'][locale.languageCode];
String get lakum => localizedValues['lakum'][locale.languageCode]; String get lakum => localizedValues['lakum'][locale.languageCode];
String get wishlist => localizedValues['wishlist'][locale.languageCode]; String get wishlist => localizedValues['wishlist'][locale.languageCode];
String get brands => localizedValues['brands'][locale.languageCode];
String get products => localizedValues['products'][locale.languageCode];
String get reviews => localizedValues['reviews'][locale.languageCode]; String get reviews => localizedValues['reviews'][locale.languageCode];
String get productDetails => localizedValues['productDetails'][locale.languageCode];
String get noReviewsAvailable => localizedValues['noReviewsAvailable'][locale.languageCode];
String get noLocationAvailable => localizedValues['noLocationAvailable'][locale.languageCode];
String get myPrescriptions => String get myPrescriptions =>
localizedValues['myPrescriptions'][locale.languageCode]; localizedValues['myPrescriptions'][locale.languageCode];
String get medicationRefill => String get medicationRefill =>
@ -901,6 +909,10 @@ class TranslationBase {
String get iAm => localizedValues['i-am'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode];
String get yearOld => localizedValues['years-old'][locale.languageCode]; String get yearOld => localizedValues['years-old'][locale.languageCode];
String get categorise => localizedValues['categorise'][locale.languageCode]; String get categorise => localizedValues['categorise'][locale.languageCode];
String get refine => localizedValues['refine'][locale.languageCode];
String get apply => localizedValues['apply'][locale.languageCode];
String get reset => localizedValues['reset'][locale.languageCode];
String get viewCategorise => localizedValues['viewCategorise'][locale.languageCode];
String get cart => localizedValues['cart'][locale.languageCode]; String get cart => localizedValues['cart'][locale.languageCode];
String get wishList => localizedValues['wishList'][locale.languageCode]; String get wishList => localizedValues['wishList'][locale.languageCode];
String get Alhabibapp => localizedValues['Alhabibapp'][locale.languageCode]; String get Alhabibapp => localizedValues['Alhabibapp'][locale.languageCode];
@ -1377,9 +1389,14 @@ class TranslationBase {
String get quantitySize => String get quantitySize =>
localizedValues['quantitySize'][locale.languageCode]; localizedValues['quantitySize'][locale.languageCode];
String get addToCart => localizedValues['addToCart'][locale.languageCode]; String get addToCart => localizedValues['addToCart'][locale.languageCode];
String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode];
String get buyNow => localizedValues['buyNow'][locale.languageCode]; String get buyNow => localizedValues['buyNow'][locale.languageCode];
String get quantityShortcut => String get quantityShortcut =>
localizedValues['quantityShortcut'][locale.languageCode]; localizedValues['quantityShortcut'][locale.languageCode];
String get noData =>
localizedValues['noData'][locale.languageCode];
String get no_data =>
localizedValues['no_data'][locale.languageCode];
String get year => localizedValues['Year'][locale.languageCode]; String get year => localizedValues['Year'][locale.languageCode];
String get month => localizedValues['Month'][locale.languageCode]; String get month => localizedValues['Month'][locale.languageCode];

@ -24,23 +24,26 @@ class productTile extends StatelessWidget {
final int status; final int status;
final PharmacyProduct product; final PharmacyProduct product;
final dynamic productID; final dynamic productID;
final Function onDelete;
// final VoidCallback deleteWishlistItems;
productTile({ productTile(
this.productName, {this.productName,
this.productPrice, this.productPrice,
this.productRate, this.productRate,
this.productReviews, this.productReviews,
this.qyt, this.qyt,
this.totalPrice, this.totalPrice,
this.isOrderDetails = false, this.isOrderDetails = false,
this.productImage, this.productImage,
this.showLine = true, this.showLine = true,
this.img, this.img,
this.imgs, this.imgs,
this.status, this.status,
this.product, this.product,
this.productID, this.productID,
}); this.onDelete,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -136,9 +139,10 @@ class productTile extends StatelessWidget {
children: [ children: [
IconButton( IconButton(
icon: Icon(FontAwesomeIcons.trashAlt, size: 15), icon: Icon(FontAwesomeIcons.trashAlt, size: 15),
onPressed: (){ onPressed: () {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
deleteFromWishlistFunction(productID); // deleteFromWishlistFunction(productID);
onDelete(productID);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, },
), ),
@ -148,14 +152,13 @@ class productTile extends StatelessWidget {
IconButton( IconButton(
icon: Icon(FontAwesomeIcons.shoppingCart, size: 15), icon: Icon(FontAwesomeIcons.shoppingCart, size: 15),
onPressed: () async { onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await addToCartFunction(1, productID); await addToCartFunction(1, productID);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push( Navigator.push(
context, context,
FadePage(page: CartOrderPage()), FadePage(page: CartOrderPage()),
); );
}, },
), ),
], ],
@ -293,10 +296,10 @@ class productTile extends StatelessWidget {
); );
} }
deleteFromWishlistFunction(itemID) async { // deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); // ProductDetailViewModel x = new ProductDetailViewModel();
await x.deletWishlistData(itemID); // await x.deletWishlistData(itemID);
} // }
addToCartFunction(quantity, itemID) async { addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel(); ProductDetailViewModel x = new ProductDetailViewModel();

Loading…
Cancel
Save