connecting pages.

trnaslate.
calling API.
review page.
product details page.
Wishlist page.
Brands page.
merge-requests/227/head
enadhilal 4 years ago
parent 727940c5c6
commit 10734d5994

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -6,7 +6,8 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
const MAX_SMALL_SCREEN = 660;
const BASE_URL = 'https://hmgwebservices.com/';
//const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
//const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/';
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
@ -245,7 +246,7 @@ const UPDATE_HEALTH_TERMS =
const CHANNEL = 3;
const GENERAL_ID = 'Cs2020@2016\$2958';
const IP_ADDRESS = '10.20.10.20';
const VERSION_ID = 5.6;
const VERSION_ID = 6.1;
const SETUP_ID = '91877';
const LANGUAGE = 2;
const PATIENT_OUT_SA = 0;
@ -413,11 +414,14 @@ const PATIENT_ER_INSERT_PRES_ORDER =
//Pharmacy wishlist
const GET_WISHLIST = "shopping_cart_items/";
const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id=";
const GET_REVIEW = "customerreviews/";
const GET_BRANDS = "manufacturer";
const GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8";
const GET_PRODUCT_DETAIL = "products/";
const GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU";
const GET_SPECIFICATION = "productspecification/";
const GET_BRAND_ITEMS = "products?ManufacturerId=";
// External API
const ADD_ADDRESS_INFO =

@ -1157,4 +1157,50 @@ const Map localizedValues = {
"en": "Select Home Health Care Services",
"ar": " حدد خدمات الرعاية الصحية المنزلية"
},
"topBrands":{
"en":"Top Brands",
"ar":"اعلى العلامات التجارية"
},
"notifyMe":{
"en":"notify me",
"ar":"اعلمني"
},
"specification":{
"en":"Specification",
"ar":"تخصيص"
},
"details":{
"en":"Details",
"ar":"تفاصيل"
},
"availability":{
"en":"Availability",
"ar":"التوفر"
},
"quantity":{
"en":"Quantity",
"ar":"التوفر"
},
"quantitySize":{
"en":"Quantity",
"ar":"كميه"
},
"addToCart":{
"en":"add to cart",
"ar":"إضفة للسلة"
},
"buyNow":{
"en":"buy now",
"ar":"إشتري الان"
},
"quantityShortcut":{
"en":"QTY",
"ar":"كمية"
},
};

@ -14,6 +14,9 @@ class BrandsViewModel extends BaseViewModel{
BrandsService _topBrandsService = locator<BrandsService>();
List<TopBrand> get topBrandsListList => _topBrandsService.topBrandsList;
List<Brand> get searchList =>
_brandsService.searchList;
bool hasError = false;
@ -38,4 +41,17 @@ class BrandsViewModel extends BaseViewModel{
} else
setState(ViewState.Idle);
}
Future searchProducts({String productName}) async {
hasError = false;
_brandsService.clearSearchList();
setState(ViewState.Busy);
await _brandsService.searchProducts(productName: productName);
if (_brandsService.hasError) {
error = _brandsService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -1,26 +1,36 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import '../../../locator.dart';
class ProductDetailViewModel extends BaseViewModel{
ProductDetailService _productDetailService = locator<ProductDetailService>();
ProductDetailService _productLocationService = locator<ProductDetailService>();
ProductDetailService _productWishlistService = locator<ProductDetailService>();
ProductDetailService _productSpecification = locator<ProductDetailService>();
List<ProductDetail> get productDetailService => _productDetailService.productDetailList;
List<LocationModel> get productLocationService => _productDetailService.productLocationList;
List<LocationModel> get productLocationService => _productLocationService.productLocationList;
List<Wishlist> get wishListItems => _productWishlistService.wishListProducts;
List<SpecificationModel> get productSpecification => _productSpecification.productSpecification;
bool hasError = false;
Future getProductReviewsData() async {
Future getProductReviewsData(productID) async {
print('ENAD REview');
hasError = false;
setState(ViewState.Busy);
await _productDetailService.getProductReviews();
await _productDetailService.getProductReviews(productID);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);
@ -29,15 +39,72 @@ class ProductDetailViewModel extends BaseViewModel{
}
Future getProductLocationData() async {
print('ENAD in model view');
hasError = false;
setState(ViewState.Busy);
await _productDetailService.getProductAvailabiltyDetail();
if (_productDetailService.hasError) {
error = _productDetailService.error;
await _productLocationService.getProductAvailabiltyDetail();
if (_productLocationService.hasError) {
error = _productLocationService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future addToCartData(quantity, itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productLocationService.addToCart(quantity, itemID);
if (_productLocationService.hasError) {
error = _productLocationService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future addToWishlistData(itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productLocationService.addToWishlist(itemID);
if (_productLocationService.hasError) {
error = _productLocationService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future checkWishlistData() async {
hasError = false;
setState(ViewState.Busy);
await _productWishlistService.getWishlistItems();
if (_productWishlistService.hasError) {
error = _productWishlistService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future deletWishlistData(itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productWishlistService.delteItemFromWishlist(itemID);
if (_productWishlistService.hasError) {
error = _productWishlistService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future productSpecificationData(itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productWishlistService.productSpecificationData(itemID);
if (_productWishlistService.hasError) {
error = _productWishlistService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -10,9 +10,11 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import 'config/size_config.dart';
import 'core/viewModels/project_view_model.dart';
import 'locator.dart';
import 'pages/pharmacies/compare-list.dart';
void main() async {
setupLocator();
@ -45,7 +47,9 @@ class MyApp extends StatelessWidget {
StreamProvider.value(
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),
)
),
ChangeNotifierProvider<CompareList>(
create: (context) => CompareList()),
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(

@ -0,0 +1,924 @@
// To parse this JSON data, do
//
// final shoppingCart = shoppingCartFromJson(jsonString);
import 'dart:convert';
ShoppingCart shoppingCartFromJson(String str) => ShoppingCart.fromJson(json.decode(str));
String shoppingCartToJson(ShoppingCart data) => json.encode(data.toJson());
class ShoppingCart {
ShoppingCart({
this.itemCount,
this.quantityCount,
this.subtotal,
this.subtotalWithVat,
this.subtotalVatAmount,
this.subtotalVatRate,
this.shoppingCarts,
});
int itemCount;
int quantityCount;
double subtotal;
double subtotalWithVat;
double subtotalVatAmount;
int subtotalVatRate;
List<ShoppingCartElement> shoppingCarts;
factory ShoppingCart.fromJson(Map<String, dynamic> json) => ShoppingCart(
itemCount: json["item_count"],
quantityCount: json["quantity_count"],
subtotal: json["subtotal"].toDouble(),
subtotalWithVat: json["subtotal_with_vat"].toDouble(),
subtotalVatAmount: json["subtotal_vat_amount"].toDouble(),
subtotalVatRate: json["subtotal_vat_rate"],
shoppingCarts: List<ShoppingCartElement>.from(json["shopping_carts"].map((x) => ShoppingCartElement.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"item_count": itemCount,
"quantity_count": quantityCount,
"subtotal": subtotal,
"subtotal_with_vat": subtotalWithVat,
"subtotal_vat_amount": subtotalVatAmount,
"subtotal_vat_rate": subtotalVatRate,
"shopping_carts": List<dynamic>.from(shoppingCarts.map((x) => x.toJson())),
};
}
class ShoppingCartElement {
ShoppingCartElement({
this.languageId,
this.id,
this.productAttributes,
this.customerEnteredPrice,
this.quantity,
this.discountAmountInclTax,
this.subtotal,
this.subtotalWithVat,
this.subtotalVatAmount,
this.subtotalVatRate,
this.currency,
this.currencyn,
this.rentalStartDateUtc,
this.rentalEndDateUtc,
this.createdOnUtc,
this.updatedOnUtc,
this.shoppingCartType,
this.productId,
this.product,
this.customerId,
this.customer,
});
int languageId;
String id;
List<dynamic> productAttributes;
int customerEnteredPrice;
int quantity;
dynamic discountAmountInclTax;
String subtotal;
String subtotalWithVat;
String subtotalVatAmount;
String subtotalVatRate;
String currency;
String currencyn;
dynamic rentalStartDateUtc;
dynamic rentalEndDateUtc;
DateTime createdOnUtc;
DateTime updatedOnUtc;
String shoppingCartType;
int productId;
Product product;
int customerId;
Customer customer;
factory ShoppingCartElement.fromJson(Map<String, dynamic> json) => ShoppingCartElement(
languageId: json["language_id"],
id: json["id"],
productAttributes: List<dynamic>.from(json["product_attributes"].map((x) => x)),
customerEnteredPrice: json["customer_entered_price"],
quantity: json["quantity"],
discountAmountInclTax: json["discount_amount_incl_tax"],
subtotal: json["subtotal"],
subtotalWithVat: json["subtotal_with_vat"],
subtotalVatAmount: json["subtotal_vat_amount"],
subtotalVatRate: json["subtotal_vat_rate"],
currency: json["currency"],
currencyn: json["currencyn"],
rentalStartDateUtc: json["rental_start_date_utc"],
rentalEndDateUtc: json["rental_end_date_utc"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
updatedOnUtc: DateTime.parse(json["updated_on_utc"]),
shoppingCartType: json["shopping_cart_type"],
productId: json["product_id"],
product: Product.fromJson(json["product"]),
customerId: json["customer_id"],
customer: Customer.fromJson(json["customer"]),
);
Map<String, dynamic> toJson() => {
"language_id": languageId,
"id": id,
"product_attributes": List<dynamic>.from(productAttributes.map((x) => x)),
"customer_entered_price": customerEnteredPrice,
"quantity": quantity,
"discount_amount_incl_tax": discountAmountInclTax,
"subtotal": subtotal,
"subtotal_with_vat": subtotalWithVat,
"subtotal_vat_amount": subtotalVatAmount,
"subtotal_vat_rate": subtotalVatRate,
"currency": currency,
"currencyn": currencyn,
"rental_start_date_utc": rentalStartDateUtc,
"rental_end_date_utc": rentalEndDateUtc,
"created_on_utc": createdOnUtc.toIso8601String(),
"updated_on_utc": updatedOnUtc.toIso8601String(),
"shopping_cart_type": shoppingCartType,
"product_id": productId,
"product": product.toJson(),
"customer_id": customerId,
"customer": customer.toJson(),
};
}
class Customer {
Customer({
this.billingAddress,
this.shippingAddress,
this.addresses,
this.id,
this.username,
this.email,
this.firstName,
this.lastName,
this.languageId,
this.adminComment,
this.isTaxExempt,
this.hasShoppingCartItems,
this.active,
this.deleted,
this.isSystemAccount,
this.systemName,
this.lastIpAddress,
this.createdOnUtc,
this.lastLoginDateUtc,
this.lastActivityDateUtc,
this.registeredInStoreId,
this.roleIds,
});
Address billingAddress;
Address shippingAddress;
List<Address> addresses;
String id;
String username;
String email;
dynamic firstName;
dynamic lastName;
dynamic languageId;
dynamic adminComment;
bool isTaxExempt;
bool hasShoppingCartItems;
bool active;
bool deleted;
bool isSystemAccount;
dynamic systemName;
String lastIpAddress;
DateTime createdOnUtc;
DateTime lastLoginDateUtc;
DateTime lastActivityDateUtc;
int registeredInStoreId;
List<dynamic> roleIds;
factory Customer.fromJson(Map<String, dynamic> json) => Customer(
billingAddress: Address.fromJson(json["billing_address"]),
shippingAddress: Address.fromJson(json["shipping_address"]),
addresses: List<Address>.from(json["addresses"].map((x) => Address.fromJson(x))),
id: json["id"],
username: json["username"],
email: json["email"],
firstName: json["first_name"],
lastName: json["last_name"],
languageId: json["language_id"],
adminComment: json["admin_comment"],
isTaxExempt: json["is_tax_exempt"],
hasShoppingCartItems: json["has_shopping_cart_items"],
active: json["active"],
deleted: json["deleted"],
isSystemAccount: json["is_system_account"],
systemName: json["system_name"],
lastIpAddress: json["last_ip_address"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
lastLoginDateUtc: DateTime.parse(json["last_login_date_utc"]),
lastActivityDateUtc: DateTime.parse(json["last_activity_date_utc"]),
registeredInStoreId: json["registered_in_store_id"],
roleIds: List<dynamic>.from(json["role_ids"].map((x) => x)),
);
Map<String, dynamic> toJson() => {
"billing_address": billingAddress.toJson(),
"shipping_address": shippingAddress.toJson(),
"addresses": List<dynamic>.from(addresses.map((x) => x.toJson())),
"id": id,
"username": username,
"email": email,
"first_name": firstName,
"last_name": lastName,
"language_id": languageId,
"admin_comment": adminComment,
"is_tax_exempt": isTaxExempt,
"has_shopping_cart_items": hasShoppingCartItems,
"active": active,
"deleted": deleted,
"is_system_account": isSystemAccount,
"system_name": systemName,
"last_ip_address": lastIpAddress,
"created_on_utc": createdOnUtc.toIso8601String(),
"last_login_date_utc": lastLoginDateUtc.toIso8601String(),
"last_activity_date_utc": lastActivityDateUtc.toIso8601String(),
"registered_in_store_id": registeredInStoreId,
"role_ids": List<dynamic>.from(roleIds.map((x) => x)),
};
}
class Address {
Address({
this.id,
this.firstName,
this.lastName,
this.email,
this.company,
this.countryId,
this.country,
this.stateProvinceId,
this.city,
this.address1,
this.address2,
this.zipPostalCode,
this.phoneNumber,
this.faxNumber,
this.customerAttributes,
this.createdOnUtc,
this.province,
this.latLong,
});
String id;
FirstName firstName;
LastName lastName;
Email email;
dynamic company;
int countryId;
Country country;
dynamic stateProvinceId;
City city;
String address1;
String address2;
String zipPostalCode;
String phoneNumber;
dynamic faxNumber;
String customerAttributes;
DateTime createdOnUtc;
dynamic province;
String latLong;
factory Address.fromJson(Map<String, dynamic> json) => Address(
id: json["id"],
firstName: firstNameValues.map[json["first_name"]],
lastName: lastNameValues.map[json["last_name"]],
email: emailValues.map[json["email"]],
company: json["company"],
countryId: json["country_id"],
country: countryValues.map[json["country"]],
stateProvinceId: json["state_province_id"],
city: cityValues.map[json["city"]],
address1: json["address1"],
address2: json["address2"],
zipPostalCode: json["zip_postal_code"],
phoneNumber: json["phone_number"],
faxNumber: json["fax_number"],
customerAttributes: json["customer_attributes"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
province: json["province"],
latLong: json["lat_long"],
);
Map<String, dynamic> toJson() => {
"id": id,
"first_name": firstNameValues.reverse[firstName],
"last_name": lastNameValues.reverse[lastName],
"email": emailValues.reverse[email],
"company": company,
"country_id": countryId,
"country": countryValues.reverse[country],
"state_province_id": stateProvinceId,
"city": cityValues.reverse[city],
"address1": address1,
"address2": address2,
"zip_postal_code": zipPostalCode,
"phone_number": phoneNumber,
"fax_number": faxNumber,
"customer_attributes": customerAttributes,
"created_on_utc": createdOnUtc.toIso8601String(),
"province": province,
"lat_long": latLong,
};
}
enum City { CALIFORNIA, RIYADH, AL_OYUN }
final cityValues = EnumValues({
"Al Oyun": City.AL_OYUN,
"California": City.CALIFORNIA,
"Riyadh": City.RIYADH
});
enum Country { UNITED_STATES, SAUDI_ARABIA }
final countryValues = EnumValues({
"Saudi Arabia": Country.SAUDI_ARABIA,
"United States": Country.UNITED_STATES
});
enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM, TAMER_F_CLOUDSOLUTION_SA_COM }
final emailValues = EnumValues({
"Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM,
"Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM,
"Tamer.F@cloudsolution-sa.com": Email.TAMER_F_CLOUDSOLUTION_SA_COM
});
enum FirstName { TAMER, TAMER_FANASHEH }
final firstNameValues = EnumValues({
"TAMER": FirstName.TAMER,
"TAMER FANASHEH": FirstName.TAMER_FANASHEH
});
enum LastName { FANASHEH, MUSA }
final lastNameValues = EnumValues({
"FANASHEH": LastName.FANASHEH,
"MUSA": LastName.MUSA
});
class Product {
Product({
this.id,
this.visibleIndividually,
this.name,
this.namen,
this.localizedNames,
this.shortDescription,
this.shortDescriptionn,
this.fullDescription,
this.fullDescriptionn,
this.markasNew,
this.showOnHomePage,
this.metaKeywords,
this.metaDescription,
this.metaTitle,
this.allowCustomerReviews,
this.approvedRatingSum,
this.notApprovedRatingSum,
this.approvedTotalReviews,
this.notApprovedTotalReviews,
this.sku,
this.isRx,
this.prescriptionRequired,
this.rxMessage,
this.rxMessagen,
this.manufacturerPartNumber,
this.gtin,
this.isGiftCard,
this.requireOtherProducts,
this.automaticallyAddRequiredProducts,
this.isDownload,
this.unlimitedDownloads,
this.maxNumberOfDownloads,
this.downloadExpirationDays,
this.hasSampleDownload,
this.hasUserAgreement,
this.isRecurring,
this.recurringCycleLength,
this.recurringTotalCycles,
this.isRental,
this.rentalPriceLength,
this.isShipEnabled,
this.isFreeShipping,
this.shipSeparately,
this.additionalShippingCharge,
this.isTaxExempt,
this.isTelecommunicationsOrBroadcastingOrElectronicServices,
this.useMultipleWarehouses,
this.manageInventoryMethodId,
this.stockQuantity,
this.stockAvailability,
this.stockAvailabilityn,
this.displayStockAvailability,
this.displayStockQuantity,
this.minStockQuantity,
this.notifyAdminForQuantityBelow,
this.allowBackInStockSubscriptions,
this.orderMinimumQuantity,
this.orderMaximumQuantity,
this.allowedQuantities,
this.allowAddingOnlyExistingAttributeCombinations,
this.disableBuyButton,
this.disableWishlistButton,
this.availableForPreOrder,
this.preOrderAvailabilityStartDateTimeUtc,
this.callForPrice,
this.price,
this.oldPrice,
this.productCost,
this.specialPrice,
this.specialPriceStartDateTimeUtc,
this.specialPriceEndDateTimeUtc,
this.customerEntersPrice,
this.minimumCustomerEnteredPrice,
this.maximumCustomerEnteredPrice,
this.basepriceEnabled,
this.basepriceAmount,
this.basepriceBaseAmount,
this.hasTierPrices,
this.hasDiscountsApplied,
this.discountName,
this.discountNamen,
this.discountDescription,
this.discountDescriptionn,
this.discountPercentage,
this.currency,
this.currencyn,
this.weight,
this.length,
this.width,
this.height,
this.availableStartDateTimeUtc,
this.availableEndDateTimeUtc,
this.displayOrder,
this.published,
this.deleted,
this.createdOnUtc,
this.updatedOnUtc,
this.productType,
this.parentGroupedProductId,
this.roleIds,
this.discountIds,
this.storeIds,
this.manufacturerIds,
this.reviews,
this.images,
this.attributes,
this.specifications,
this.associatedProductIds,
this.tags,
this.vendorId,
this.seName,
});
String id;
bool visibleIndividually;
String name;
String namen;
List<LocalizedName> localizedNames;
String shortDescription;
String shortDescriptionn;
String fullDescription;
String fullDescriptionn;
bool markasNew;
bool showOnHomePage;
String metaKeywords;
String metaDescription;
String metaTitle;
bool allowCustomerReviews;
int approvedRatingSum;
int notApprovedRatingSum;
int approvedTotalReviews;
int notApprovedTotalReviews;
String sku;
bool isRx;
bool prescriptionRequired;
dynamic rxMessage;
dynamic rxMessagen;
dynamic manufacturerPartNumber;
dynamic gtin;
bool isGiftCard;
bool requireOtherProducts;
bool automaticallyAddRequiredProducts;
bool isDownload;
bool unlimitedDownloads;
int maxNumberOfDownloads;
dynamic downloadExpirationDays;
bool hasSampleDownload;
bool hasUserAgreement;
bool isRecurring;
int recurringCycleLength;
int recurringTotalCycles;
bool isRental;
int rentalPriceLength;
bool isShipEnabled;
bool isFreeShipping;
bool shipSeparately;
int additionalShippingCharge;
bool isTaxExempt;
bool isTelecommunicationsOrBroadcastingOrElectronicServices;
bool useMultipleWarehouses;
int manageInventoryMethodId;
int stockQuantity;
String stockAvailability;
String stockAvailabilityn;
bool displayStockAvailability;
bool displayStockQuantity;
int minStockQuantity;
int notifyAdminForQuantityBelow;
bool allowBackInStockSubscriptions;
int orderMinimumQuantity;
int orderMaximumQuantity;
dynamic allowedQuantities;
bool allowAddingOnlyExistingAttributeCombinations;
bool disableBuyButton;
bool disableWishlistButton;
bool availableForPreOrder;
dynamic preOrderAvailabilityStartDateTimeUtc;
bool callForPrice;
double price;
int oldPrice;
double productCost;
dynamic specialPrice;
dynamic specialPriceStartDateTimeUtc;
dynamic specialPriceEndDateTimeUtc;
bool customerEntersPrice;
int minimumCustomerEnteredPrice;
int maximumCustomerEnteredPrice;
bool basepriceEnabled;
int basepriceAmount;
int basepriceBaseAmount;
bool hasTierPrices;
bool hasDiscountsApplied;
dynamic discountName;
dynamic discountNamen;
dynamic discountDescription;
dynamic discountDescriptionn;
dynamic discountPercentage;
String currency;
String currencyn;
double weight;
int length;
int width;
int height;
dynamic availableStartDateTimeUtc;
dynamic availableEndDateTimeUtc;
int displayOrder;
bool published;
bool deleted;
DateTime createdOnUtc;
DateTime updatedOnUtc;
String productType;
int parentGroupedProductId;
List<dynamic> roleIds;
List<dynamic> discountIds;
List<dynamic> storeIds;
List<int> manufacturerIds;
List<dynamic> reviews;
List<Image> images;
List<dynamic> attributes;
List<Specification> specifications;
List<dynamic> associatedProductIds;
List<dynamic> tags;
int vendorId;
String seName;
factory Product.fromJson(Map<String, dynamic> json) => Product(
id: json["id"],
visibleIndividually: json["visible_individually"],
name: json["name"],
namen: json["namen"],
localizedNames: List<LocalizedName>.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))),
shortDescription: json["short_description"],
shortDescriptionn: json["short_descriptionn"],
fullDescription: json["full_description"],
fullDescriptionn: json["full_descriptionn"],
markasNew: json["markas_new"],
showOnHomePage: json["show_on_home_page"],
metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"],
metaDescription: json["meta_description"] == null ? null : json["meta_description"],
metaTitle: json["meta_title"] == null ? null : json["meta_title"],
allowCustomerReviews: json["allow_customer_reviews"],
approvedRatingSum: json["approved_rating_sum"],
notApprovedRatingSum: json["not_approved_rating_sum"],
approvedTotalReviews: json["approved_total_reviews"],
notApprovedTotalReviews: json["not_approved_total_reviews"],
sku: json["sku"],
isRx: json["is_rx"],
prescriptionRequired: json["prescription_required"],
rxMessage: json["rx_message"],
rxMessagen: json["rx_messagen"],
manufacturerPartNumber: json["manufacturer_part_number"],
gtin: json["gtin"],
isGiftCard: json["is_gift_card"],
requireOtherProducts: json["require_other_products"],
automaticallyAddRequiredProducts: json["automatically_add_required_products"],
isDownload: json["is_download"],
unlimitedDownloads: json["unlimited_downloads"],
maxNumberOfDownloads: json["max_number_of_downloads"],
downloadExpirationDays: json["download_expiration_days"],
hasSampleDownload: json["has_sample_download"],
hasUserAgreement: json["has_user_agreement"],
isRecurring: json["is_recurring"],
recurringCycleLength: json["recurring_cycle_length"],
recurringTotalCycles: json["recurring_total_cycles"],
isRental: json["is_rental"],
rentalPriceLength: json["rental_price_length"],
isShipEnabled: json["is_ship_enabled"],
isFreeShipping: json["is_free_shipping"],
shipSeparately: json["ship_separately"],
additionalShippingCharge: json["additional_shipping_charge"],
isTaxExempt: json["is_tax_exempt"],
isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"],
useMultipleWarehouses: json["use_multiple_warehouses"],
manageInventoryMethodId: json["manage_inventory_method_id"],
stockQuantity: json["stock_quantity"],
stockAvailability: json["stock_availability"],
stockAvailabilityn: json["stock_availabilityn"],
displayStockAvailability: json["display_stock_availability"],
displayStockQuantity: json["display_stock_quantity"],
minStockQuantity: json["min_stock_quantity"],
notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"],
allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"],
orderMinimumQuantity: json["order_minimum_quantity"],
orderMaximumQuantity: json["order_maximum_quantity"],
allowedQuantities: json["allowed_quantities"],
allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"],
disableBuyButton: json["disable_buy_button"],
disableWishlistButton: json["disable_wishlist_button"],
availableForPreOrder: json["available_for_pre_order"],
preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"],
callForPrice: json["call_for_price"],
price: json["price"].toDouble(),
oldPrice: json["old_price"],
productCost: json["product_cost"].toDouble(),
specialPrice: json["special_price"],
specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"],
specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"],
customerEntersPrice: json["customer_enters_price"],
minimumCustomerEnteredPrice: json["minimum_customer_entered_price"],
maximumCustomerEnteredPrice: json["maximum_customer_entered_price"],
basepriceEnabled: json["baseprice_enabled"],
basepriceAmount: json["baseprice_amount"],
basepriceBaseAmount: json["baseprice_base_amount"],
hasTierPrices: json["has_tier_prices"],
hasDiscountsApplied: json["has_discounts_applied"],
discountName: json["discount_name"],
discountNamen: json["discount_namen"],
discountDescription: json["discount_description"],
discountDescriptionn: json["discount_Descriptionn"],
discountPercentage: json["discount_percentage"],
currency: json["currency"],
currencyn: json["currencyn"],
weight: json["weight"].toDouble(),
length: json["length"],
width: json["width"],
height: json["height"],
availableStartDateTimeUtc: json["available_start_date_time_utc"],
availableEndDateTimeUtc: json["available_end_date_time_utc"],
displayOrder: json["display_order"],
published: json["published"],
deleted: json["deleted"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
updatedOnUtc: DateTime.parse(json["updated_on_utc"]),
productType: json["product_type"],
parentGroupedProductId: json["parent_grouped_product_id"],
roleIds: List<dynamic>.from(json["role_ids"].map((x) => x)),
discountIds: List<dynamic>.from(json["discount_ids"].map((x) => x)),
storeIds: List<dynamic>.from(json["store_ids"].map((x) => x)),
manufacturerIds: List<int>.from(json["manufacturer_ids"].map((x) => x)),
reviews: List<dynamic>.from(json["reviews"].map((x) => x)),
images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))),
attributes: List<dynamic>.from(json["attributes"].map((x) => x)),
specifications: List<Specification>.from(json["specifications"].map((x) => Specification.fromJson(x))),
associatedProductIds: List<dynamic>.from(json["associated_product_ids"].map((x) => x)),
tags: List<dynamic>.from(json["tags"].map((x) => x)),
vendorId: json["vendor_id"],
seName: json["se_name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"visible_individually": visibleIndividually,
"name": name,
"namen": namen,
"localized_names": List<dynamic>.from(localizedNames.map((x) => x.toJson())),
"short_description": shortDescription,
"short_descriptionn": shortDescriptionn,
"full_description": fullDescription,
"full_descriptionn": fullDescriptionn,
"markas_new": markasNew,
"show_on_home_page": showOnHomePage,
"meta_keywords": metaKeywords == null ? null : metaKeywords,
"meta_description": metaDescription == null ? null : metaDescription,
"meta_title": metaTitle == null ? null : metaTitle,
"allow_customer_reviews": allowCustomerReviews,
"approved_rating_sum": approvedRatingSum,
"not_approved_rating_sum": notApprovedRatingSum,
"approved_total_reviews": approvedTotalReviews,
"not_approved_total_reviews": notApprovedTotalReviews,
"sku": sku,
"is_rx": isRx,
"prescription_required": prescriptionRequired,
"rx_message": rxMessage,
"rx_messagen": rxMessagen,
"manufacturer_part_number": manufacturerPartNumber,
"gtin": gtin,
"is_gift_card": isGiftCard,
"require_other_products": requireOtherProducts,
"automatically_add_required_products": automaticallyAddRequiredProducts,
"is_download": isDownload,
"unlimited_downloads": unlimitedDownloads,
"max_number_of_downloads": maxNumberOfDownloads,
"download_expiration_days": downloadExpirationDays,
"has_sample_download": hasSampleDownload,
"has_user_agreement": hasUserAgreement,
"is_recurring": isRecurring,
"recurring_cycle_length": recurringCycleLength,
"recurring_total_cycles": recurringTotalCycles,
"is_rental": isRental,
"rental_price_length": rentalPriceLength,
"is_ship_enabled": isShipEnabled,
"is_free_shipping": isFreeShipping,
"ship_separately": shipSeparately,
"additional_shipping_charge": additionalShippingCharge,
"is_tax_exempt": isTaxExempt,
"is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices,
"use_multiple_warehouses": useMultipleWarehouses,
"manage_inventory_method_id": manageInventoryMethodId,
"stock_quantity": stockQuantity,
"stock_availability": stockAvailability,
"stock_availabilityn": stockAvailabilityn,
"display_stock_availability": displayStockAvailability,
"display_stock_quantity": displayStockQuantity,
"min_stock_quantity": minStockQuantity,
"notify_admin_for_quantity_below": notifyAdminForQuantityBelow,
"allow_back_in_stock_subscriptions": allowBackInStockSubscriptions,
"order_minimum_quantity": orderMinimumQuantity,
"order_maximum_quantity": orderMaximumQuantity,
"allowed_quantities": allowedQuantities,
"allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations,
"disable_buy_button": disableBuyButton,
"disable_wishlist_button": disableWishlistButton,
"available_for_pre_order": availableForPreOrder,
"pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc,
"call_for_price": callForPrice,
"price": price,
"old_price": oldPrice,
"product_cost": productCost,
"special_price": specialPrice,
"special_price_start_date_time_utc": specialPriceStartDateTimeUtc,
"special_price_end_date_time_utc": specialPriceEndDateTimeUtc,
"customer_enters_price": customerEntersPrice,
"minimum_customer_entered_price": minimumCustomerEnteredPrice,
"maximum_customer_entered_price": maximumCustomerEnteredPrice,
"baseprice_enabled": basepriceEnabled,
"baseprice_amount": basepriceAmount,
"baseprice_base_amount": basepriceBaseAmount,
"has_tier_prices": hasTierPrices,
"has_discounts_applied": hasDiscountsApplied,
"discount_name": discountName,
"discount_namen": discountNamen,
"discount_description": discountDescription,
"discount_Descriptionn": discountDescriptionn,
"discount_percentage": discountPercentage,
"currency": currency,
"currencyn": currencyn,
"weight": weight,
"length": length,
"width": width,
"height": height,
"available_start_date_time_utc": availableStartDateTimeUtc,
"available_end_date_time_utc": availableEndDateTimeUtc,
"display_order": displayOrder,
"published": published,
"deleted": deleted,
"created_on_utc": createdOnUtc.toIso8601String(),
"updated_on_utc": updatedOnUtc.toIso8601String(),
"product_type": productType,
"parent_grouped_product_id": parentGroupedProductId,
"role_ids": List<dynamic>.from(roleIds.map((x) => x)),
"discount_ids": List<dynamic>.from(discountIds.map((x) => x)),
"store_ids": List<dynamic>.from(storeIds.map((x) => x)),
"manufacturer_ids": List<dynamic>.from(manufacturerIds.map((x) => x)),
"reviews": List<dynamic>.from(reviews.map((x) => x)),
"images": List<dynamic>.from(images.map((x) => x.toJson())),
"attributes": List<dynamic>.from(attributes.map((x) => x)),
"specifications": List<dynamic>.from(specifications.map((x) => x.toJson())),
"associated_product_ids": List<dynamic>.from(associatedProductIds.map((x) => x)),
"tags": List<dynamic>.from(tags.map((x) => x)),
"vendor_id": vendorId,
"se_name": seName,
};
}
class Image {
Image({
this.id,
this.position,
this.src,
this.thumb,
this.attachment,
});
int id;
int position;
String src;
String thumb;
String attachment;
factory Image.fromJson(Map<String, dynamic> json) => Image(
id: json["id"],
position: json["position"],
src: json["src"],
thumb: json["thumb"],
attachment: json["attachment"],
);
Map<String, dynamic> toJson() => {
"id": id,
"position": position,
"src": src,
"thumb": thumb,
"attachment": attachment,
};
}
class LocalizedName {
LocalizedName({
this.languageId,
this.localizedName,
});
int languageId;
String localizedName;
factory LocalizedName.fromJson(Map<String, dynamic> json) => LocalizedName(
languageId: json["language_id"],
localizedName: json["localized_name"],
);
Map<String, dynamic> toJson() => {
"language_id": languageId,
"localized_name": localizedName,
};
}
class Specification {
Specification({
this.id,
this.displayOrder,
this.defaultValue,
this.defaultValuen,
this.name,
this.nameN,
});
int id;
int displayOrder;
String defaultValue;
String defaultValuen;
String name;
String nameN;
factory Specification.fromJson(Map<String, dynamic> json) => Specification(
id: json["id"],
displayOrder: json["display_order"],
defaultValue: json["default_value"],
defaultValuen: json["default_valuen"],
name: json["name"],
nameN: json["nameN"],
);
Map<String, dynamic> toJson() => {
"id": id,
"display_order": displayOrder,
"default_value": defaultValue,
"default_valuen": defaultValuen,
"name": name,
"nameN": nameN,
};
}
class EnumValues<T> {
Map<String, T> map;
Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => new MapEntry(v, k));
}
return reverseMap;
}
}

@ -40,7 +40,7 @@ class Brand {
dynamic metaDescription;
dynamic metaTitle;
int pageSize;
PageSizeOptions pageSizeOptions;
String pageSizeOptions;
dynamic priceRanges;
bool published;
bool deleted;
@ -60,7 +60,7 @@ class Brand {
metaDescription: json["meta_description"],
metaTitle: json["meta_title"],
pageSize: json["page_size"],
pageSizeOptions: pageSizeOptionsValues.map[json["page_size_options"]],
pageSizeOptions: json["page_size_options"],
priceRanges: json["price_ranges"],
published: json["published"],
deleted: json["deleted"],
@ -81,7 +81,7 @@ class Brand {
"meta_description": metaDescription,
"meta_title": metaTitle,
"page_size": pageSize,
"page_size_options": pageSizeOptionsValues.reverse[pageSizeOptions],
"page_size_options": pageSizeOptions,
"price_ranges": priceRanges,
"published": published,
"deleted": deleted,
@ -135,23 +135,3 @@ class LocalizedName {
"localized_name": localizedName,
};
}
enum PageSizeOptions { THE_2460100 }
final pageSizeOptionsValues = EnumValues({
"24, 60, 100": PageSizeOptions.THE_2460100
});
class EnumValues<T> {
Map<String, T> map;
Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
if (reverseMap == null) {
reverseMap = map.map((k, v) => new MapEntry(v, k));
}
return reverseMap;
}
}

@ -0,0 +1,61 @@
// To parse this JSON data, do
//
// final specificationModel = specificationModelFromJson(jsonString);
import 'dart:convert';
SpecificationModel specificationModelFromJson(String str) => SpecificationModel.fromJson(json.decode(str));
String specificationModelToJson(SpecificationModel data) => json.encode(data.toJson());
class SpecificationModel {
SpecificationModel({
this.specification,
});
List<Specification> specification;
factory SpecificationModel.fromJson(Map<String, dynamic> json) => SpecificationModel(
specification: List<Specification>.from(json["specification"].map((x) => Specification.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"specification": List<dynamic>.from(specification.map((x) => x.toJson())),
};
}
class Specification {
Specification({
this.id,
this.displayOrder,
this.defaultValue,
this.defaultValuen,
this.name,
this.nameN,
});
int id;
int displayOrder;
String defaultValue;
String defaultValuen;
String name;
String nameN;
factory Specification.fromJson(Map<String, dynamic> json) => Specification(
id: json["id"],
displayOrder: json["display_order"],
defaultValue: json["default_value"],
defaultValuen: json["default_valuen"],
name: json["name"],
nameN: json["nameN"],
);
Map<String, dynamic> toJson() => {
"id": id,
"display_order": displayOrder,
"default_value": defaultValue,
"default_valuen": defaultValuen,
"name": name,
"nameN": nameN,
};
}

@ -34,7 +34,7 @@ class TopBrand {
String name;
String namen;
List<LocalizedName> localizedNames;
dynamic description;
String description;
int manufacturerTemplateId;
String metaKeywords;
dynamic metaDescription;
@ -54,7 +54,7 @@ class TopBrand {
name: json["name"],
namen: json["namen"],
localizedNames: List<LocalizedName>.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))),
description: json["description"],
description: json["description"] == null ? null : json["description"],
manufacturerTemplateId: json["manufacturer_template_id"],
metaKeywords: json["meta_keywords"],
metaDescription: json["meta_description"],
@ -67,7 +67,7 @@ class TopBrand {
displayOrder: json["display_order"],
createdOnUtc: DateTime.parse(json["created_on_utc"]),
updatedOnUtc: DateTime.parse(json["updated_on_utc"]),
image: Image.fromJson(json["image"]),
image: json["image"] == null ? null : Image.fromJson(json["image"]),
);
Map<String, dynamic> toJson() => {
@ -75,7 +75,7 @@ class TopBrand {
"name": name,
"namen": namen,
"localized_names": List<dynamic>.from(localizedNames.map((x) => x.toJson())),
"description": description,
"description": description == null ? null : description,
"manufacturer_template_id": manufacturerTemplateId,
"meta_keywords": metaKeywords,
"meta_description": metaDescription,
@ -88,7 +88,7 @@ class TopBrand {
"display_order": displayOrder,
"created_on_utc": createdOnUtc.toIso8601String(),
"updated_on_utc": updatedOnUtc.toIso8601String(),
"image": image.toJson(),
"image": image == null ? null : image.toJson(),
};
}

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import '../offers_categorise_page.dart';
@ -136,7 +137,8 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
children: [
PharmacyPage(),
PharmacyCategorisePage(),
OffersCategorisePage(),
// OffersCategorisePage(),
WishlistPage(),
PharmacyProfilePage(),
// Container(
// child: Text('text'),

@ -1,12 +1,21 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart';
import 'package:flutter/material.dart';
AppSharedPreferences sharedPref = AppSharedPreferences();
var languageID;
class ProductCheckTypeWidget extends StatelessWidget {
final List<dynamic> wishlist;
final bool isTrue;
ProductCheckTypeWidget(this.isTrue, this.wishlist);
void initState() {
getLanguageID();
}
@override
Widget build(BuildContext context) {
return isTrue
@ -18,15 +27,16 @@ class ProductCheckTypeWidget extends StatelessWidget {
Container(
child: isTrue
? productTile(
productName: wishlist[index].product.name,
productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name,
productPrice: wishlist[index].subtotal,
productRate:
double.parse(wishlist[index].subtotalVatRate),
productImage: wishlist[index].product.images[0].src,
showLine: isTrue,
productID: wishlist[index].product.id,
)
: productTile(
productName: wishlist[index].product.name,
productName: languageID == 'ar' ? wishlist[index].product.namen : wishlist[index].product.name,
productPrice: wishlist[index].subtotal,
productRate:
double.parse(wishlist[index].subtotalVatRate),
@ -53,3 +63,8 @@ class ProductCheckTypeWidget extends StatelessWidget {
);
}
}
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}

@ -0,0 +1,36 @@
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
class CompareList with ChangeNotifier {
List<PharmacyProduct> _product = [];
List<PharmacyProduct> get productListItems => _product;
void addItem(data) {
if (_product.length == 0) {
_product.add(data);
AppToast.showSuccessToast(message: 'You have added a product to the Compare list');
} else {
for (int i = 0; i < _product.length; i++) {
if (_product.length <= 4 && _product[i].id != data.id) {
_product.add(data);
AppToast.showSuccessToast(message: 'You have added a product to the Compare list');
break;
} else if(_product[i].id == data.id){
AppToast.showErrorToast(message: 'the item is already in the list');
} else if(_product.length == 4){
AppToast.showErrorToast(message: 'your compare list is full');
}
}
}
notifyListeners();
}
void deleteItem(data) {
for (int i = 0; i < _product.length; i++) {
if (_product[i].id == data) _product.remove(_product[i]);
}
notifyListeners();
}
}

@ -2,6 +2,11 @@ import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:provider/provider.dart';
int counter = 0;
void main() => runApp(ComparePage());
@ -10,6 +15,7 @@ class ComparePage extends StatefulWidget {
_ComparePageState createState() => _ComparePageState();
}
//CompareList compareItems = CompareList();
class _ComparePageState extends State<ComparePage> {
@override
Widget build(BuildContext context) {
@ -24,574 +30,301 @@ class _ComparePageState extends State<ComparePage> {
}
}
compareList() {
return CarouselSlider(
options: CarouselOptions(
height: 800.0, viewportFraction: 0.95, enableInfiniteScroll: false),
items: [1, 2].map((i) {
return Builder(
builder: (BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10.0),
child: slideDetail(),
),
);
},
);
}).toList(),
);
}
slideDetail() {
return ListView(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 800,
width: 150,
margin: EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(width: 0.5, color: Colors.grey),
left: BorderSide(width: 0.5, color: Colors.grey),
right: BorderSide(width: 0.5, color: Colors.grey),
bottom: BorderSide(width: 0.5, color: Colors.grey),
),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(8.0),
class compareList extends StatelessWidget {
@override
Widget build(BuildContext context) {
final productItemData = Provider.of<CompareList>(context);
final productItem = productItemData.productListItems;
return productItem.length == 0
? Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Align(
alignment: Alignment.topRight,
child: Icon(FontAwesomeIcons.trashAlt, size: 15)),
),
SizedBox(height: 20,),
Image(
image: AssetImage(
'assets/images/al-habib_onlne_pharmacy_bg.png'),
fit: BoxFit.cover,
width: 100,
height: 60,
),
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: TextSpan(
text: 'SAR 999.99',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'ENAD test',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 8.0),
)
],
),
),
)
: CarouselSlider(
options: CarouselOptions(
height: 800.0,
viewportFraction: 0.87,
enableInfiniteScroll: false),
items: productItem.map((i) {
return Builder(
builder: (BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Container(
height: 1.0,
width: 300.0,
color:Colors.grey,),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10.0),
child: productItem.length != 0
? slideDetail(productItem)
: Container(),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
);
},
);
}).toList(),
);
}
}
class slideDetail extends StatefulWidget {
final List<PharmacyProduct> data;
slideDetail(this.data);
@override
_slideDetailState createState() => _slideDetailState();
}
class _slideDetailState extends State<slideDetail> {
@override
Widget build(BuildContext context) {
return ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: widget.data.length,
itemBuilder: (BuildContext contx, int index) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 550,
width: 150,
margin: EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(width: 0.5, color: Colors.grey),
left: BorderSide(width: 0.5, color: Colors.grey),
right: BorderSide(width: 0.5, color: Colors.grey),
bottom: BorderSide(width: 0.5, color: Colors.grey),
),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Container(
child: Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(FontAwesomeIcons.trashAlt, size: 15),
onPressed: () {
setState(() {
Provider.of<CompareList>(context, listen: false)
.deleteItem(widget.data[index].id);
});
},
),
),
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
SizedBox(
height: 20,
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
Image.network(
widget.data[index].images[0].src.trim(),
fit: BoxFit.cover,
width: 100,
height: 60,
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
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: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].price.toString(),
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
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(
height: 800,
width: 150,
margin: EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(width: 0.5, color: Colors.grey),
left: BorderSide(width: 0.5, color: Colors.grey),
right: BorderSide(width: 0.5, color: Colors.grey),
bottom: BorderSide(width: 0.5, color: Colors.grey),
),
color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Container(
child: Align(
alignment: Alignment.topRight,
child: Icon(FontAwesomeIcons.trashAlt, size: 15)),
),
SizedBox(height: 20,),
Image(
image: AssetImage(
'assets/images/al-habib_onlne_pharmacy_bg.png'),
fit: BoxFit.cover,
width: 100,
height: 60,
),
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: TextSpan(
text: 'SAR 999.99',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
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: TextSpan(
text:
'ENAD test',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[0].name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[1].name,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
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,
),
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[2].name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[3].name,
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
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: TextSpan(
text:
'Each',
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[4].name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
),
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: TextSpan(
text: 'Primary Unit Of Measure',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications[5].name,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'Each',
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,
),
),
),
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Container(
height: 1.0,
width: 300.0,
color:Colors.grey,),
),
],
],
),
),
),
),
],
),
],
);
],
);
},
);
}
}
String returnString(data) {
for (int i = 0; i < data.length; i++) {
print(data[i]);
// if(data[i] == null){
// if(counter == i){
//
// }
// }
}
return "ENAD HILAL";
}

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
void main() => runApp(MyReviewsPage());
@ -11,7 +12,13 @@ class MyReviewsPage extends StatefulWidget {
_MyReviewsPageState createState() => _MyReviewsPageState();
}
var languageID;
class _MyReviewsPageState extends State<MyReviewsPage> {
void initState() {
getLanguageID();
}
@override
Widget build(BuildContext context) {
return BaseView<ReviewViewModel>(
@ -20,25 +27,53 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
appBarTitle: 'Wishlist page',
isShowAppBar: true,
isPharmacy: true,
body: Container(
child: ListView.builder(
itemCount: model.reviewListList.length,
itemBuilder: (BuildContext context, int index) {
return Column(
children: [
Container(
child: reviewDetails(
model.reviewListList[index],
double.parse(model.reviewListList[index].product
.approvedTotalReviews.toString()),
double.parse(model.reviewListList[index].rating.toString()),
body: model.reviewListList.length == 0
? Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
),
Divider(height: 1, color: Colors.grey)
],
);
}),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
),
)
: Container(
child: ListView.builder(
itemCount: model.reviewListList.length,
itemBuilder: (BuildContext context, int index) {
return Column(
children: [
Container(
child: reviewDetails(
model.reviewListList[index],
double.parse(model.reviewListList[index].product
.approvedTotalReviews
.toString()),
double.parse(model.reviewListList[index].rating
.toString()),
),
),
Divider(height: 1, color: Colors.grey)
],
);
}),
),
),
);
}
@ -47,7 +82,7 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
reviewDetails(data, rate, myRate) {
return Container(
child: Padding(
padding: const EdgeInsets.only(bottom: 10.0),
padding: EdgeInsets.only(bottom: 10.0),
child: Container(
height: 200,
width: double.infinity,
@ -59,7 +94,9 @@ reviewDetails(data, rate, myRate) {
Row(
children: [
Container(
margin: EdgeInsets.only(top: 10, left: 10),
margin: languageID == 'ar'
? EdgeInsets.only(top: 10, right: 10)
: EdgeInsets.only(top: 10, left: 10),
child: Image.network(
data.product.images[0].src.trim(),
fit: BoxFit.cover,
@ -74,13 +111,17 @@ reviewDetails(data, rate, myRate) {
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
alignment: languageID == 'ar'
? Alignment.topRight
: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: data.product.name,
text: languageID == 'ar'
? data.product.namen
: data.product.name,
style: TextStyle(
color: Colors.black54,
fontSize: 13,
fontSize: languageID == 'ar' ? 7 : 13,
fontWeight: FontWeight.bold),
),
),
@ -91,7 +132,9 @@ reviewDetails(data, rate, myRate) {
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
alignment: languageID == 'ar'
? Alignment.topRight
: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: data.product.price.toString() +
@ -110,7 +153,9 @@ reviewDetails(data, rate, myRate) {
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
alignment: languageID == 'ar'
? Alignment.topRight
: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: rate,
size: 15.0,
@ -139,7 +184,9 @@ reviewDetails(data, rate, myRate) {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 10),
padding: languageID == 'ar'
? EdgeInsets.only(right: 10)
: EdgeInsets.only(left: 10),
child: Text(data.createdOnUtc.toString())),
],
),
@ -150,7 +197,9 @@ reviewDetails(data, rate, myRate) {
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
padding: EdgeInsets.only(left: 60),
padding: languageID == 'ar'
? EdgeInsets.only(right: 60)
: EdgeInsets.only(left: 60),
child: RatingBar.readOnly(
initialRating: myRate,
size: 15.0,
@ -173,7 +222,9 @@ reviewDetails(data, rate, myRate) {
),
Expanded(
child: Container(
padding: EdgeInsets.only(left: 10),
padding: languageID == 'ar'
? EdgeInsets.only(right: 10)
: EdgeInsets.only(left: 10),
child: Text(fixingString(data.reviewText.toString())),
),
),
@ -184,7 +235,7 @@ reviewDetails(data, rate, myRate) {
);
}
fixingString(txt){
fixingString(txt) {
String stringTxt;
String newTxt;
stringTxt = txt.toString();
@ -192,3 +243,7 @@ fixingString(txt){
return newTxt;
}
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}

@ -1,7 +1,14 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/pages/login/register-info.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart';
import 'package:diplomaticquarterapp/pages/search_products_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
void main() => runApp(ProductBrandsPage());
@ -10,26 +17,43 @@ class ProductBrandsPage extends StatefulWidget {
_ProductBrandsPageState createState() => _ProductBrandsPageState();
}
var languageID;
class _ProductBrandsPageState extends State<ProductBrandsPage> {
void initState() {
getLanguageID();
}
@override
Widget build(BuildContext context) {
return BaseView<BrandsViewModel>(
onModelReady: (model) => model.getTopBrandsData(),
onModelReady: (model) => model.getBrandsData(),
builder: (_, model, wi) => AppScaffold(
appBarTitle: 'Brands page',
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
body: Container(
child: Column(
children: [
Container(
color: Colors.white,
alignment: Alignment.topLeft,
padding: EdgeInsets.only(left: 10.0, top: 10.0),
alignment: languageID == 'ar'?
Alignment.topRight :
Alignment.topLeft,
padding: languageID == 'ar' ?
EdgeInsets.only(
right: 10.0,
top: 10.0
):
EdgeInsets.only(
left: 10.0,
top: 10.0
),
child: Text(
'Top Brands',
TranslationBase.of(context).topBrands,
style: TextStyle(
fontWeight: FontWeight.bold
fontWeight: FontWeight.bold,
),
),
),
@ -43,13 +67,35 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 10,
),
Container(
height: 100,
width: double.infinity,
color: Colors.white,
child: IconButton(
icon: Icon(Icons.search),
onPressed: () {
showSearch(context: context, delegate: SearchBar());
height: MediaQuery.of(context).size.height * 0.056,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: Colors.white,
),
child: InkWell(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Row(
//crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.search, size: 25.0),
SizedBox(
width: 15.0,
),
Texts(
TranslationBase.of(context).searchProductHere,
fontSize: 13,
)
],
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SearchBrandsPage()),
);
},
),
),
@ -57,25 +103,30 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 10,
),
Container(
height: 280,
height: 230,
width: double.infinity,
color: Colors.white,
child: ListView.builder(
itemCount: model.brandsListList.length,
itemBuilder: (BuildContext ctxt, int index) {
return Container(
margin: EdgeInsets.only(top: 50, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(model.brandsListList[index].name),
SizedBox(
height: 3,
),
Divider(height: 1, color: Colors.grey)
],
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Container(
margin: EdgeInsets.only(top: 50, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
languageID == 'ar' ? Text(model.brandsListList[index].namen):Text(model.brandsListList[index].name),
SizedBox(
height: 3,
),
Divider(height: 1, color: Colors.grey)
],
),
),
onTap: (){
print("ENAD");
},
);
}),
),
@ -87,96 +138,6 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
}
}
//topBrand() {
// return BaseView<BrandsViewModel>(
// onModelReady: (model) => model.getBrandsData(),
// builder: (_, model, wi) => Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Container(
// padding: EdgeInsets.all(10),
// child: Text(
// 'Top Brands',
// ),
// ),
// Row(
// children: [
// Container(
// margin: EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 0.0),
// child: Container(
// margin: EdgeInsets.only(bottom: 10.0),
// child: Container(
// margin: EdgeInsets.only(bottom: 10.0),
// child: Container(
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 10.0, vertical: 10.0),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// border: Border(
// top: BorderSide(width: 1.0, color: Colors.grey),
// left: BorderSide(width: 1.0, color: Colors.grey),
// right: BorderSide(width: 1.0, color: Colors.grey),
// bottom: BorderSide(width: 1.0, color: Colors.grey),
// ),
// color: Colors.white,
// ),
// child: Image(
// image: AssetImage(
// 'assets/images/al-habib_onlne_pharmacy_bg.png'),
// fit: BoxFit.cover,
// width: 60,
// height: 40,
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// Row(
// children: [
// Container(
// margin: EdgeInsets.fromLTRB(10.0, 10.0, 0.0, 0.0),
// child: Container(
// margin: EdgeInsets.only(bottom: 10.0),
// child: Container(
// margin: EdgeInsets.only(bottom: 10.0),
// child: Container(
// padding: EdgeInsets.only(left: 5),
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 10.0, vertical: 10.0),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// border: Border(
// top: BorderSide(width: 1.0, color: Colors.grey),
// left: BorderSide(width: 1.0, color: Colors.grey),
// right: BorderSide(width: 1.0, color: Colors.grey),
// bottom: BorderSide(width: 1.0, color: Colors.grey),
// ),
// color: Colors.white,
// ),
// child: Image(
// image: AssetImage(
// 'assets/images/al-habib_onlne_pharmacy_bg.png'),
// fit: BoxFit.cover,
// width: 60,
// height: 40,
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// );
//}
topBrand() {
return BaseView<BrandsViewModel>(
@ -187,35 +148,40 @@ topBrand() {
model.topBrandsListList.length,
(index) => Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0),
InkWell(
child: Container(
margin: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 0.0),
child: Container(
child: Container(
// padding: EdgeInsets.only(left: 5),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10.0, vertical: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(width: 1.0, color: Colors.grey),
left: BorderSide(width: 1.0, color: Colors.grey),
right: BorderSide(width: 1.0, color: Colors.grey),
bottom: BorderSide(width: 1.0, color: Colors.grey),
// padding: EdgeInsets.only(left: 5),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 10.0, vertical: 10.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(width: 1.0, color: Colors.grey),
left: BorderSide(width: 1.0, color: Colors.grey),
right: BorderSide(width: 1.0, color: Colors.grey),
bottom: BorderSide(width: 1.0, color: Colors.grey),
),
color: Colors.white,
),
color: Colors.white,
),
child: Image.network(
model.topBrandsListList[index].image.src.trim(),
fit: BoxFit.cover,
width: 60,
height: 40,
child: model.topBrandsListList[index].image != null ?Image.network(
model.topBrandsListList[index].image.src,
fit: BoxFit.cover,
width: 60,
height: 40,
): Text(model.topBrandsListList[index].name)
),
),
),
),
),
onTap: (){
print("ENAD");
},
),
],
),
@ -282,3 +248,7 @@ class SearchBar extends SearchDelegate<String> {
);
}
}
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}

File diff suppressed because it is too large Load Diff

@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'lacum-activitaion-vida-page.dart';
@ -53,7 +54,9 @@ class PharmacyPage extends StatelessWidget {
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () {},
handler: () =>{
Navigator.push(context,FadePage(page: ProductBrandsPage())),
},
),
],
),

@ -0,0 +1,145 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
class SearchBrandsPage extends StatefulWidget {
@override
_SearchBrandsPageState createState() => _SearchBrandsPageState();
}
class _SearchBrandsPageState extends State<SearchBrandsPage> {
final textController = TextEditingController();
final _formKey = GlobalKey<FormState>();
String msg = '';
@override
Widget build(BuildContext context) {
return BaseView<BrandsViewModel>(
onModelReady: (model) => model.searchProducts(),
builder: (BuildContext context, model, Widget child) =>
PharmacyAppScaffold(
appBarTitle: 'Search',
isBottomBar: false,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
//baseViewModel: model,
body: SingleChildScrollView(
child: Container(
height: SizeConfig.screenHeight,
child: Column(
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.79,
child: Form(
key: _formKey,
child: TextFields(
autoFocus: true,
hintText: 'Search',
fontSize: 19.0,
prefixIcon: Icon(Icons.search),
inputAction: TextInputAction.search,
onSaved: (value) {
//searchMedicine(model, context);
},
onSubmit: (value) {
searchMedicine(model, context);
msg = 'No Result Found';
},
controller: textController,
validator: (value) {
if (value.isEmpty) {
return 'please Enter Product Name';
}
return null;
},
),
),
),
SizedBox(
width: 10.0,
),
InkWell(
child: Texts(
'Cancel',
fontSize: 17.0,
fontWeight: FontWeight.w500,
),
onTap: () {
Navigator.pop(context);
},
),
// child: Container(
// child: Button(
// backgroundColor: Colors.green,
// loading: model.state == ViewState.BusyLocal,
// label: 'Search',
// onTap: () {
// searchMedicine(model, context);
// }),
// width: MediaQuery.of(context).size.width * 0.09,
// ),
],
),
),
model.searchList.length == 0
? Container(
child: Text(
'no data' + model.searchList.length.toString()),
)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.searchList.length,
itemBuilder: (BuildContext ctx, index) {
return Padding(
padding:EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text(
model.searchList[index].name,
style: TextStyle(fontSize: 20),
),
),
),
Divider(height: 1, color: Colors.grey)
],),
);
},
),
),
),
],
),
),
),
),
);
}
searchMedicine(model, BuildContext context) {
Utils.hideKeyboard(context);
if (_formKey.currentState.validate())
model.searchProducts(productName: textController.text);
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -17,7 +18,7 @@ class ProductTileItem extends StatelessWidget {
void productOnClick(BuildContext ctx) {
_saveLastVisitProducts();
Navigator.push(ctx, FadePage(page: ProductDetailScreen(item)));
Navigator.push(ctx, FadePage(page: ProductDetailPage(item)));
}
void _saveLastVisitProducts() async {

@ -4,11 +4,9 @@ import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dar
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
void main() => runApp(WishlistPage());
class WishlistPage extends StatefulWidget {
@override
_WishlistPageState createState() => _WishlistPageState();
}
@ -23,50 +21,48 @@ class _WishlistPageState extends State<WishlistPage> {
appBarTitle: 'Wishlist page',
isShowAppBar: true,
isPharmacy: true,
body: Container(
// child: ListView.builder(
// itemCount: 3,
// itemBuilder: (BuildContext context, int index) {
// return Column(
// children: [
// Container(
// child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00,),
// ),
// Divider(height: 1, color: Colors.grey)
// ],
// );
// }),
child: Column(
children: [
// Expanded(
// flex: 1,
// child: Container(
// color: Colors.white,
// width: double.infinity,
// height: 30,
// child: IconButton(
// alignment: Alignment.topRight,
// icon: Icon(Icons.art_track),
// color: Colors.blueAccent,
// onPressed: () {
// setState(() {
// isTrue = !isTrue;
// });
// },
// ),
// ),
// ),
Expanded(
flex: 20,
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.85, //250,
child: ProductCheckTypeWidget(isTrue, model.wishListList),
body: model.wishListList.length == 0
? Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
),
)
: Container(
child: Column(
children: [
Expanded(
flex: 20,
child: Container(
width: double.infinity,
height:
MediaQuery.of(context).size.height * 0.85, //250,
child:
ProductCheckTypeWidget(isTrue, model.wishListList),
),
),
],
),
),
),
],
),
),
),
);
}

@ -15,7 +15,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart';
class PharmacyProfilePage extends StatefulWidget {
@override
@ -24,44 +25,51 @@ class PharmacyProfilePage extends StatefulWidget {
class _ProfilePageState extends State<PharmacyProfilePage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
String customerId="";
String page_id="";
String customerId = "";
String page_id = "";
@override
Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>(
onModelReady: (model) => model.getOrder(customerId, page_id),
builder: (_,model, wi )=> AppScaffold(
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true,
isPharmacy:true ,
isPharmacy: true,
body: Container(
child:SingleChildScrollView(
child: SingleChildScrollView(
child: Column(
children:<Widget>[
children: <Widget>[
Container(
child:Row(
children:<Widget> [
child: Row(
children: <Widget>[
Container(
padding:EdgeInsets.only(top:20.0, left:10.0, right:10.0, bottom:10.0,),
child: LargeAvatar(name: "profile", url:'' ,),
padding: EdgeInsets.only(
top: 20.0,
left: 10.0,
right: 10.0,
bottom: 10.0,
),
child: LargeAvatar(
name: "profile",
url: '',
),
),
Container(
child: Column(
children: [
Text(
TranslationBase.of(context).welcome,
style: TextStyle(fontSize: 14.0,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color:Colors.grey
),
color: Colors.grey),
),
Text("Name",
Text(
"Name",
// model.order[0].customer.firstName.toString(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
fontSize: 16.0, fontWeight: FontWeight.bold),
),
],
),
@ -80,100 +88,118 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
height: 15,
),
Container(
child:Row(
children:<Widget> [
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderPage()));
},
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
child: Row(
children: <Widget>[
Expanded(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrderPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/orders_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).orders,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).lakum,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold
),
),
],
),
),
),
),
Expanded(
child: InkWell(
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/lakum_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).lakum,
style: TextStyle(
fontSize: 13.0, fontWeight: FontWeight.bold),
),
],
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => WishlistPage()));
},
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WishlistPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/wishlist_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).wishlist,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
Expanded(
child: InkWell(
child: Column(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(fontSize: 13.0,
fontWeight: FontWeight.bold,),
),
],
),
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MyReviewsPage()));
},
child: Column(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/review_icon.svg',
width: 50,
height: 50,
),
SizedBox(
height: 5,
),
Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
],
),
],
)
),
),
),
],
)),
SizedBox(
height: 15,
),
@ -191,13 +217,11 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
children: <Widget>[
Text(
TranslationBase.of(context).myAccount,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
fontSize: 16.0, fontWeight: FontWeight.bold),
),
SizedBox(
height: 10,
@ -206,29 +230,35 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,),
SizedBox(
width: 15,
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePrescriptionsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_prescription_icon.svg',
width: 28,
height: 28,
),
SizedBox(
width: 15,
),
Text(
TranslationBase.of(context).myPrescription,
style: TextStyle(
fontSize: 13.0,
),
Text(TranslationBase.of(context).myPrescription,
style: TextStyle(fontSize: 13.0,
),
),
],
),
),
),
],
),
),
SizedBox(
height: 5,
height: 5,
),
Divider(
color: Colors.grey,
@ -236,20 +266,25 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ComparePage()));
},
child: Row(
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/compare.png',
width: 28,
height: 28,),
height: 28,
),
SizedBox(
width: 15,
),
Text(TranslationBase.of(context).compare,
style: TextStyle(fontSize: 13.0,
Text(
TranslationBase.of(context).compare,
style: TextStyle(
fontSize: 13.0,
),
),
],
@ -264,20 +299,26 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => HomePrescriptionsPage()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePrescriptionsPage()));
},
child: Row(
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/medication_refill_icon.svg',
width: 30,
height: 30,),
height: 30,
),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).medicationsRefill,
style: TextStyle(fontSize: 13.0,
Text(
TranslationBase.of(context).medicationsRefill,
style: TextStyle(
fontSize: 13.0,
),
),
],
@ -292,20 +333,25 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MyFamily()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MyFamily()));
},
child: Row(
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/my_family_icon.svg',
width: 20,
height: 20,),
height: 20,
),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).family,
style: TextStyle(fontSize: 13.0,
Text(
TranslationBase.of(context).family,
style: TextStyle(
fontSize: 13.0,
),
),
],
@ -320,20 +366,26 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => PharmacyAddressesPage()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PharmacyAddressesPage()));
},
child: Row(
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/shipping_addresses_icon.svg',
width: 30,
height: 30,),
height: 30,
),
SizedBox(
width: 20,
),
Text(TranslationBase.of(context).shippingAddresses,
style: TextStyle(fontSize: 13.0,
Text(
TranslationBase.of(context).shippingAddresses,
style: TextStyle(
fontSize: 13.0,
),
),
],
@ -359,13 +411,11 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
children: <Widget>[
Text(
TranslationBase.of(context).reachUs,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold
),
fontSize: 16.0, fontWeight: FontWeight.bold),
),
SizedBox(
height: 5,
@ -374,27 +424,30 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
color: Colors.grey,
height: 20,
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => LiveChatPage()));
},
child: Row(
children:<Widget> [
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
width: 20,
height: 20,),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
),
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LiveChatPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/contact_us_icon.svg',
width: 20,
height: 20,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).contactUs,
style: TextStyle(fontSize: 13.0),
),
],
),
),
SizedBox(
height: 5,
),
@ -404,20 +457,23 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => FindUsPage()));
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FindUsPage()));
},
child: Row(
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/our_locations_icon.svg',
width: 30,
height: 30,),
height: 30,
),
SizedBox(
width: 20,
),
Text(
TranslationBase.of(context).ourLocations,
TranslationBase.of(context).ourLocations,
style: TextStyle(fontSize: 13.0),
),
],
@ -432,8 +488,5 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
),
);
}}
}
}

@ -14,6 +14,13 @@ class BrandsService extends BaseService {
List<TopBrand> _topBrandsList = List();
List<TopBrand> get topBrandsList => _topBrandsList;
List<Brand> _searchList = List();
List<Brand> get searchList => _searchList;
clearSearchList() {
_searchList.clear();
}
Future getBrands() async {
hasError = false;
await baseAppClient.getPharmacy(GET_BRANDS,
@ -41,4 +48,26 @@ class BrandsService extends BaseService {
super.error = error;
});
}
Future searchProducts({String productName}) async {
RegExp exp = new RegExp(productName.toUpperCase());
hasError = false;
_searchList.clear();
await baseAppClient.getPharmacy(
GET_BRANDS,
onSuccess: (dynamic response, int statusCode) {
response['manufacturer'].forEach((item) {
if(exp.hasMatch(item['name'])){
_searchList.add(Brand.fromJson(item));
}else{
}
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
}

@ -1,11 +1,14 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
class ProductDetailService extends BaseService {
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isLogin = false;
List<ProductDetail> _productDetailList = List();
@ -14,10 +17,20 @@ class ProductDetailService extends BaseService {
List<LocationModel> _productLocationList = List();
List<LocationModel> get productLocationList => _productLocationList;
List<Wishlist> _addToCartModel = List();
List<Wishlist> get addToCartModel => _addToCartModel;
Future getProductReviews() async {
List<Wishlist> _wishListProducts = List();
List<Wishlist> get wishListProducts => _wishListProducts;
List<SpecificationModel> _productSpecification = List();
List<SpecificationModel> get productSpecification => _productSpecification;
Future getProductReviews(productID) async {
hasError = false;
await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+"1480?fields=reviews",
await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+productID+"?fields=reviews",
onSuccess: (dynamic response, int statusCode) {
_productDetailList.clear();
response['products'].forEach((item) {
@ -51,11 +64,115 @@ class ProductDetailService extends BaseService {
_productLocationList.clear();
response['PharmList'].forEach((item) {
_productLocationList.add(LocationModel.fromJson(item));
print(_productLocationList);
print(response);
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: request);
}
Future addToCart(quantity, itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
Map<String, dynamic> request;
request = {
"shopping_cart_item":
{
"quantity": quantity,
"shopping_cart_type": "1",
"product_id": itemID,
"customer_id": customerId,
"language_id": 1
}
};
await baseAppClient.post(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear();
response['shopping_carts'].forEach((item) {
_addToCartModel.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have added a product to the cart');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: 'something went wrong please try again');
}, body: request);
}
Future addToWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
Map<String, dynamic> request;
request = {
"shopping_cart_item":
{
"quantity": 1,
"shopping_cart_type": "Wishlist",
"product_id": itemID,
"customer_id": customerId,
"language_id": 1
}
};
await baseAppClient.post(GET_SHOPPING_CART,
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: 'something went wrong please try again');
}, body: request);
}
Future getWishlistItems() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
Future delteItemFromWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist",
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
Future productSpecificationData(itemID) async {
hasError = false;
await baseAppClient.getPharmacy(GET_SPECIFICATION+itemID,
onSuccess: (dynamic response, int statusCode) {
_productSpecification.clear();
response['specification'].forEach((item) {
_productSpecification.add(SpecificationModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
}
}

@ -1,19 +1,29 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/pharmacy/reviewModel.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
class ReviewService extends BaseService {
AppSharedPreferences sharedPref = AppSharedPreferences();
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
bool isLogin = false;
List<Review> _reviewList = List();
List<Review> get reviewList => _reviewList;
Future getReview() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(GET_REVIEW+"1367368",
await baseAppClient.getPharmacy(GET_REVIEW+customerId,
onSuccess: (dynamic response, int statusCode) {
_reviewList.clear();
response['reviews'].forEach((item) {

@ -55,8 +55,9 @@ class WishListService extends BaseService {
// }
Future getWishlist() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+"1367368?shopping_cart_type=2",
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {

@ -1063,6 +1063,18 @@ class TranslationBase {
localizedValues['processDoneSuccessfully'][locale.languageCode];
String get selectHomeHealthCareServices =>
localizedValues['selectHomeHealthCareServices'][locale.languageCode];
String get topBrands => localizedValues['topBrands'][locale.languageCode];
String get notifyMe => localizedValues['notifyMe'][locale.languageCode];
String get specification => localizedValues['specification'][locale.languageCode];
String get details => localizedValues['details'][locale.languageCode];
String get availability => localizedValues['availability'][locale.languageCode];
String get quantity => localizedValues['quantity'][locale.languageCode];
String get quantitySize => localizedValues['quantitySize'][locale.languageCode];
String get addToCart => localizedValues['addToCart'][locale.languageCode];
String get buyNow => localizedValues['buyNow'][locale.languageCode];
String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -0,0 +1,241 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
import 'floating_button_search.dart';
import '../progress_indicator/app_loader_widget.dart';
import 'arrow_back.dart';
import 'network_base_view.dart';
import 'not_auh_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
class DetailPageScafold extends StatefulWidget {
final String appBarTitle;
final Widget body;
final Widget bottomSheet;
final bool isLoading;
final bool isShowAppBar;
final bool hasAppBarParam;
final BaseViewModel baseViewModel;
final bool isBottomBar;
final Widget floatingActionButton;
final bool isPharmacy;
final String title;
final String description;
final String image;
final bool isShowDecPage;
final List<String> infoList;
final Color backgroundColor;
final double preferredSize;
final List<Widget> appBarIcons;
final PreferredSizeWidget appBarWidget;
DetailPageScafold(
{@required this.body,
this.appBarTitle = '',
this.isLoading = false,
this.isShowAppBar = false,
this.hasAppBarParam,
this.bottomSheet,
this.baseViewModel,
this.floatingActionButton,
this.isPharmacy = false,
this.title,
this.description,
this.isShowDecPage = true,
this.isBottomBar,
this.backgroundColor,
this.preferredSize = 0.0,
this.appBarIcons,
this.appBarWidget,
this.image,
this.infoList});
@override
_DetailPageScafoldState createState() => _DetailPageScafoldState();
}
class _DetailPageScafoldState extends State<DetailPageScafold> {
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
PreferredSizeWidget appBar;
if (this.widget.appBarWidget == null) {
PreferredSizeWidget appBarWidget = AppBarWidget(
widget.appBarTitle,
widget.appBarIcons,
widget.isShowAppBar,
isPharmacy: widget.isPharmacy,
isShowDecPage: widget.isShowDecPage,
image: widget.image,
);
appBar = widget.preferredSize == 0
? appBarWidget
: PreferredSize(
child: appBarWidget,
preferredSize: Size.fromHeight(widget.preferredSize));
} else {
appBar = this.widget.appBarWidget;
}
return Scaffold(
backgroundColor:
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: appBar,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
widget.isShowDecPage)
? NotAutPage(
title: widget.appBarTitle,
description: widget.description,
infoList: widget.infoList,
)
: widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(),
bottomSheet: widget.bottomSheet,
//floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
// floatingActionButton: FloatingSearchButton(),
);
}
buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[
widget.body, /*FloatingSearchButton()*/
]);
}
}
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
final String appBarTitle;
final List<Widget> appBarIcons;
final bool isShowAppBar;
final bool isPharmacy;
final bool isShowDecPage;
final String image;
AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar,
{this.isPharmacy = true, this.isShowDecPage = true, this.image});
@override
Widget build(BuildContext context) {
return buildAppBar(context);
}
Widget buildAppBar(BuildContext context) {
return isShowAppBar
? AppBar(
elevation: 0,
backgroundColor:Colors.white,
// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme(
headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
title: Texts(
authenticatedUserObject.isLogin || !isShowDecPage
? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,
color: Colors.white,
bold: true,
),
leading: Builder(
builder: (BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:()=> Navigator.pop(context),
child: Icon(Icons.arrow_back_ios, color: Colors.grey),
);
},
),
centerTitle: true,
actions: <Widget>[
isPharmacy
? IconButton(
icon: Icon(Icons.shopping_cart),
color: Colors.grey,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CartOrderPage()),
);
// Navigator.of(context)
// .popUntil(ModalRoute.withName('/'));
})
: Container(),
image != null
? InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: InsuranceUpdate(),
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
image,
height: SizeConfig.heightMultiplier * 5,
width: SizeConfig.heightMultiplier * 5,
color: Colors.grey,
),
),
)
: IconButton(
icon: Icon(FontAwesomeIcons.ellipsisV),
color: Colors.grey,
onPressed: () {
settingModalBottomSheet(context);
},
),
if (appBarIcons != null) ...appBarIcons
],
)
: Container(
height: 0,
width: 0,
);
}
@override
Size get preferredSize => Size(double.maxFinite, 60);
}

@ -1,3 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/style.dart';
@ -16,6 +18,7 @@ class productTile extends StatelessWidget {
final bool isOrderDetails;
final String productImage;
final bool showLine;
final dynamic productID;
productTile(
{this.productName,
@ -24,9 +27,11 @@ class productTile extends StatelessWidget {
this.qyt,
this.totalPrice,
this.productReviews,
this.isOrderDetails = true,
this.isOrderDetails = false,
this.productImage,
this.showLine = true});
this.showLine = true,
this.productID,
});
@override
Widget build(BuildContext context) {
@ -48,13 +53,6 @@ class productTile extends StatelessWidget {
width: 80,
height: 80,
),
// child: Image(
// image:
// AssetImage('assets/images/al-habib_onlne_pharmacy_bg.png'),
// fit: BoxFit.cover,
// width: 80,
// height: 80,
// ),
),
Expanded(
flex: 5,
@ -116,11 +114,32 @@ class productTile extends StatelessWidget {
flex: 1,
child: Column(
children: [
Icon(FontAwesomeIcons.trashAlt, size: 15),
IconButton(
icon: Icon(
FontAwesomeIcons.trashAlt,
size: 15
),
onPressed: (){
deleteFromWishlistFunction(productID);
},
),
SizedBox(
height: 50,
),
Icon(FontAwesomeIcons.shoppingCart, size: 15),
IconButton(
icon: Icon(
FontAwesomeIcons.shoppingCart,
size: 15
),
onPressed: () async{
await addToCartFunction(1, productID);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
},
),
],
),
)
@ -247,111 +266,22 @@ class productTile extends StatelessWidget {
],
),
)
: Container(
child: Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
Padding(
padding: EdgeInsets.only(left: 15),
child: Container(
width: 160,
height: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border(
top: BorderSide(
width: 0.5, color: Colors.grey),
left: BorderSide(
width: 0.5, color: Colors.grey),
right: BorderSide(
width: 0.5, color: Colors.grey),
bottom: BorderSide(
width: 0.5, color: Colors.grey),
),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 2,
),
Container(
child: Image.network(
productImage.trim(),
fit: BoxFit.cover,
width: 80,
height: 70,
),
),
SizedBox(
height: 10,
),
// Container(width: 150,height: 20,color: Colors.green,),
Container(
alignment: Alignment.centerLeft,
child: Column(
children: [
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: productName,
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: 'SAR $productPrice',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
),
),
),
Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.all(5),
child: Align(
child: RatingBar.readOnly(
initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
],
),
),
],
),
),
),
],
),
),
),
: Container(),
],
),
);
}
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.deletWishlistData(itemID);
}
addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID);
}
Loading…
Cancel
Save