Merge branch 'development' into development_new_design_2.0

# Conflicts:
#	lib/config/config.dart
#	lib/config/localized_values.dart
#	lib/core/service/client/base_app_client.dart
#	lib/core/service/parmacyModule/parmacy_module_service.dart
#	lib/core/service/parmacyModule/prescription_service.dart
#	lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart
#	lib/core/viewModels/pharmacyModule/product_detail_view_model.dart
#	lib/locator.dart
#	lib/main.dart
#	lib/pages/final_products_page.dart
#	lib/pages/landing/home_page.dart
#	lib/pages/parent_categorise_page.dart
#	lib/pages/pharmacies/product_detail.dart
#	lib/pages/pharmacies/screens/cart-order-preview.dart
#	lib/pages/pharmacies/screens/pharmacy_module_page.dart
#	lib/pages/pharmacies/widgets/ProductTileItem.dart
#	lib/pages/search_products_page.dart
#	lib/services/pharmacy_services/product_detail_service.dart
#	lib/uitl/translations_delegate_base.dart
#	lib/widgets/buttons/secondary_button.dart
#	lib/widgets/others/app_scaffold_widget.dart
#	lib/widgets/others/app_scafold_detail_page.dart
#	lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart
merge-update-with-lab-changes
Sikander Saleem 4 years ago
commit 706832a1cb

@ -271,6 +271,184 @@
"search": [
"roboticon"
]
},
{
"uid": "8ce732688587909ad0a9d8323eaca8ad",
"css": "marquee",
"code": 59590,
"src": "fontelico"
},
{
"uid": "ec8496ef645f3be7b28147ec60cd9ab1",
"css": "crown-minus",
"code": 59589,
"src": "fontelico"
},
{
"uid": "36ef9feb0754335302784521267a9ad4",
"css": "crown-plus",
"code": 59588,
"src": "fontelico"
},
{
"uid": "186dec7a13156bbe2550790c158fb85d",
"css": "crown",
"code": 59587,
"src": "fontelico"
},
{
"uid": "2a46f1d1c9bd036e17a74e46613c1636",
"css": "ie",
"code": 59586,
"src": "fontelico"
},
{
"uid": "9c2b737b16ae2c8d66b7bfd29ba5ecd8",
"css": "chrome",
"code": 59584,
"src": "fontelico"
},
{
"uid": "45861dd1e5ce4fde338bcccf01eeb808",
"css": "opera",
"code": 59585,
"src": "fontelico"
},
{
"uid": "2bd5f98482d86649958312ea2ab5bb40",
"css": "emo-laugh",
"code": 59576,
"src": "fontelico"
},
{
"uid": "fc92480dedc439d274d4e3e4b425edf4",
"css": "emo-squint",
"code": 59575,
"src": "fontelico"
},
{
"uid": "4843d0d6050dd508d4c101a334f46db2",
"css": "emo-shoot",
"code": 59574,
"src": "fontelico"
},
{
"uid": "04688d76a33ce7a7950e40fae79c08ac",
"css": "emo-cry",
"code": 59573,
"src": "fontelico"
},
{
"uid": "e4b163acaaa08255819f2f78afe8f075",
"css": "cart_menu_icon",
"code": 59412,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4",
"width": 1140
},
"search": [
"cart_menu_icon"
]
},
{
"uid": "45f50872f02e050e19f0910ca3e0e8e6",
"css": "categories_menu_icon",
"code": 59413,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z",
"width": 1000
},
"search": [
"categories_menu_icon"
]
},
{
"uid": "de65d94899c08a719eb8f9b723f73fc4",
"css": "hmg_logo_icon",
"code": 59414,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z",
"width": 999
},
"search": [
"hmg_logo_icon"
]
},
{
"uid": "baf8798b7336aad03b1d61cacc015142",
"css": "user_menu_icon",
"code": 59415,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M853.6 146.4A500 500 0 0 0 146.4 853.6 500 500 0 0 0 853.6 146.4ZM217 838.5A286.1 286.1 0 0 1 500 586.7 285 285 0 0 1 783 838.5 440.5 440.5 0 0 1 217 838.5ZM500 526.3A151.8 151.8 0 1 1 651.8 374.5 152.1 152.1 0 0 1 500 526.3ZM833.4 788.8A344.4 344.4 0 0 0 617.6 548.7 210.5 210.5 0 1 0 382.1 548.7 344.2 344.2 0 0 0 166.3 788.7 441.4 441.4 0 1 1 833.2 788.7ZM833.4 788.8",
"width": 1000
},
"search": [
"user_menu_icon"
]
},
{
"uid": "d3f621623139837ff2fb5fe09cf16994",
"css": "cart_menu_icon-1",
"code": 59416,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4",
"width": 1140
},
"search": [
"cart_menu_icon"
]
},
{
"uid": "6aac6f399374da0b9c4811b6a7110627",
"css": "categories_menu_icon-1",
"code": 59417,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z",
"width": 1000
},
"search": [
"categories_menu_icon"
]
},
{
"uid": "0a4cf1ff2671b9ea852d635e27df1e69",
"css": "hmg_logo_icon-1",
"code": 59418,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z",
"width": 999
},
"search": [
"hmg_logo_icon"
]
},
{
"uid": "d19eb878f1dee49848276b6d0faa6602",
"css": "wishlist_menu_icon",
"code": 59411,
"src": "custom_icons",
"selected": false,
"svg": {
"path": "M877.6 0A394.8 394.8 0 0 0 600.7 112.2 394.8 394.8 0 0 0 323.8 0 332.4 332.4 0 0 0 0 349 515.4 515.4 0 0 0 138.3 679.5 1351.1 1351.1 0 0 0 580.3 995.3 46.9 46.9 0 0 0 621.1 995.3 1351.1 1351.1 0 0 0 1063.1 679.5 515.4 515.4 0 0 0 1201.4 349 332.5 332.5 0 0 0 877.6 0ZM991.8 618.5A1233.8 1233.8 0 0 1 600.7 900.8 1233.7 1233.7 0 0 1 209.5 618.5 418.4 418.4 0 0 1 93.8 349 239.1 239.1 0 0 1 323.8 93.8 297.2 297.2 0 0 1 500.6 150.7 283.5 283.5 0 0 1 562 209.5 46.5 46.5 0 0 0 600.5 230H600.5A46.9 46.9 0 0 0 639.1 209.3 301.2 301.2 0 0 1 877.2 93.8 239.2 239.2 0 0 1 1107.1 349 418.4 418.4 0 0 1 991.8 618.5Z",
"width": 1201
},
"search": [
"wishlist_menu_icon"
]
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -16,8 +16,8 @@ const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// Pharmacy Production URLs
const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
@ -420,8 +420,8 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHa
const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
const GET_RECOMMENDED_PRODUCT = 'alsoProduct/';
const GET_MOST_VIEWED_PRODUCTS = "mostview?";
const GET_NEW_PRODUCTS = "newproducts?";
const GET_MOST_VIEWED_PRODUCTS = "mostview";
const GET_NEW_PRODUCTS = "newproducts";
// Home Health Care
const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices";

@ -757,6 +757,9 @@ const Map localizedValues = {
"permissions": {"en": "Permission", "ar": "الصلاحيات"},
"camera-permission": {"en": "Camera", "ar": "الكاميرا"},
"location-permission": {"en": "Location", "ar": "تحديد المواقع"},
"needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"},
"outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"},
"accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"},
"orderStatus": {"en": "Order Status", "ar": "حالة الطلب"},
"CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"},
@ -1036,6 +1039,7 @@ const Map localizedValues = {
"quantitySize": {"en": "Quantity", "ar": "كميه"},
"addToCart": {"en": "Add to Cart", "ar": "إضف للسلة"},
"addToWishlist": {"en": "Add to Wishlist", "ar": "اضف للمفضلة"},
"removeFromWishlist": {"en": "Remove From Wishlist", "ar": "احذف للمفضلة"},
"noData": {"en": "There is no data", "ar": "لايوجد بيانات"},
"no_data": {"en": "No data", "ar": "لايوجد بيانات"},
"buyNow": {"en": "buy now", "ar": "إشتري الان"},
@ -1555,4 +1559,6 @@ const Map localizedValues = {
"News": {"en": "News", "ar": "أخبار"},
"Latest": {"en": "Latest", "ar": "أحدث"},
"Tour": {"en": "Tour", "ar": "رحلة"},
"mostViewed": {"en": "Most Viewed", "ar": "الأكثر مشاهدة"},
"newProducts": {"en": "New Products", "ar": "منتجات جديدة"}
};

@ -108,10 +108,10 @@ class PharmacyProduct {
List<int> manufacturerIds;
List<Reviews> reviews;
List<PharmacyImageObject> images;
List<String> attributes;
List<dynamic> attributes;
List<Specifications> specifications;
List<String> associatedProductIds;
List<String> tags;
List<dynamic> associatedProductIds;
List<dynamic> tags;
int vendorId;
String seName;
@ -367,7 +367,7 @@ class PharmacyProduct {
});
}
if (json['attributes'] != null) {
attributes = new List<String>();
attributes = new List<dynamic>();
json['attributes'].forEach((v) {
attributes.add(v);
});

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
import 'package:flutter/material.dart';
class ShoppingCartResponse with ChangeNotifier {
class ShoppingCartResponse {
int itemCount;
int quantityCount;
double subtotal;
@ -11,17 +11,15 @@ class ShoppingCartResponse with ChangeNotifier {
List<ShoppingCart> shoppingCarts;
ShoppingCartResponse(
{this.itemCount,
this.quantityCount,
this.subtotal,
this.subtotalWithVat,
this.subtotalVatAmount,
this.subtotalVatRate,
{this.itemCount =0,
this.quantityCount =0,
this.subtotal=0.0,
this.subtotalWithVat = 0.0,
this.subtotalVatAmount = 0.0,
this.subtotalVatRate = 0.0 ,
this.shoppingCarts});
void updateShoppingCard() {
notifyListeners();
}
ShoppingCartResponse.fromJson(Map<String, dynamic> json) {
itemCount = json['item_count'];

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'ShippingOption.dart';
class PaymentCheckoutData with ChangeNotifier{
class PaymentCheckoutData {
Addresses address;
PaymentOption paymentOption;
LacumAccountInformation lacumInformation;
@ -15,7 +15,5 @@ class PaymentCheckoutData with ChangeNotifier{
PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0});
void updateData() {
notifyListeners();
}
}

@ -29,7 +29,8 @@ AppSharedPreferences sharedPref = new AppSharedPreferences();
/// onFailure: (String error, int statusCode) {},
/// body: Map();
///
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
VitalSignService _vitalSignService = locator<VitalSignService>();
class BaseAppClient {
@ -113,19 +114,6 @@ class BaseAppClient {
}
}
// For RC Services
// if(body.containsKey("patientId"))
// body.remove("PatientID");
//
// if(body.containsKey("patientOutSa"))
// body.remove("PatientOutSA");
//
// body['PatientID'] = 1018977;
// body['TokenID'] = "@dm!n";
// body['IdentificationNo'] = "1009199553";
// body['MobileNo'] = "966545156035";
// body['PatientMobileNumber'] = "966545156035";
print("URL : $url");
final jsonBody = json.encode(body);
print(jsonBody);
@ -445,13 +433,14 @@ class BaseAppClient {
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
'Host': "mdlaboratories.com",
});
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
if (statusCode == 401) {
AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).pharmacyRelogin);
onFailure(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode);
Navigator.of(AppGlobal.context).pushNamed(HOME);
} else {
onFailure('Error While Fetching data', statusCode);
@ -706,7 +695,8 @@ class BaseAppClient {
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
var parsed = json.decode(utf8.decode(response.bodyBytes));
onFailure(parsed['error']['ErrorEndUserMsg'] ??'Error While Fetching data', statusCode);
} else {
// var parsed = json.decode(response.body.toString());
var parsed = json.decode(utf8.decode(response.bodyBytes));

@ -62,6 +62,8 @@ class OrderPreviewService extends BaseService {
Future<Map> getShoppingCart() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId == null) return null;
Map<String, String> queryParams = {'shopping_cart_type': '1'};
dynamic localRes;
hasError = false;
@ -94,8 +96,8 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
body["shopping_cart_item"] = choppingCartObject;
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", isExternal: false,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -112,8 +114,8 @@ class OrderPreviewService extends BaseService {
Map<String, dynamic> body = Map();
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", isExternal: false,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId",
isExternal: false, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -225,8 +227,9 @@ class OrderPreviewService extends BaseService {
body['order'] = orderBody;
try {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, isExternal: false, isAllowAny: true,
onSuccess: (response, statusCode) async {
await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART,
isExternal: false,
isAllowAny: true, onSuccess: (response, statusCode) async {
orderList.clear();
response['orders'].forEach((item) {
orderList.add(OrderDetailModel.fromJson(item));
@ -263,24 +266,22 @@ class OrderPreviewService extends BaseService {
}
}
Future<LatLng> getDriverLocation(dynamic driverId) async{
Future<LatLng> getDriverLocation(dynamic driverId) async {
Map<String, dynamic> jsonBody = Map();
jsonBody['DriverID'] = driverId;
LatLng coordinates;
await baseAppClient.post(DRIVER_LOCATION,
onSuccess: (response, statusCode) async {
if(statusCode == 200){
dynamic locationObject = response['PatientER_GetDriverLocationList'][0];
double lat = locationObject['Latitude'];
double lon = locationObject['Longitude'];
if(lat != null && lon != null){
coordinates = LatLng(lat,lon);
}
}
}, onFailure: (String error, int statusCode) {
}, body: jsonBody);
if (statusCode == 200) {
dynamic locationObject = response['PatientER_GetDriverLocationList'][0];
double lat = locationObject['Latitude'];
double lon = locationObject['Longitude'];
if (lat != null && lon != null) {
coordinates = LatLng(lat, lon);
}
}
}, onFailure: (String error, int statusCode) {}, body: jsonBody);
return coordinates;
}

@ -108,17 +108,18 @@ class PharmacyModuleService extends BaseService {
}
Future getTopManufacturerList() async {
hasError = false;
if (manufacturerList.isNotEmpty) return;
Map<String, String> queryParams = {'page': '1', 'limit': '8'};
try {
await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) {
manufacturerList.clear();
response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item);
if (manufacturer.image != null) {
manufacturerList.add(Manufacturer.fromJson(item));
}
// if (manufacturer.image != null) {
manufacturerList.add(Manufacturer.fromJson(item));
// }
});
hasError = false;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -129,6 +130,8 @@ class PharmacyModuleService extends BaseService {
}
Future getBestSellerProducts() async {
if (bestSellerProducts.isNotEmpty) return;
Map<String, String> queryParams = {
'fields':
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
@ -139,6 +142,7 @@ class PharmacyModuleService extends BaseService {
response['products'].forEach((item) {
bestSellerProducts.add(PharmacyProduct.fromJson(item));
});
hasError = false;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -150,16 +154,21 @@ class PharmacyModuleService extends BaseService {
Future getLastVisitedProducts() async {
String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
// lastVisited = "2458,4561";
try {
await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) {
lastVisitedProducts.clear();
response['products'].forEach((item) {
lastVisitedProducts.add(PharmacyProduct.fromJson(item));
});
hasError = false;
}, onFailure: (String error, int statusCode) {
hasError = true;
hasError =
true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, "");
super.error = error;
});
} catch (error) {

@ -1,42 +1,23 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
class PrescriptionService extends BaseService {
final AppSharedPreferences sharedPref = AppSharedPreferences();
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
String url = "";
List<Prescriptions> _prescriptionsList = List();
List<Prescriptions> get prescriptionsList => _prescriptionsList;
// Future getPrescription() async {
// hasError = false;
// url = PRESCRIPTION;
// print("Print PRESCRIPTION url" + url);
// await baseAppClient.get(url,
// onSuccess: (dynamic response, int statusCode) {
// _prescriptionsList.clear();
// response['PatientPrescriptionList'].forEach((item) {
// _prescriptionsList.add(Prescriptions.fromJson(item));
// });
// print(_prescriptionsList.length);
// print(response);
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// });
// }
Future getPrescription() async {
url = PRESCRIPTION;
print("Print PRESCRIPTION url" + url);
hasError = false;
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
await baseAppClient.post(url,
await baseAppClient.post(PRESCRIPTION,
onSuccess: (dynamic response, int statusCode) {
_prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {

@ -90,8 +90,9 @@ class PharmacyCategoriseService extends BaseService {
Future searchProducts({String productName}) async {
hasError = false;
_searchList.clear();
String endPoint =
productName != null ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' : GET_SEARCH_PRODUCTS + "";
String endPoint = productName != null
? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1'
: GET_SEARCH_PRODUCTS + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -126,7 +127,8 @@ class PharmacyCategoriseService extends BaseService {
Future getCategoriseParent({String id}) async {
hasError = false;
_parentCategoriseList.clear();
String endPoint = id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + "";
String endPoint =
id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -144,7 +146,9 @@ class PharmacyCategoriseService extends BaseService {
Future getParentProducts({String id}) async {
hasError = false;
_parentProductsList.clear();
String endPoint = id != null ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' : GET_PARENT_PRODUCTS + "";
String endPoint = id != null
? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50'
: GET_PARENT_PRODUCTS + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -163,7 +167,8 @@ class PharmacyCategoriseService extends BaseService {
hasError = false;
_subCategoriseList.clear();
String endPoint = id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + "";
String endPoint =
id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -181,7 +186,9 @@ class PharmacyCategoriseService extends BaseService {
Future getSubProducts({String id}) async {
hasError = false;
_subProductsList.clear();
String endPoint = id != null ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' : GET_SUB_PRODUCTS + "";
String endPoint = id != null
? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50'
: GET_SUB_PRODUCTS + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -199,7 +206,8 @@ class PharmacyCategoriseService extends BaseService {
Future getFinalProducts({String id}) async {
hasError = false;
_finalProducts.clear();
String endPoint = id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + "";
String endPoint =
id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + "";
await baseAppClient.getPharmacy(
endPoint,
onSuccess: (dynamic response, int statusCode) {
@ -236,11 +244,15 @@ class PharmacyCategoriseService extends BaseService {
Future getLastVisitedProducts() async {
String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
_finalProducts.clear();
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
try {
await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
onSuccess: (dynamic response, int statusCode) {
await baseAppClient
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(PharmacyProduct.fromJson(item));
@ -261,7 +273,8 @@ class PharmacyCategoriseService extends BaseService {
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
};
try {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT,
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(PharmacyProduct.fromJson(item));
@ -275,7 +288,8 @@ class PharmacyCategoriseService extends BaseService {
}
}
Future getFilteredProducts({String categoryId, String brandId, String min, String max}) async {
Future getFilteredProducts(
{String categoryId, String brandId, String min, String max}) async {
hasError = false;
String endPoint;
@ -299,7 +313,8 @@ class PharmacyCategoriseService extends BaseService {
);
}
Future getFilteredSubProducts({String categoryId, String brandId, String min, String max}) async {
Future getFilteredSubProducts(
{String categoryId, String brandId, String min, String max}) async {
hasError = false;
String endPoint;
@ -324,12 +339,14 @@ class PharmacyCategoriseService extends BaseService {
}
Future getMostViewedProducts() async {
hasError = false;
Map<String, String> queryParams = {
'fields':
'id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage',
'mostview?fields=id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage',
};
try {
await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS,
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(PharmacyProduct.fromJson(item));
@ -341,16 +358,20 @@ class PharmacyCategoriseService extends BaseService {
super.error = error;
}, queryParams: queryParams);
} catch (error) {
throw error;
hasError = true;
super.error = error.toString();
// throw error;
}
}
Future getNewProducts() async {
Map<String, String> queryParams = {
'fields': 'Id,name,namen,localized_names,price,images,sku,stock_availability,published',
'fields':
'Id,name,namen,localized_names,price,images,sku,stock_availability,published',
};
try {
await baseAppClient.getPharmacy(GET_NEW_PRODUCTS, onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_NEW_PRODUCTS,
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(PharmacyProduct.fromJson(item));

@ -15,6 +15,7 @@ class BaseViewModel extends ChangeNotifier {
ViewState get state => _state;
String error = "";
String languageID = "en";
AuthenticatedUser user;
AppSharedPreferences sharedPref = AppSharedPreferences();
@ -51,6 +52,10 @@ class BaseViewModel extends ChangeNotifier {
notifyListeners();
}
Future getSavedLanguage() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
@override
void dispose() {
removeListener(() {});

@ -0,0 +1,26 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class BestSellerViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<PharmacyProduct> get bestSellerProduct =>
_pharmacyService.bestSellerProducts;
getBestSellerProducts() async {
setState(ViewState.BusyLocal);
await _pharmacyService.getBestSellerProducts();
// if (_pharmacyService.hasError) {
// error = _pharmacyService.error;
// setState(ViewState.Error);
// } else {
setState(ViewState.Idle);
// }
}
}

@ -0,0 +1,29 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class BrandViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
Future getTopManufacturerList() async {
setState(ViewState.BusyLocal);
await _pharmacyService.getTopManufacturerList();
// if (_pharmacyService.hasError) {
// error = _pharmacyService.error;
// setState(ViewState.Error);
// } else {
setState(ViewState.Idle);
// }
}
@override
void dispose() {
super.dispose();
}
}

@ -0,0 +1,25 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class LastVisitedViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts;
getLastVisitedProducts() async {
setState(ViewState.BusyLocal);
await _pharmacyService.getLastVisitedProducts();
// if (_pharmacyService.hasError) {
// error = _pharmacyService.error;
// setState(ViewState.Error);
// } else {
setState(ViewState.Idle);
// }
}
}

@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
@ -16,12 +18,14 @@ class OrderPreviewViewModel extends BaseViewModel {
OrderPreviewService _orderService = locator<OrderPreviewService>();
List<Addresses> get addresses => _orderService.addresses;
LacumAccountInformation get lacumInformation =>
_orderService.lacumInformation;
List<OrderDetailModel> get orderListModel => _orderService.orderList;
PharmacyModuleViewModel pharmacyModuleViewModel =
locator<PharmacyModuleViewModel>();
locator<PharmacyModuleViewModel>();
ShoppingCartResponse cartResponse = ShoppingCartResponse();
PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData();
@ -38,23 +42,32 @@ class OrderPreviewViewModel extends BaseViewModel {
}
}
void update() {
notifyListeners();
}
Future getShoppingCart() async {
setState(ViewState.Busy);
// setState(ViewState.Busy);
// GifLoaderDialogUtils.showMyDialog(
// locator<NavigationService>().navigatorKey.currentContext);
await _orderService.getShoppingCart().then((res) {
_handleGetShoppingCartResponse(res);
if (res != null) _handleGetShoppingCartResponse(res);
});
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
// setState(ViewState.Error);
} else {
if (paymentCheckoutData != null) {
paymentCheckoutData.cartDataVisible = true;
}
// GifLoaderDialogUtils.hideDialog(
// locator<NavigationService>().navigatorKey.currentContext);
setState(ViewState.Idle);
}
}
Future <ShoppingCartResponse> changeProductQuantity(ShoppingCart product) async {
Future<ShoppingCartResponse> changeProductQuantity(
ShoppingCart product) async {
setState(ViewState.Busy);
var resp = await _orderService.changeProductQuantity(product.id, product);
var object = _handleGetShoppingCartResponse(resp);
@ -110,9 +123,9 @@ class OrderPreviewViewModel extends BaseViewModel {
res["shopping_carts"].forEach((item) {
ShoppingCart shoppingCart = ShoppingCart.fromJson(item);
cartResponse.shoppingCarts.add(shoppingCart);
totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge;
totalAdditionalShippingCharge +=
shoppingCart.product.additionalShippingCharge;
});
cartResponse.updateShoppingCard();
return cartResponse;
}
@ -163,7 +176,8 @@ class OrderPreviewViewModel extends BaseViewModel {
setState(ViewState.Busy);
await _orderService.getLacumGroupInformation();
paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;
paymentCheckoutData.usedLakumPoints = paymentCheckoutData
.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount;
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
@ -174,9 +188,11 @@ class OrderPreviewViewModel extends BaseViewModel {
getShippingOption() async {
setState(ViewState.Busy);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
paymentCheckoutData.updateData();
await _orderService
.getShippingOption(paymentCheckoutData.address)
.then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
setState(ViewState.Idle);
});
if (_orderService.hasError) {
error = _orderService.error;
@ -190,7 +206,8 @@ class OrderPreviewViewModel extends BaseViewModel {
setState(ViewState.Busy);
await pharmacyModuleViewModel.generatePharmacyToken();
await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);
await _orderService.makeOrder(
paymentCheckoutData, cartResponse.shoppingCarts);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.ErrorLocal);
@ -198,6 +215,17 @@ class OrderPreviewViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
}
bool isCartItemsOutOfStock() {
bool outOfStock = false;
for (int i = 0; i < cartResponse.shoppingCarts.length; i++) {
if (cartResponse.shoppingCarts[i].product.stockQuantity == 0) {
outOfStock = true;
break;
}
}
return outOfStock;
}
}
enum PaymentOption { meda, sadad, visa, mastercard, installments }

@ -0,0 +1,28 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class PrescriptionViewModel extends BaseViewModel {
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
getPrescription() async {
await getSavedLanguage();
if(prescriptionsList.isNotEmpty){
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}
}

@ -5,47 +5,42 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.d
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart';
//import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import '../../../locator.dart';
class PharmacyModuleViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
RecommendedProductService _recommendedProductService = locator<RecommendedProductService>();
RecommendedProductService _recommendedProductService =
locator<RecommendedProductService>();
List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems;
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
List<PharmacyProduct> get bestSellerProduct =>
_pharmacyService.bestSellerProducts;
List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts;
List <RecommendedProductModel> get recommendedProductList =>
List<RecommendedProductModel> get recommendedProductList =>
_recommendedProductService.recommendedList;
// List<Map<String, dynamic>> get recommendedProductList =>
// _recommendedProductService.recommendedList;
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
bool hasError = false;
// List<PharmacyProduct> get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ;
Future generatePharmacyToken() async {
setState(ViewState.Busy);
await _pharmacyService.generatePharmacyToken();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future getPharmacyHomeData() async {
if(authenticatedUserObject.isLogin)
await generatePharmacyToken();
Future verifyCustomer() async {
// if (authenticatedUserObject.isLogin) await generatePharmacyToken();
var data = await sharedPref.getObject(USER_PROFILE);
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
@ -53,20 +48,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
setState(ViewState.Busy);
if (authenticatedUserObject.isLogin && data != null && customerId == null) {
await _pharmacyService.makeVerifyCustomer(data);
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
await getBannerList();
}
} else {
await getBannerList();
}
}
Future createUser() async {
setState(ViewState.Busy);
await _pharmacyService.createUser();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
@ -75,9 +57,9 @@ class PharmacyModuleViewModel extends BaseViewModel {
}
}
Future generatePharmacyToken() async {
Future createUser() async {
setState(ViewState.Busy);
await _pharmacyService.generatePharmacyToken();
await _pharmacyService.createUser();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
@ -87,13 +69,17 @@ class PharmacyModuleViewModel extends BaseViewModel {
}
Future getBannerList() async {
setState(ViewState.Busy);
await _pharmacyService.getBannerListList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
_getTopManufacturerList();
if (bannerList.isEmpty) {
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
await _pharmacyService.getBannerListList();
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}
@ -107,41 +93,8 @@ class PharmacyModuleViewModel extends BaseViewModel {
return images;
}
_getTopManufacturerList() async {
await _pharmacyService.getTopManufacturerList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
_getBestSellerProducts();
}
}
_getBestSellerProducts() async {
await _pharmacyService.getBestSellerProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
_getLastVisitedProducts();
}
}
_getLastVisitedProducts() async {
await _pharmacyService.getLastVisitedProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
//////////////////////////////////////////RecommendedProducts
getRecommendedProducts(productId) async {
hasError = false;
setState(ViewState.Busy);
getRecommendedProducts(productId) async {
setState(ViewState.Busy);
await _recommendedProductService.getRecommendedProducts(productId);
if (_recommendedProductService.hasError) {
error = _recommendedProductService.error;
@ -164,31 +117,4 @@ class PharmacyModuleViewModel extends BaseViewModel {
return false;
}
}
getPrescription() async {
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
///////////////////////or
// getPrescriptions() async {
// setState(ViewState.Busy);
// await _prescriptionsService.getPrescriptions();
// if (_prescriptionsService.hasError) {
// error = _prescriptionsService.error;
// setState(ViewState.Error);
// } else {
// _filterList();
// await _getPrescriptionsOrders();
// setState(ViewState.Idle);
// }
// }
}

@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import '../../../locator.dart';
@ -35,7 +38,7 @@ class ProductDetailViewModel extends BaseViewModel{
Future getProductLocationData() async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _productDetailService.getProductAvailabiltyDetail();
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -46,7 +49,7 @@ class ProductDetailViewModel extends BaseViewModel{
Future notifyMe(customerId, itemID) async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _productDetailService.notifyMe(customerId, itemID);
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -57,7 +60,7 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToCartData(quantity, itemID) async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _productDetailService.addToCart(quantity, itemID);
if (_productDetailService.hasError) {
error = _productDetailService.error;
@ -68,8 +71,13 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToWishlistData(itemID) async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.addToWishlist(itemID);
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);
@ -89,10 +97,15 @@ class ProductDetailViewModel extends BaseViewModel{
}
Future deletWishlistData(itemID) async {
Future deleteWishlistData(itemID) async {
hasError = false;
setState(ViewState.Busy);
await _productDetailService.delteItemFromWishlist(itemID);
setState(ViewState.BusyLocal);
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
await _productDetailService.deleteItemFromWishlist(itemID);
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
if (_productDetailService.hasError) {
error = _productDetailService.error;
setState(ViewState.ErrorLocal);
@ -112,4 +125,10 @@ class ProductDetailViewModel extends BaseViewModel{
setState(ViewState.Idle);
}
clearReview(){
productDetailService.clear();
}
}

@ -12,20 +12,9 @@ class WishListViewModel extends BaseViewModel{
bool hasError = false;
// Future getWishlistData() async {
// setState(ViewState.Busy);
// await _wishlistService.getWishlist();
// if (_wishlistService.hasError) {
// error = _wishlistService.error;
// setState(ViewState.Error);
// } else {
// setState(ViewState.Idle);
// }
// }
Future getWishlistData() async {
Future getWishlistData({isLocalLoader = false}) async {
hasError = false;
setState(ViewState.Busy);
setState(isLocalLoader ? ViewState.BusyLocal:ViewState.Busy);
await _wishlistService.getWishlist();
if (_wishlistService.hasError) {
error = _wishlistService.error;

@ -0,0 +1,27 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
class ProductCategoriesViewModel extends BaseViewModel {
bool hasError = false;
PharmacyCategoriseService _pharmacyCategoriseService =
locator<PharmacyCategoriseService>();
List<PharmacyCategorise> get categorise =>
_pharmacyCategoriseService.categoriseList;
Future getCategorise() async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getCategorise();
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -11,7 +11,7 @@
/// fonts:
/// - asset: fonts/DQIcons.ttf
///
///
///
///
import 'package:flutter/widgets.dart';
@ -19,25 +19,80 @@ class DQIcons {
DQIcons._();
static const _kFontFam = 'DQIcons';
static const _kFontPkg = null;
static const String _kFontPkg = null;
static const IconData blood_pressure = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bmi = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData heart = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData outline = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData thermometer = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_scale = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData parking_icon = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_type_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height_icon = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData online_payment_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData search_medicine_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData vital_sign_icon = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_icon = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData my_medical_file = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData family = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData calendar__2_ = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData roboticon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_pressure =
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood =
IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bmi =
IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData heart =
IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height =
IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData outline =
IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData thermometer =
IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_scale =
IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData parking_icon =
IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_type_icon =
IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height_icon =
IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData online_payment_icon =
IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData search_medicine_icon =
IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData vital_sign_icon =
IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_icon =
IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData my_medical_file =
IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData family =
IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData calendar__2_ =
IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData roboticon =
IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData cart_menu_icon =
IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData categories_menu_icon =
IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData hmg_logo_icon =
IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData user_menu_icon =
IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData cart_menu_icon_1 =
IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData categories_menu_icon_1 =
IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData hmg_logo_icon_1 =
IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_cry =
IconData(0xe8b5, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_shoot =
IconData(0xe8b6, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_squint =
IconData(0xe8b7, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_laugh =
IconData(0xe8b8, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData chrome =
IconData(0xe8c0, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData opera =
IconData(0xe8c1, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData ie =
IconData(0xe8c2, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown =
IconData(0xe8c3, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown_plus =
IconData(0xe8c4, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown_minus =
IconData(0xe8c5, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData marquee =
IconData(0xe8c6, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model
import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/product_categories_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart';
@ -121,6 +122,10 @@ import 'core/viewModels/offers_Categorise_view_model.dart';
import 'core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'core/viewModels/pharmacies_view_model.dart';
import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
import 'core/viewModels/pharmacyModule/brand_view_model.dart';
import 'core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart';
@ -284,24 +289,29 @@ void setupLocator() {
locator.registerFactory(() => ProductDetailViewModel());
locator.registerFactory(() => WeatherViewModel());
locator.registerFactory(() => OrderPreviewViewModel());
// locator.registerFactory(() => OrderPreviewViewModel());
locator.registerFactory(() => LacumViewModel());
locator.registerFactory(() => LacumTranferViewModel());
locator.registerFactory(() => LacumRegistrationViewModel());
locator.registerFactory(() => EdOnlineViewModel());
locator.registerFactory(() => ProductCategoriesViewModel());
//pharmacy
locator.registerFactory(() => PharmacyCategoriseViewModel());
locator.registerFactory(() => OffersCategoriseViewModel());
locator.registerFactory(() => BariatricsViewModel());
locator.registerFactory(() => PrescriptionViewModel());
locator.registerFactory(() => BrandViewModel());
locator.registerFactory(() => BestSellerViewModel());
locator.registerFactory(() => LastVisitedViewModel());
// Offer And Packages
//----------------------
locator.registerLazySingleton(() => OffersAndPackagesServices()); // offerPackagesServices Service
locator.registerFactory(() => OfferCategoriesViewModel()); // Categories View Model
locator.registerFactory(() => PackagesViewModel()); // Products View Model
//pharmacy
// locator.registerFactory(() => PharmacyCategoriseViewModel());
// locator.registerFactory(() => OffersCategoriseViewModel());

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/theme/theme_notifier.dart';
import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
@ -16,6 +17,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
import 'config/size_config.dart';
import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'core/viewModels/project_view_model.dart';
import 'locator.dart';
import 'pages/pharmacies/compare-list.dart';
@ -81,11 +83,17 @@ class _MyApp extends State<MyApp> {
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),
),
ChangeNotifierProvider<CompareList>(create: (context) => CompareList()),
ChangeNotifierProvider<CompareList>(
create: (context) => CompareList()),
ChangeNotifierProvider<OrderPreviewViewModel>(
create: (context) => OrderPreviewViewModel()),
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
navigatorObservers: [GAnalytics.shared.navObserver()],
navigatorObservers: [
GAnalytics.shared.navObserver()
],
navigatorKey: locator<NavigationService>().navigatorKey,
showSemanticsDebugger: false,
title: 'Diplomatic Quarter App',
locale: projectProvider.appLocal,

@ -51,6 +51,9 @@ class _PickupLocationState extends State<PickupLocation> {
void initState() {
super.initState();
_getCurrentLocation();
setState(() {
});
}
_getCurrentLocation() async {
@ -61,6 +64,7 @@ class _PickupLocationState extends State<PickupLocation> {
_longitude = 0;
_latitude = 0;
});
}
@override
@ -89,8 +93,8 @@ class _PickupLocationState extends State<PickupLocation> {
context,
FadePage(
page: PickupLocationFromMap(
latitude: _latitude,
longitude: _longitude,
latitude: _latitude??0,
longitude: _longitude??0,
onPick: (value) {
setState(() {
_result = value;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,888 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart';
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import 'landing_page_pharmcy.dart';
class HomePage extends StatefulWidget {
final Function goToMyProfile;
HomePage({Key key, this.goToMyProfile});
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<DashboardViewModel>(
onModelReady: (model) => () async {},
builder: (_, model, wi) => AppScaffold(
isShowDecPage: false,
isHelp: true,
body: Container(
width: double.infinity,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Stack(
children: <Widget>[
Column(
children: <Widget>[
Container(
width: double.infinity,
height: 210,
decoration: BoxDecoration(
image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover),
),
child: Stack(
children: <Widget>[
Positioned(
top: 15,
left: 5,
right: 5,
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Row(
children: <Widget>[
Expanded(
child: Container(
height: 125,
padding: EdgeInsets.all(5),
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/new-design/covid_bg_transparent.png"),
fit: BoxFit.fill,
),
color: Colors.white.withOpacity(0.3),
borderRadius: BorderRadius.all(Radius.circular(5))),
child: (model.user != null && model.user.outSA == 1)
? Container(
width: double.infinity,
height: double.infinity,
color: Colors.grey.shade500.withOpacity(0.3),
child: Icon(
Icons.lock_outline,
size: 40,
),
)
: Container(
child: Column(
children: <Widget>[
Texts(
TranslationBase.of(context).covidTest,
color: Colors.white,
fontWeight: FontWeight.w700,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(
top: 15.0,
),
child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0),
),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Column(
children: <Widget>[
Texts(
TranslationBase.of(context).driveThru,
fontWeight: FontWeight.w700,
color: Colors.white,
),
ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
minWidth: MediaQuery.of(context).size.width * 0.15,
height: 25.0,
child: RaisedButton(
color: Colors.red[800],
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: (model.user != null && model.user.outSA == 1)
? () {}
: () {
navigateToCovidDriveThru();
},
child: Center(
child: Center(
child: Center(
child: Center(
child: Texts(
TranslationBase.of(context).bookNow,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
),
),
),
),
],
),
),
],
),
],
),
)),
),
Expanded(
child: InkWell(
onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())),
child: Container(
height: 125,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(5),
decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))),
child: SvgPicture.asset(
projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg',
),
),
),
),
],
),
),
)
],
),
),
Container(width: double.infinity, height: projectViewModel.isArabic ? 110 : 80)
],
),
Positioned(
top: 155,
left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
child: (!model.isLogin)
? Container(
width: double.infinity,
height: 125,
decoration: BoxDecoration(
color: HexColor('#A59E9E'),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.transparent, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(9)),
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)),
child: Container(
margin: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 2,
),
Texts(
TranslationBase.of(context).myMedicalFile,
color: Colors.black87,
fontWeight: FontWeight.w700,
fontSize: 23,
),
Texts(
TranslationBase.of(context).myMedicalFileSubTitle,
color: Colors.black,
fontSize: 16,
),
Align(
alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
child: InkWell(
onTap: () {
widget.goToMyProfile();
},
child: Container(
margin: EdgeInsets.only(left: 15, right: 15),
width: 90,
height: 30,
decoration: BoxDecoration(
color: HexColor('#D81A2E'),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.transparent, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(0)),
),
child: Center(
child: Texts(
TranslationBase.of(context).viewMore,
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 12,
),
),
),
),
)
],
),
),
)
: Container(
width: double.infinity,
height: projectViewModel.isArabic ? 160 : 130,
decoration: BoxDecoration(
color: HexColor('#A59E9E'),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.transparent, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(9)),
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover),
),
child: Container(
margin: EdgeInsets.all(5),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
if (projectViewModel.user != null && model.isLogin)
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 8,
),
model.user.cRSVerificationStatus == 2
? Row(
children: [
Texts(
model.user.firstName + " " + model.user.lastName,
color: Colors.grey[100],
bold: true,
fontSize: 15,
),
Container(
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
child: SvgPicture.asset("assets/images/new-design/verification_check.svg"),
),
],
)
: model.user.cRSVerificationStatus == 3
? Row(
children: [
Texts(
model.user.firstName + " " + model.user.lastName,
color: Colors.grey[100],
bold: true,
fontSize: 15,
),
Container(
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
child: SvgPicture.asset("assets/images/new-design/pending.svg"),
),
],
)
: Row(
children: [
Texts(
model.user.firstName + " " + model.user.lastName,
color: Colors.grey[100],
bold: true,
fontSize: 15,
),
],
),
Texts(
'${model.user.patientID}',
color: Colors.white,
fontSize: 14,
),
SizedBox(
height: 5,
),
Texts(
'${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}',
color: Colors.grey[100],
fontWeight: FontWeight.normal,
fontSize: 14,
),
],
),
),
InkWell(
onTap: () {
widget.goToMyProfile();
},
child: Container(
margin: EdgeInsets.all(2),
width: 90,
height: 30,
decoration: BoxDecoration(
color: HexColor('#D81A2E'),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.transparent, width: 0.5),
borderRadius: BorderRadius.all(
Radius.circular(5),
),
),
child: Center(
child: Texts(
TranslationBase.of(context).myMedicalFile,
color: Colors.white,
fontSize: 12,
textAlign: TextAlign.center,
),
),
),
)
],
),
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Image.asset(
'assets/images/height_icon.png',
width: 35,
height: 40,
),
Texts(
"${model.heightCm} ${TranslationBase.of(context).cm}",
color: Colors.white,
fontSize: 17,
)
],
),
),
SizedBox(
width: 3,
),
Expanded(
child: Row(
children: <Widget>[
Image.asset(
'assets/images/weight_icon.png',
width: 25,
height: 40,
),
Texts('${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 17)
],
),
),
SizedBox(
width: 3,
),
Expanded(
child: Row(
children: <Widget>[
Image.asset(
'assets/images/blood_icon.png',
width: 35,
height: 40,
),
Texts('${model.booldType}', color: Colors.white, fontSize: 17)
],
),
),
],
)
],
),
),
),
),
],
),
Padding(
padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15),
child: InkWell(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage()));
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xffB8382C),
),
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
children: [
Texts(
TranslationBase.of(context).offerAndPackages,
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.normal,
),
Spacer(),
Image.asset("assets/images/offer_icon.png"),
],
),
),
),
),
),
if (projectViewModel.havePrivilege(64) || projectViewModel.havePrivilege(65) || projectViewModel.havePrivilege(67))
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (projectViewModel.havePrivilege(64))
DashboardItem(
onTap: (model.user != null && model.user.outSA == 1)
? () {}
: () {
Navigator.push(
context,
FadePage(
page: HomeHealthCarePage(),
),
);
},
child: Center(
child: Padding(
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
child: (model.user != null && model.user.outSA == 1)
? Container(
width: double.infinity,
height: double.infinity,
color: Colors.grey.shade500.withOpacity(0.3),
child: Icon(
Icons.lock_outline,
size: 40,
),
)
: Column(
children: <Widget>[
Image.asset(
'assets/images/home_health_care_icon.png',
width: 50,
height: 50,
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).homeHealthCare,
textAlign: TextAlign.center,
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.textMultiplier * 1.55,
)
],
)),
),
height: MediaQuery.of(context).size.width * 0.4,
imageName: 'home_healthcare_service_bg.png',
opacity: 0.5,
),
if (projectViewModel.havePrivilege(65))
DashboardItem(
onTap: () => (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model),
child: Center(
child: Padding(
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
child: (model.user != null && model.user.outSA == 1)
? Container(
width: double.infinity,
height: double.infinity,
color: Colors.grey.shade500.withOpacity(0.3),
child: Icon(
Icons.lock_outline,
size: 40,
),
)
: Column(
children: <Widget>[
// if (projectViewModel.user != null && model.isLogin && model.user.outSA == 1)
// Image.asset(
// 'assets/images/lock_icon.png',
// width: 50,
// height: 50,
// ),
Image.asset(
'assets/images/pharmacy_logo.png',
width: 40,
height: 40,
),
SizedBox(
height: 20,
),
Texts(
TranslationBase.of(context).onlinePharmacy,
textAlign: TextAlign.center,
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.textMultiplier * 1.55,
)
],
),
),
),
height: MediaQuery.of(context).size.width * 0.4,
imageName: 'al-habib_onlne_pharmacy_bg.png',
),
if (projectViewModel.havePrivilege(67))
DashboardItem(
onTap: (model.user != null && model.user.outSA == 1)
? () {}
: () {
Navigator.push(
context,
FadePage(
page: CMCPage(),
),
);
},
child: Center(
child: Padding(
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
child: (model.user != null && model.user.outSA == 1)
? Container(
width: double.infinity,
height: double.infinity,
color: Colors.grey.shade500.withOpacity(0.3),
child: Icon(
Icons.lock_outline,
size: 40,
),
)
: Column(
children: <Widget>[
Image.asset(
'assets/images/comprehensive_medical_checkup_logo.png',
width: 50,
height: 50,
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).cmcHeading,
textAlign: TextAlign.center,
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: SizeConfig.textMultiplier * 1.55,
)
],
)),
),
height: MediaQuery.of(context).size.width * 0.4,
color: HexColor("#747C80"),
imageName: 'emergency_service_image.png',
),
],
),
),
SizedBox(
height: 8,
),
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
InkWell(
onTap: () => Navigator.push(context, FadePage(page: PaymentService())),
child: Container(
width: MediaQuery.of(context).size.width * 0.29,
child: Center(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Image.asset(
'assets/images/al-habib_online_payment_service_icon.png',
height: 55,
),
SizedBox(
height: 5,
),
Texts(
TranslationBase.of(context).onlinePaymentService,
textAlign: TextAlign.center,
color: Colors.black87,
bold: false,
fontSize: SizeConfig.textMultiplier * 1.7,
)
],
),
),
),
height: MediaQuery.of(context).size.width * 0.4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
),
),
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: EReferralPage()));
},
child: Container(
child: Center(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Image.asset(
'assets/images/ereferral_service_icon.png',
width: 50,
height: 55,
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).ereferral,
textAlign: TextAlign.center,
color: Colors.black87,
bold: false,
fontSize: SizeConfig.textMultiplier * 1.7,
)
],
),
),
),
width: MediaQuery.of(context).size.width * 0.29,
height: MediaQuery.of(context).size.width * 0.4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
)),
),
if (projectViewModel.havePrivilege(60))
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: ErOptions(
isAppbar: true,
))),
child: Center(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Image.asset(
'assets/images/Dr_Schedule_report.png',
width: 50,
height: 50,
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).emergencyServices,
textAlign: TextAlign.center,
color: Colors.black87,
bold: false,
fontSize: SizeConfig.textMultiplier * 1.7,
)
],
),
),
),
),
height: MediaQuery.of(context).size.width * 0.4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Colors.white,
),
),
],
),
),
// ),
SizedBox(
height: 5,
),
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
DashboardItem(
child: Container(
width: double.infinity,
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
TranslationBase.of(context).hMGService,
color: Colors.white,
fontWeight: FontWeight.normal,
),
Texts(
TranslationBase.of(context).viewAllHabibMedicalService,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 10,
),
Expanded(
child: Container(),
),
Texts(
TranslationBase.of(context).viewMore,
color: Colors.white,
//fontWeight: FontWeight.normal,
)
],
),
),
height: 100,
imageName: 'contact_us_bg.png',
opacity: 0.5,
color: Colors.grey[700],
width: MediaQuery.of(context).size.width * 0.45,
onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService())),
),
DashboardItem(
onTap: () {
// Navigator.push(
// context, FadePage(page: FeedbackHomePage()));
Navigator.push(context, FadePage(page: ContactUsPage()));
},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
TranslationBase.of(context).reachUs,
color: Colors.white,
fontWeight: FontWeight.normal,
),
Texts(
TranslationBase.of(context).viewAllWaysReachUs,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 10,
),
Expanded(
child: Container(),
),
Texts(
TranslationBase.of(context).viewMore,
color: Colors.white,
fontWeight: FontWeight.normal,
)
],
),
),
height: 100,
imageName: 'contact_us_bg.png',
opacity: 0.5,
color: Colors.grey[700],
width: MediaQuery.of(context).size.width * 0.45,
),
],
),
),
SizedBox(
height: 120,
)
],
),
),
),
),
);
}
getPharmacyToken(DashboardViewModel model) async {
if (!model.isLogin) {
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
} else {
GifLoaderDialogUtils.showMyDialog(context);
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
await pharmacyModuleViewModel.verifyCustomer().then((value) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
});
});
}
}
navigateToCovidDriveThru() {
Navigator.push(context, FadePage(page: CovidDrivethruLocation()));
}
}
class DashboardItem extends StatelessWidget {
const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true})
: super(key: key);
final bool hasBorder;
final String imageName;
final Widget child;
final Function onTap;
final double width;
final double height;
final Color color;
final double opacity;
final bool hasColorFilter;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
height: height != null
? height
: MediaQuery.of(context).orientation == Orientation.portrait
? MediaQuery.of(context).size.height * 0.17
: MediaQuery.of(context).size.height * 0.35,
decoration: BoxDecoration(
color: !hasBorder
? color != null
? color
: HexColor('#050705').withOpacity(opacity)
: Colors.white,
borderRadius: BorderRadius.circular(6.0),
border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent),
image: imageName != null
? DecorationImage(
image: ExactAssetImage('assets/images/$imageName'),
fit: BoxFit.cover,
colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null,
)
: null,
),
child: Center(
child: child,
),
),
);
}
}

@ -2,9 +2,10 @@ import 'package:barcode_scan_fix/barcode_scan.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
@ -18,6 +19,8 @@ import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.da
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import '../../locator.dart';
class LandingPagePharmacy extends StatefulWidget {
@override
_LandingPagePharmacyState createState() => _LandingPagePharmacyState();
@ -37,127 +40,102 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
void initState() {
super.initState();
locator<PharmacyModuleService>().manufacturerList = [];
locator<PharmacyModuleService>().bestSellerProducts = [];
locator<PharmacyModuleService>().lastVisitedProducts = [];
pageController = PageController(keepPage: true);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: currentTab != 4 && currentTab != 3
? AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
title: Container(
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(5.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,
)
],
return WillPopScope(
onWillPop: () async {
return false;
},
child: Scaffold(
appBar: currentTab != 4 && currentTab != 3
? AppBar(
backgroundColor: Color(0xff5AB145),
elevation: 0,
title: Container(
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(5.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,
FadePage(page: SearchProductsPage()),
);
},
),
onTap: () {
Navigator.push(
context,
FadePage(page: SearchProductsPage()),
),
leading: Builder(
builder: (BuildContext context) {
return InkWell(
onTap: () {
setState(() {
currentTab = 0;
pageController.jumpToPage(0);
});
},
child: Container(
height: 2.0,
width: 10.0,
child: Image.asset(
'assets/images/pharmacy_logo.png',
),
),
);
},
),
),
leading: Builder(
builder: (BuildContext context) {
return InkWell(
onTap: () {
setState(() {
currentTab = 0;
pageController.jumpToPage(0);
});
},
child: Container(
height: 2.0,
width: 10.0,
child: Image.asset(
'assets/images/pharmacy_logo.png',
actions: [
IconButton(
// iconSize: 70,
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
),
);
},
),
actions: [
IconButton(
// iconSize: 70,
icon: Image.asset(
'assets/images/new-design/qr-code.png',
),
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
)
: null,
// : AppBar(
// backgroundColor: Color(0xff5AB145),
// elevation: 0,
// textTheme: TextTheme(
// headline6: TextStyle(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// title: Text(getText(currentTab).toUpperCase()),
// leading: Builder(
// builder: (BuildContext context) {
// return IconButton(
// icon: Icon(Icons.arrow_back),
// color: Colors.white,
// onPressed: () => Scaffold.of(context).openDrawer(),
// );
// },
// ),
// actions: [
// // IconButton(
// // iconSize: 70,
// // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// // height: 100, width: 100, fit: BoxFit.cover),
// // onPressed: () {
// // triggerRobot();
// // } //do something,
// // )
// ],
// centerTitle: true,
// ),
extendBody: false,
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: [
PharmacyPage(),
PharmacyCategorisePage(),
// OffersCategorisePage(),
WishlistPage(false),
PharmacyProfilePage(),
// Container(
// child: Text('text'),
// ),
CartOrderPage(),
], // Please do not remove the BookingOptions from this array
),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
index: currentTab,
onPressed: _scanQrAndGetProduct //do something,
)
],
centerTitle: true,
)
: null,
extendBody: false,
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: [
PharmacyPage(),
PharmacyCategorisePage(),
PharmacyProfilePage(),
CartOrderPage(changeTab: _changeCurrentTab),
],
),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
index: currentTab,
),
),
);
}
@ -172,7 +150,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) {
print(response);
product = PharmacyProduct.fromJson(response["products"][0]);
var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) {

@ -64,7 +64,10 @@ class _Login extends State<Login> {
if (BASE_URL.contains("uat.")) {
nationalIDorFile.text = "2001273";
mobileNumberController.text = mobileNo = "0555416043";
}
}/* else {
nationalIDorFile.text = "3376044";
mobileNumberController.text = mobileNo = "0555416575";
}*/
}
getDeviceToken() async {

@ -25,8 +25,6 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail>{
@override
Widget build(BuildContext context) {
getLanguageID();
return BaseView<PackagesViewModel>(
onModelReady: (model){
viewModel = model;

File diff suppressed because it is too large Load Diff

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

@ -44,8 +44,8 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
child: Text(TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
)
@ -121,7 +121,7 @@ reviewDetails(data, rate, myRate) {
: data.product.name,
style: TextStyle(
color: Colors.black54,
fontSize: languageID == 'ar' ? 7 : 13,
fontSize: languageID == 'ar' ? 12 : 13,
fontWeight: FontWeight.bold),
),
),
@ -137,7 +137,7 @@ reviewDetails(data, rate, myRate) {
: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: data.product.price.toString() +
text: data.product.quantity.toString() +
" " +
data.product.currency,
style: TextStyle(
@ -187,7 +187,7 @@ reviewDetails(data, rate, myRate) {
padding: languageID == 'ar'
? EdgeInsets.only(right: 10)
: EdgeInsets.only(left: 10),
child: Text(data.createdOnUtc.toString())),
child: Text(data.createdOnUtc.toString().substring(0 , 11))),
],
),
),

@ -95,7 +95,7 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
height: 10,
),
Container(
height: 290,
height: 420,
width: double.infinity,
color: Colors.white,
child: ListView.builder(

File diff suppressed because it is too large Load Diff

@ -4,222 +4,265 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:provider/provider.dart';
class CartOrderPage extends StatelessWidget {
import 'cart-page/cart-order-preview.dart';
class CartOrderPage extends StatefulWidget {
const CartOrderPage({ Key key})
: super(key: key);
@override
_CartOrderPageState createState() => _CartOrderPageState();
}
class _CartOrderPageState extends State<CartOrderPage> {
bool isLoading = true;
@override
void initState() {
super.initState();
getData();
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
OrderPreviewViewModel model = Provider.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
AppScaffold appScaffold;
return BaseView<OrderPreviewViewModel>(
onModelReady: (model){
model.getShoppingCart().then((value){
appScaffold.appBar.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
});
},
builder: (_, model, wi) => ChangeNotifierProvider.value(
value: model.cartResponse,
child: appScaffold = AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isPharmacy: true,
baseViewModel: model,
backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? Container(
height: height * 0.85,
width: double.infinity,
child: Consumer<ShoppingCartResponse>(
builder: (ctx, cart, _) => Container(
child: SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(10),
return NetworkBaseView(
// baseViewModel: model,
isLoading: isLoading,
isLocalLoader: true,
child: AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isPharmacy: true,
showHomeAppBarIcon: false,
isShowDecPage: true,
baseViewModel: model,
backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? Container(
height: height * 0.85,
width: double.infinity,
child: SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureIconButton(
TranslationBase.of(context).deleteAllItems,
Icon(
Icons.delete_outline_sharp,
color: Colors.grey.shade700,
),
onTap: () => {model.deleteShoppingCart()},
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureIconButton(
TranslationBase.of(context).deleteAllItems,
Icon(
Icons.delete_outline_sharp,
color: Colors.grey.shade700,
),
onTap: () => {model.deleteShoppingCart()},
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
child: Column(
children: [
...List.generate(
cart.shoppingCarts != null ? cart.shoppingCarts.length : 0,
(index) => ProductOrderItem(
cart.shoppingCarts[index], () {print(cart.shoppingCarts[index].quantity);
model.changeProductQuantity(cart.shoppingCarts[index]).then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
}
if (model.state ==
ViewState.ErrorLocal) {Utils.showErrorToast(model.error);}
});
},
() {
model.deleteProduct(cart.shoppingCarts[index]).then((value){
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
}
});
}))
],
),
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 2,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).subtotal,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Image.asset(
"assets/images/pharmacy_module/payment_image.png",
width: mediaQuery.size.width - 20,
height: 30.0,
fit: BoxFit.scaleDown,
)
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) => ProductOrderItem(
model.cartResponse
.shoppingCarts[index], () {
print(model.cartResponse
.shoppingCarts[index].quantity);
model
.changeProductQuantity(model
.cartResponse
.shoppingCarts[index])
.then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
if (model.state ==
ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
}
});
}, () {
model
.deleteProduct(model.cartResponse
.shoppingCarts[index])
.then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
});
}))
],
),
),
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 2,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).subtotal,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Image.asset(
"assets/images/pharmacy_module/payment_image.png",
width: mediaQuery.size.width - 20,
height: 30.0,
fit: BoxFit.scaleDown,
),
SizedBox(
height: 120,
)
],
),
),
)
: 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,
),
),
)
: 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(TranslationBase.of(context).noData,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
style: TextStyle(fontSize: 30),
),
)
],
),
bottomSheet: Container(
height: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? height * 0.15
: 0,
color: Colors.white,
child: OrderBottomWidget(model.addresses, height),
),
),
bottomSheet: Container(
height: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? height * 0.15
: 0,
color: Colors.white,
child: OrderBottomWidget(model.addresses, height),
),
),
);
}
void getData() async {
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
}
class OrderBottomWidget extends StatefulWidget {
@ -238,46 +281,41 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Consumer<ShoppingCartResponse>(
builder: (ctx, cart, _) => !(cart.shoppingCarts == null ||
cart.shoppingCarts.length == 0)
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
OrderPreviewViewModel cart = Provider.of(context);
return !(cart.cartResponse.shoppingCarts == null ||
cart.cartResponse.shoppingCarts.length == 0)
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
height: widget.height * 0.070,
color: Color(0xffe6ffe0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: [
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
height: widget.height * 0.070,
color: Color(0xffe6ffe0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
isAgree = !isAgree;
});
},
child: Container(
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color: !isAgree
? Color(0xffeeeeee)
: Colors.green,
shape: BoxShape.circle,
),
child: !isAgree
? null
: Padding(
InkWell(
onTap: () {
setState(() {
isAgree = !isAgree;
});
},
child: Container(
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color: !isAgree ? Color(0xffeeeeee) : Colors.green,
shape: BoxShape.circle,
),
child: !isAgree
? null
: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
@ -285,108 +323,132 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
size: 25,
),
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
child: Texts(
TranslationBase.of(context)
.pharmacyServiceTermsCondition,
fontSize: 13,
color: Colors.grey.shade800,
fontWeight: FontWeight.normal,
),
),
),
InkWell(
onTap: () => {
Navigator.push(context,
FadePage(page: PharmacyTermsConditions()))
},
child: Container(
child: Icon(
Icons.info,
size: 25,
color: Color(0xff005aff),
),
),
),
],
),
),
Container(
height: widget.height * 0.065,
margin: EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
child: Texts(
TranslationBase.of(context)
.pharmacyServiceTermsCondition,
fontSize: 13,
color: Colors.grey.shade800,
fontWeight: FontWeight.normal,
),
),
),
InkWell(
onTap: () => {
Navigator.push(
context, FadePage(page: PharmacyTermsConditions()))
},
child: Container(
child: Icon(
Icons.info,
size: 25,
color: Color(0xff005aff),
),
),
),
],
),
),
Container(
height: widget.height * 0.065,
margin: EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
Container(
margin: EdgeInsets.symmetric(
horizontal: 0, vertical: 0),
child: Row(
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 0, vertical: 0),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}",
fontSize:
projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
],
),
),
Texts(
"${cart.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
fontSize: projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
],
),
),
RaisedButton(
onPressed: isAgree
? () => {
Navigator.push(
context,
FadePage(
page: OrderPreviewPage(
widget.addresses)))
}
: null,
child: new Text(
"${TranslationBase.of(context).checkOut}",
style: new TextStyle(
color: isAgree
? Colors.white
: Colors.grey.shade300,
fontSize: 14),
),
color: Color(0xff005aff),
disabledColor: Color(0xff005aff),
Texts(
"${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
),
RaisedButton(
onPressed: isAgree
// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0
? () => {
if(cart.isCartItemsOutOfStock()){
// Toast msg
AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)
}else {
Navigator.push(
context,
FadePage(
page:
OrderPreviewPage(widget.addresses)))
}
}
: null,
child: new Text(
"${TranslationBase.of(context).checkOut}",
style: new TextStyle(
color:
isAgree ? Colors.white : Colors.grey.shade300,
fontSize: 14),
),
color: Color(0xff005aff),
disabledColor: Color(0xff005aff),
)
// RaisedButton(
// onPressed: isAgree
//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0
// ? () => {
// Navigator.push(
// context,
// FadePage(
// page:
// OrderPreviewPage(widget.addresses)))
// }
// : null,
// child: new Text(
// "${TranslationBase.of(context).checkOut}",
// style: new TextStyle(
// color:
// isAgree ? Colors.white : Colors.grey.shade300,
// fontSize: 14),
// ),
// color: Color(0xff005aff),
// disabledColor: Color(0xff005aff),
// )
],
)
: Container(),
));
),
),
],
)
: Container();
}
}

@ -1,947 +0,0 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart';
class OrderPreviewPage extends StatelessWidget {
final List<Addresses> addresses;
OrderPreviewPage(this.addresses);
MyInAppBrowser browser;
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
return BaseView<OrderPreviewViewModel>(
onModelReady: (model) => model.getShoppingCart(),
builder: (_, model, wi) => ChangeNotifierProvider.value(
value: model.paymentCheckoutData,
child: AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
backgroundColor: Colors.white,
baseViewModel: model,
body: Container(
height: height * 0.90,
child: SingleChildScrollView(
child: Container(
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model, addresses),
SizedBox(
height: 10,
),
SelectPaymentOptionWidget(model),
SizedBox(
height: 10,
),
Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
paymentData.lacumInformation != null
? Container(
child: Column(
children: [
LakumWidget(model),
SizedBox(
height: 10,
),
],
),
)
: Container()),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase
.of(context)
.reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) =>
ProductOrderPreviewItem(
model.cartResponse
.shoppingCarts[index]),
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
child: model.cartResponse.subtotal != null
? Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
TranslationBase
.of(context)
.orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model
.totalAdditionalShippingCharge)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase
.of(context)
.vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse
.subtotalVatAmount).toStringAsFixed(
2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase
.of(context)
.total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
)
],
),
),
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null
? height * 0.10
: 0,
color: Colors.white,
child: PaymentBottomWidget(model),
),
),
));
}
}
class SelectAddressWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final List<Addresses> addresses;
SelectAddressWidget(this.model, this.addresses);
@override
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Addresses address;
_navigateToAddressPage() {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
/* setState(() {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
})*/
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.address != null) {
address = widget.model.paymentCheckoutData.address;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
Container(
color: Colors.white,
child: address == null
? InkWell(
onTap: () => {_navigateToAddressPage()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_address.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.selectAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_mark.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.shippingAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToAddressPage()},
child: Texts(
TranslationBase
.of(context)
.changeAddress,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.firstName} ${address.lastName}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address
.address2},, ${address.city}, ${address
.country} ${address.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
),
),
Row(
children: [
Container(
margin: const EdgeInsets.only(right: 8),
child: Icon(
Icons.phone,
size: 20,
color: Colors.black,
),
),
Texts(
"${address.phoneNumber}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
],
),
Container(
margin: EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
height: 2,
width: double.infinity,
child: Container(
color: Color(0xffefefef),
),
),
),
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_truck.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
"${TranslationBase
.of(context)
.shipBy}",
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Container(
child: Image.asset(
paymentData.shippingOption
.shippingRateComputationMethodSystemName ==
"Shipping.FixedOrByWeight"
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,
),
margin: EdgeInsets.symmetric(horizontal: 8),
),
],
),
],
),
),
), // ic_shipping_mark.png
),
);
}
}
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
SelectPaymentOptionWidget(this.model);
@override
_SelectPaymentOptionWidgetState createState() =>
_SelectPaymentOptionWidgetState();
}
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) =>
{
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
widget.model.paymentCheckoutData.updateData();
}
})
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.paymentOption != null) {
paymentOption = widget.model.paymentCheckoutData.paymentOption;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: paymentOption == null
? InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase
.of(context)
.selectPaymentOption,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
decoration: new BoxDecoration(
color: Colors.grey.shade100,
shape: BoxShape.rectangle,
),
child: Image.asset(
widget.model.getPaymentOptionImage(paymentOption),
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
widget.model.getPaymentOptionName(paymentOption),
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Texts(
TranslationBase
.of(context)
.changeMethod,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
),
);
}
}
class LakumWidget extends StatefulWidget {
final OrderPreviewViewModel model;
LakumWidget(this.model);
@override
_LakumWidgetState createState() => _LakumWidgetState();
}
class _LakumWidgetState extends State<LakumWidget> {
TextEditingController _pointsController = new TextEditingController();
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
width: 30.0,
fit: BoxFit.scaleDown,
),
Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"${TranslationBase
.of(context)
.lakumPoints}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Texts(
"${widget.model.paymentCheckoutData.lacumInformation
.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
fontSize: 12,
fontWeight: FontWeight.normal,
),
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
"${TranslationBase
.of(context)
.riyal}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Container(
margin: projectProvider.isArabic
? EdgeInsets.only(right: 4)
: EdgeInsets.only(left: 4),
width: 60,
height: 50,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.2),
gapPadding: 0,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8))
: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.4),
gapPadding: 0,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
),
controller: _pointsController,
keyboardType: TextInputType.number,
style: TextStyle(
fontSize: 14,
color: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount >
0
? Colors.black
: Colors.grey,
),
enabled: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount ==
0
? false
: true,
onChanged: (val) {
var value = int.tryParse(val);
if (value != null &&
value <=
widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount) {
widget.model.paymentCheckoutData.usedLakumPoints =
value;
} else {
widget.model.paymentCheckoutData.usedLakumPoints = 0;
}
_pointsController.text =
"${widget.model.paymentCheckoutData.usedLakumPoints}";
},
),
),
Container(
height: 50,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: new BoxDecoration(
color: Color(0xff3666E0),
shape: BoxShape.rectangle,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topLeft: Radius.circular(6),
bottomLeft: Radius.circular(6))
: BorderRadius.only(
topRight: Radius.circular(6),
bottomRight: Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: Color(0xff3666E0),
width: 0.8,
)),
),
child: Texts(
"${TranslationBase
.of(context)
.use}",
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
);
}
}
class PaymentBottomWidget extends StatelessWidget {
final OrderPreviewViewModel model;
BuildContext context;
MyInAppBrowser browser;
PaymentBottomWidget(this.model);
@override
Widget build(BuildContext context) {
final scaffold = Scaffold.of(context);
this.context = context;
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Consumer<PaymentCheckoutData>(
builder: (ctx, paymentData, _) =>
paymentData.cartDataVisible
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
Texts(
"${TranslationBase
.of(context)
.sar} ${(model.cartResponse.subtotal)
.toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase
.of(context)
.inclusiveVat}",
fontSize: 8,
color: Color(0xff929295),
fontWeight: FontWeight.w600,
),
),
],
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase
.of(context)
.items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
Container(
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Color(0xff929295),
width: 1,
),
),
onPressed: (paymentData.address != null &&
paymentData.paymentOption != null)
? () async {
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message: "Order has been placed successfully!!");
openPayment(model.orderListModel[0], model.user);
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: new Text(
"${TranslationBase
.of(context)
.proceedPay}",
style: new TextStyle(
color: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.white
: Colors.grey.shade400,
fontWeight: FontWeight.bold,
fontSize: 12),
),
),
color: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.green
: Color(0xff929295),
disabledColor: (paymentData.address != null &&
paymentData.paymentOption != null)
? Colors.green
: Color(0xff929295),
),
),
],
),
)
: Container(),
),
);
}
openPayment(OrderDetailModel order,
AuthenticatedUser authenticatedUser,) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(
order,
order.orderTotal,
'ePharmacy Order',
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser
.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);
}
onBrowserLoadStart(String url) {
print("onBrowserLoadStart");
print(url);
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
});
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = false;
return;
}
});
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
} else {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
}
}
}

@ -0,0 +1,420 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class CartOrderPage extends StatefulWidget {
final Function(int) changeTab;
const CartOrderPage({Key key, this.changeTab}) : super(key: key);
@override
_CartOrderPageState createState() => _CartOrderPageState();
}
class _CartOrderPageState extends State<CartOrderPage> {
bool isLoading = true;
@override
void initState() {
super.initState();
getData();
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
OrderPreviewViewModel model = Provider.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
AppScaffold appScaffold;
return NetworkBaseView(
// baseViewModel: model,
isLoading: isLoading,
isLocalLoader: true,
child: AppScaffold(
appBarTitle: TranslationBase.of(context).shoppingCart,
isShowAppBar: true,
isPharmacy: true,
showHomeAppBarIcon: false,
isShowDecPage: true,
baseViewModel: model,
backButtonTab:
widget.changeTab != null ? () => widget.changeTab(0) : null,
backgroundColor: Colors.white,
body: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? Container(
height: height * 0.85,
width: double.infinity,
child: SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureIconButton(
TranslationBase.of(context).deleteAllItems,
Icon(
Icons.delete_outline_sharp,
color: Colors.grey.shade700,
),
onTap: () => {model.deleteShoppingCart()},
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
child: Column(
children: [
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) => ProductOrderItem(
model.cartResponse
.shoppingCarts[index], () {
print(model.cartResponse
.shoppingCarts[index].quantity);
model
.changeProductQuantity(model
.cartResponse
.shoppingCarts[index])
.then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
if (model.state ==
ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
}
});
}, () {
model
.deleteProduct(model.cartResponse
.shoppingCarts[index])
.then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
});
}))
],
),
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 2,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).subtotal,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Image.asset(
"assets/images/pharmacy_module/payment_image.png",
width: mediaQuery.size.width - 20,
height: 30.0,
fit: BoxFit.scaleDown,
),
SizedBox(
height: 120,
)
],
),
),
),
)
: 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(
TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
),
bottomSheet: Container(
height: !(model.cartResponse.shoppingCarts == null ||
model.cartResponse.shoppingCarts.length == 0)
? height * 0.15
: 0,
color: Colors.white,
child: OrderBottomWidget(model.addresses, height),
),
),
);
}
void getData() async {
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
}
class OrderBottomWidget extends StatefulWidget {
final List<Addresses> addresses;
final double height;
OrderBottomWidget(this.addresses, this.height);
@override
_OrderBottomWidgetState createState() => _OrderBottomWidgetState();
}
class _OrderBottomWidgetState extends State<OrderBottomWidget> {
bool isAgree = false;
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
OrderPreviewViewModel cart = Provider.of(context);
return !(cart.cartResponse.shoppingCarts == null ||
cart.cartResponse.shoppingCarts.length == 0)
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(
color: Color(0xFFD6D6D6),
height: 1,
thickness: 1,
indent: 0,
endIndent: 0,
),
Container(
height: widget.height * 0.070,
color: Color(0xffe6ffe0),
padding: EdgeInsets.symmetric(horizontal: 4),
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
isAgree = !isAgree;
});
},
child: Container(
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color: !isAgree ? Color(0xffeeeeee) : Colors.green,
shape: BoxShape.circle,
),
child: !isAgree
? null
: Padding(
padding: const EdgeInsets.all(0.0),
child: Icon(
Icons.check,
color: Colors.white,
size: 25,
),
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
margin: const EdgeInsets.symmetric(vertical: 4),
child: Texts(
TranslationBase.of(context)
.pharmacyServiceTermsCondition,
fontSize: 13,
color: Colors.grey.shade800,
fontWeight: FontWeight.normal,
),
),
),
InkWell(
onTap: () => {
Navigator.push(
context, FadePage(page: PharmacyTermsConditions()))
},
child: Container(
child: Icon(
Icons.info,
size: 25,
color: Color(0xff005aff),
),
),
),
],
),
),
Container(
height: widget.height * 0.065,
margin: EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.symmetric(
horizontal: 0, vertical: 0),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
],
),
),
Texts(
"${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
),
RaisedButton(
onPressed: isAgree
? () => {
Navigator.push(
context,
FadePage(
page:
OrderPreviewPage(widget.addresses)))
}
: null,
child: new Text(
"${TranslationBase.of(context).checkOut}",
style: new TextStyle(
color:
isAgree ? Colors.white : Colors.grey.shade300,
fontSize: 14),
),
color: Color(0xff005aff),
disabledColor: Color(0xff005aff),
),
],
),
),
],
)
: Container();
}
}

@ -0,0 +1,238 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'lakum_widget.dart';
class OrderPreviewPage extends StatefulWidget {
final List<Addresses> addresses;
OrderPreviewPage(this.addresses);
@override
_OrderPreviewPageState createState() => _OrderPreviewPageState();
}
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser;
bool isLoading = true;
@override
void initState() {
super.initState();
getData();
}
void getData() async {
if (isLoading)
await Provider.of<OrderPreviewViewModel>(context, listen: false)
.getShoppingCart();
setState(() {
isLoading = false;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
OrderPreviewViewModel model = Provider.of(context);
return AppScaffold(
appBarTitle: "${TranslationBase.of(context).checkOut}",
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
isLoading: isLoading,
isLocalLoader: true,
backgroundColor: Colors.white,
// baseViewModel: model,
body: Container(
color: Color(0xFFF1F1F1),
height: height * 0.90,
child: SingleChildScrollView(
child: Container(
color: Color(0xFFF1F1F1),
child: Column(
children: [
SelectAddressWidget(model, widget.addresses),
SizedBox(
height: 10,
),
SelectPaymentOptionWidget(model),
SizedBox(
height: 10,
),
model.paymentCheckoutData.lacumInformation != null
? Container(
child: Column(
children: [
LakumWidget(model),
SizedBox(
height: 10,
),
],
),
)
: Container(),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).reviewOrder,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
...List.generate(
model.cartResponse.shoppingCarts != null
? model.cartResponse.shoppingCarts.length
: 0,
(index) => ProductOrderPreviewItem(
model.cartResponse.shoppingCarts[index]),
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
child: model.cartResponse.subtotal != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).orderSummary,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).subtotal}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).shipping}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
"${TranslationBase.of(context).vat}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
],
),
const Divider(
color: Color(0xFFD6D6D6),
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).total,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
SizedBox(
height: 10,
),
],
)
: Container(),
),
SizedBox(
height: model.cartResponse.shoppingCarts != null
? height * 0.10
: 0,
)
],
),
),
),
),
bottomSheet: Container(
height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
color: Colors.white,
child: PaymentBottomWidget(model),
),
);
}
}

@ -0,0 +1,187 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class LakumWidget extends StatefulWidget {
final OrderPreviewViewModel model;
LakumWidget(this.model);
@override
_LakumWidgetState createState() => _LakumWidgetState();
}
class _LakumWidgetState extends State<LakumWidget> {
TextEditingController _pointsController = new TextEditingController();
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/lakum/lakum_checkout.png",
width: 30.0,
fit: BoxFit.scaleDown,
),
Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"${TranslationBase.of(context).lakumPoints}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Texts(
"${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
fontSize: 12,
fontWeight: FontWeight.normal,
),
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(color: Color(0x99ffffff)),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
"${TranslationBase.of(context).riyal}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
Container(
margin: projectProvider.isArabic
? EdgeInsets.only(right: 4)
: EdgeInsets.only(left: 4),
width: 60,
height: 50,
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.2),
gapPadding: 0,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8))
: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.black, width: 0.4),
gapPadding: 0,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8)),
),
),
controller: _pointsController,
keyboardType: TextInputType.number,
style: TextStyle(
fontSize: 14,
color: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount >
0
? Colors.black
: Colors.grey,
),
enabled: widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount ==
0
? false
: true,
onChanged: (val) {
var value = int.tryParse(val);
if (value != null &&
value <=
widget
.model
.paymentCheckoutData
.lacumInformation
.lakumInquiryInformationObjVersion
.pointsBalanceAmount) {
widget.model.paymentCheckoutData.usedLakumPoints =
value;
} else {
widget.model.paymentCheckoutData.usedLakumPoints = 0;
}
_pointsController.text =
"${widget.model.paymentCheckoutData.usedLakumPoints}";
},
),
),
Container(
height: 50,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: new BoxDecoration(
color: Color(0xff3666E0),
shape: BoxShape.rectangle,
borderRadius: projectProvider.isArabic
? BorderRadius.only(
topLeft: Radius.circular(6),
bottomLeft: Radius.circular(6))
: BorderRadius.only(
topRight: Radius.circular(6),
bottomRight: Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: Color(0xff3666E0),
width: 0.8,
)),
),
child: Texts(
"${TranslationBase.of(context).use}",
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
);
}
}

@ -0,0 +1,195 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PaymentBottomWidget extends StatelessWidget {
final OrderPreviewViewModel model;
BuildContext context;
MyInAppBrowser browser;
PaymentBottomWidget(this.model);
@override
Widget build(BuildContext context) {
final scaffold = Scaffold.of(context);
this.context = context;
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: orderPreviewViewModel.paymentCheckoutData.cartDataVisible
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin:
EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Color(0xff929295),
fontWeight: FontWeight.w600,
),
),
],
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
],
),
Container(
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Color(0xff929295),
width: 1,
),
),
onPressed: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? () async {
await model.makeOrder();
if (model.state == ViewState.Idle) {
AppToast.showSuccessToast(
message:
"Order has been placed successfully!!");
openPayment(
model.orderListModel[0], model.user);
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: new Text(
"${TranslationBase.of(context).proceedPay}",
style: new TextStyle(
color: (orderPreviewViewModel
.paymentCheckoutData.address !=
null &&
orderPreviewViewModel.paymentCheckoutData
.paymentOption !=
null)
? Colors.white
: Colors.grey.shade400,
fontWeight: FontWeight.bold,
fontSize: 12),
),
),
color:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
disabledColor:
(orderPreviewViewModel.paymentCheckoutData.address !=
null &&
orderPreviewViewModel
.paymentCheckoutData.paymentOption !=
null)
? Colors.green
: Color(0xff929295),
),
),
],
),
)
: Container(),
);
}
openPayment(
OrderDetailModel order,
AuthenticatedUser authenticatedUser,
) {
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(
order,
order.orderTotal,
'ePharmacy Order',
order.id,
order.billingAddress.email,
order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
authenticatedUser.patientID,
authenticatedUser,
browser);
}
onBrowserLoadStart(String url) {
print("onBrowserLoadStart");
print(url);
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
});
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
MyInAppBrowser.isPaymentDone = false;
return;
}
});
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (isPaymentMade) {
AppToast.showSuccessToast(
message: "شكراً\nPayment status for your order is Paid");
Navigator.pop(context);
Navigator.pop(context);
} else {
AppToast.showErrorToast(
message:
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
}
}
}

@ -0,0 +1,226 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SelectAddressWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final List<Addresses> addresses;
SelectAddressWidget(this.model, this.addresses);
@override
_SelectAddressWidgetState createState() => _SelectAddressWidgetState();
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Addresses address;
_navigateToAddressPage() {
Navigator.push(context, FadePage(page: PharmacyAddressesPage()))
.then((result) {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
/* setState(() {
if (result != null) {
address = result;
widget.model.paymentCheckoutData.address = address;
widget.model.getInformationsByAddress();
}
})*/
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.address != null) {
address = widget.model.paymentCheckoutData.address;
}
super.initState();
}
@override
Widget build(BuildContext context) {
OrderPreviewViewModel model = Provider.of(context);
return Container(
color: Colors.white,
child: address == null
? InkWell(
onTap: () => {_navigateToAddressPage()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_address.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_mark.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).shippingAddress,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToAddressPage()},
child: Texts(
TranslationBase.of(context).changeAddress,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.firstName} ${address.lastName}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
),
),
Row(
children: [
Container(
margin: const EdgeInsets.only(right: 8),
child: Icon(
Icons.phone,
size: 20,
color: Colors.black,
),
),
Texts(
"${address.phoneNumber}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
),
],
),
Container(
margin: EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
height: 2,
width: double.infinity,
child: Container(
color: Color(0xffefefef),
),
),
),
Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_shipping_truck.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
"${TranslationBase.of(context).shipBy}",
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Container(
child: Image.asset(
model.paymentCheckoutData.shippingOption == null
? ""
: model.paymentCheckoutData.shippingOption
.shippingRateComputationMethodSystemName ==
"Shipping.FixedOrByWeight"
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,
),
margin: EdgeInsets.symmetric(horizontal: 8),
),
],
),
],
),
),
), // ic_shipping_mark.png
);
}
}

@ -0,0 +1,146 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
SelectPaymentOptionWidget(this.model);
@override
_SelectPaymentOptionWidgetState createState() =>
_SelectPaymentOptionWidgetState();
}
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage()))
.then((result) => {
setState(() {
if (result != null) {
paymentOption = result;
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
}
})
});
}
@override
void initState() {
if (widget.model.paymentCheckoutData.paymentOption != null) {
paymentOption = widget.model.paymentCheckoutData.paymentOption;
}
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: paymentOption == null
? InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Expanded(
child: Container(
padding:
EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
TranslationBase.of(context).selectPaymentOption,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff0000ff),
),
),
),
Icon(
Icons.arrow_forward_ios,
size: 20,
color: Colors.grey.shade400,
),
],
),
),
)
: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
children: [
Image.asset(
"assets/images/pharmacy_module/ic_payment_option.png",
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 8),
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0),
decoration: new BoxDecoration(
color: Colors.grey.shade100,
shape: BoxShape.rectangle,
),
child: Image.asset(
widget.model.getPaymentOptionImage(paymentOption),
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
),
),
Expanded(
child: Container(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
widget.model.getPaymentOptionName(paymentOption),
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
InkWell(
onTap: () => {_navigateToPaymentOption()},
child: Texts(
TranslationBase.of(context).changeMethod,
fontSize: 12,
fontWeight: FontWeight.normal,
color: Color(0xff0000ff),
),
),
],
),
),
);
}
}

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
@ -17,9 +17,15 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BestSellerWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewButtons.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/PrescriptionsWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ShopByBrandWidget.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:provider/provider.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:rating_bar/rating_bar.dart';
@ -36,40 +42,25 @@ dynamic languageID;
List wishlistData;
class PharmacyPage extends StatefulWidget {
// final PharmacyProduct product;
// PharmacyPage(this.product);
@override
_PharmacyPageState createState() => _PharmacyPageState();
}
class _PharmacyPageState extends State<PharmacyPage> {
// dynamic wishlistVar;
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
// List<RecommendedProductModel> recommendedProductList = [];
List<ProductDetailViewModel> wishList = [];
var model;
// String ProductId="4561";
//String id ="3608";
String productId = "";
String id = "";
@override
void initState() {
checkWishlist();
// userInfo(widget.product.id, widget.product);
userInfo(id, product);
getLanguageID();
}
@override
Widget build(BuildContext context) {
return BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPharmacyHomeData(),
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return WillPopScope(
onWillPop: ()async{
return false;
},
child:BaseView<PharmacyModuleViewModel>(
onModelReady: (model) async {
await model.getSavedLanguage();
await model.getBannerList();
if(model.isLogin)
await orderPreviewViewModel.getShoppingCart();
},
allowAny: true,
builder: (_, model, wi) => AppScaffold(
title: "",
@ -81,868 +72,19 @@ class _PharmacyPageState extends State<PharmacyPage> {
width: double.infinity,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
BannerPager(model),
// GridViewButtons(model),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).myPrescription,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () {
Navigator.push(
context, FadePage(page: HomePrescriptionsPage()));
},
),
],
),
),
Container(
height: model.prescriptionsList.length > 0
? MediaQuery.of(context).size.height * 0.28
: 0,
padding:
EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0),
// height: MediaQuery.of(context).size.height * 0.28,
// width: 200.0,
// height: MediaQuery.of(context).size.height / 4 + 20,
margin: EdgeInsets.only(left: 10),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPrescription(),
builder: (_, model, wi) => model.prescriptionsList.length !=
0
// model.getPrescription();
? ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) {
return Container(
// width: 160.0,
height:
MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0,
),
color: Colors.white,
borderRadius: BorderRadius.circular(10.0)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(children: [
Container(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 10.0,
bottom: 15.0,
),
child: CircleAvatar(
radius: 30,
backgroundColor:
Colors.transparent,
child: Image.network(
model.prescriptionsList[index]
.doctorImageURL,
width: 60,
height: 60,
),
),
),
]),
// Column(
// // crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Container(
// margin: EdgeInsets.only(left: 1),
// padding: EdgeInsets.only(
// top: 10.0,
// left: 10.0,
// right: 3.0,
// bottom: 15.0,
// ),
// child: Image.network(
// model.prescriptionsList[index]
// .doctorImageURL,
// width: 60,
// height: 60,
// ),
// ),
// ]),
Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin:
EdgeInsets.only(left: 1),
padding: EdgeInsets.only(
left: 15.0, right: 15.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style:
BorderStyle.solid,
width: 4.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(
30.0)),
child: Text(
languageID == "ar"
? model.prescriptionsList[index].isInOutPatientDescriptionN.toString()
: model.prescriptionsList[index].isInOutPatientDescription.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)),
Row(children: <Widget>[
Image.asset(
'assets/images/Icon-awesome-calendar.png',
width: 30,
height: 30,
),
Text(
DateUtil.convertStringToDate(
model
.prescriptionsList[
index]
.appointmentDate
.toString())
.toString()
.substring(0, 10),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)
]),
],
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Row(children: <Widget>[
Text(
model.prescriptionsList[index]
.doctorTitle
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
model.prescriptionsList[index]
.doctorName
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
model.prescriptionsList[index]
.clinicDescription
.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.prescriptionsList[index]
.actualDoctorRate
.toDouble(),
// 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(),
),
),
// Container(
// margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(
// TranslationBase.of(context).recommended,
// bold: true,
// ),
// BorderedButton(
// TranslationBase.of(context).viewAll,
// hasBorder: true,
// borderColor: Colors.green,
// textColor: Colors.green,
// vPadding: 6,
// hPadding: 4,
// handler: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// RecommendedProductPage(productId : "2316")));
// },
// ),
// ],
// ),
// ),
// Container(
// height: model.recommendedProductList.length > 0
// ? MediaQuery.of(context).size.height * 0.32
// : 0,
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
//// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0),
//// margin: EdgeInsets.only(left: 10),
// child: BaseView<PharmacyModuleViewModel>(
// onModelReady: (model) =>
// model.getRecommendedProducts(productId),
// builder: (_, model, wi) => model
// .recommendedProductList.length !=
// null
// ? ListView.builder(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// physics: ScrollPhysics(),
// // physics: NeverScrollableScrollPhysics(),
// itemCount: model.recommendedProductList.length,
// itemBuilder: (context, index) {
// return Card(
// elevation: 2,
// shape: RoundedRectangleBorder(
// side: BorderSide(
// color: Colors.grey[300], width: 2),
// borderRadius: BorderRadius.circular(10)),
// margin: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 0,
// ),
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(
// Radius.circular(15),
// ),
// ),
// padding: EdgeInsets.symmetric(horizontal: 4),
// width: MediaQuery.of(context).size.width / 3,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Stack(children: [
// Container(
// child: Align(
// alignment: Alignment.topRight,
// child: //true
// itemID.contains(model.recommendedProductList[index].id)
// // !isInWishlist
// ? IconButton(
// icon: Icon(Icons
// .favorite_border),
// color: Colors.grey,
// iconSize: 30,
// onPressed: () {
// setState(() {
// addToWishlistFunction(
// itemID);
// });
// },
// )
// : IconButton(
// icon: Icon(
// Icons.favorite),
// color: Colors.red,
// iconSize: 30,
// onPressed: () {
// setState(() {
// deleteFromWishlistFunction(
// itemID);
// });
// },
// )
////
// ),
// ),
// Container(
// margin: EdgeInsets.fromLTRB(
// 0, 16, 10, 16),
// alignment: Alignment.center,
//// padding: EdgeInsets.only(left: 25, bottom: 20),
// child: (model.recommendedProductList[index].images != null &&
// model.recommendedProductList[index].images.length > 0)
// ? Image.network(
// model.recommendedProductList[index].images[0].src.toString(),
//// item.images[0].src,
// fit: BoxFit.cover,
// height: 60,
// )
// : Image.asset(
// "assets/images/no_image.png",
// fit: BoxFit.cover,
// height: 60,
// ),
// ),
// Container(
// width: model
// .recommendedProductList[
// index]
// .rxMessage !=
// null
// ? MediaQuery.of(context)
// .size
// .width /
// 5
// : 0,
// padding: EdgeInsets.all(4),
// decoration: BoxDecoration(
// color: Color(0xffb23838),
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(6)),
// ),
// child: Texts(
// model.recommendedProductList[index]
// .rxMessage !=
// null
// ? model
// .recommendedProductList[
// index]
// .rxMessage
// : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
// ),
// ]),
// Container(
// margin: EdgeInsets.symmetric(
// horizontal: 6,
// vertical: 0,
// ),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// languageID == "ar"
// ? model.recommendedProductList[index].namen
// : model.recommendedProductList[index].name,
// style: TextStyle(
// color: Colors.black,
// fontSize: 13.0,
//// fontWeight: FontWeight.bold,
// ),
// ),
// Padding(
//// padding: const EdgeInsets.only(top: 15, bottom: 10),
// padding: const EdgeInsets.only(
// top: 10, bottom: 5),
// child: Texts(
// "SAR ${model.recommendedProductList[index].price}",
// bold: true,
// fontSize: 14,
// ),
// ),
// ],
// ),
// ),
// Row(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: <Widget>[
// Container(
// padding:
// EdgeInsets.only(right: 10),
//// margin: EdgeInsets.only(left: 5),
// child: Align(
// alignment: Alignment.topLeft,
// child: RatingBar.readOnly(
// initialRating: model
// .recommendedProductList[
// index]
// .approvedRatingSum
// .toDouble(),
//// initialRating: productRate,
// size: 13.0,
// filledColor:
// Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon:
// Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
// ),
// ),
// Texts(
// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
//// bold: true,
// fontSize: 12,
// ),
// ]),
// ],
// ),
// ),
// );
// })
// : Container(
//// child: Text("NO DATA"),
// ),
// ),
// ),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).shopByBrands,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () => {
Navigator.push(
context, FadePage(page: ProductBrandsPage())),
},
),
],
),
),
Container(
height: 60,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ManufacturerItem(model.manufacturerList[i]),
scrollDirection: Axis.horizontal,
itemCount: model.manufacturerList.length,
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).recentlyViewed,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: "",
productType: 3,
),
),
);
},
),
],
),
),
Container(
height: model.lastVisitedProducts.length > 0
? MediaQuery.of(context).size.height / 4 + 20
: 0,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.lastVisitedProducts[i]),
scrollDirection: Axis.horizontal,
itemCount: model.lastVisitedProducts.length,
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).bestSellers,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () => {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: "",
productType: 4,
),
),
),
},
),
],
),
),
Container(
height: MediaQuery.of(context).size.height / 4 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i]),
scrollDirection: Axis.horizontal,
itemCount: model.bestSellerProduct.length,
),
),
],
GridViewButtons(model),
PrescriptionsWidget(),
ShopByBrandWidget(),
RecentlyViewedWidget(),
BestSellerWidget(),
],),
),
),
),
),
);
}
addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = true;
await x.addToWishlistData(itemID);
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = false;
await x.addToWishlistData(itemID);
}
checkWishlist() async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.checkWishlistData();
for (int i = 0; i < x.wishListItems.length; i++) {
// itemID = x.wishListItems[i].id;
print("-------------wishlist---------------");
print(itemID);
// print(product.id);
print(x.wishListItems[i].productId);
if (itemID == x.wishListItems[i].productId) {
isInWishlist = true;
// print('in wishlist');
break;
} else {
isInWishlist = false;
// print('not in wishlist');
}
}
}
Future userInfo(id, product) async {
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
itemID = id;
product = product;
checkWishlist();
}
print("customerId:$customerId");
return customerId;
}
}
class GridViewButtons extends StatelessWidget {
final PharmacyModuleViewModel model;
GridViewButtons(this.model);
@override
Widget build(BuildContext context) {
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
return Container(
child: SizedBox(
height: gridHeight,
child: GridView.count(
childAspectRatio: 2.2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
controller: new ScrollController(keepScrollOffset: false),
shrinkWrap: true,
padding: const EdgeInsets.all(4.0),
crossAxisCount: 2,
children: [
DashboardItem(
imageName: 'pharmacy_module/bg_1.png',
hasColorFilter: false,
opacity: 0.8,
child: GridViewCard(
TranslationBase.of(context).offersAndPromotions,
'assets/images/pharmacy_module/offer_icon.png', () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_2.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () {
model.checkUserIsActivated().then((isActivated) {
if (isActivated) {
Navigator.push(context, FadePage(page: LakumMainPage()));
} else {
Navigator.push(
context, FadePage(page: LakumActivationVidaPage()));
}
});
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_3.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).myPrescriptions,
'assets/images/pharmacy_module/prescription_icon.png', () {
Navigator.push(
context, FadePage(page: PharmacyAddressesPage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_4.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(
TranslationBase.of(context).searchAndScanMedication,
'assets/images/pharmacy_module/search_scan_icon.png',
() {}),
),
],
),
),
);
}
}
class DashboardItem extends StatelessWidget {
const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true})
: super(key: key);
final bool hasBorder;
final String imageName;
final Widget child;
final Function onTap;
final double width;
final double height;
final Color color;
final double opacity;
final bool hasColorFilter;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
height: height != null
? height
: MediaQuery.of(context).orientation == Orientation.portrait
? MediaQuery.of(context).size.height * 0.17
: MediaQuery.of(context).size.height * 0.35,
decoration: BoxDecoration(
color: !hasBorder
? color != null
? color
: HexColor('#050705').withOpacity(opacity)
: Colors.white,
borderRadius: BorderRadius.circular(6.0),
border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent),
image: imageName != null
? DecorationImage(
image: ExactAssetImage('assets/images/$imageName'),
fit: BoxFit.cover,
colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null,
)
: null,
),
child: Center(
child: child,
),
),
);
}
}
class GridViewCard extends StatelessWidget {
final String text;
final String cardImage;
final Function handler;
GridViewCard(this.text, this.cardImage, this.handler);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: Container(
child: Row(
children: [
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(6),
child: Texts(
text,
color: Colors.white,
fontSize: SizeConfig.textMultiplier * 1.5,
),
),
),
Row(
children: [
BorderedButton(
TranslationBase.of(context).viewAll,
handler: handler,
tPadding: 0,
bPadding: 0,
),
Expanded(child: Container()),
],
),
],
),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Image.asset(
cardImage,
fit: BoxFit.cover,
),
),
),
],
),
),
);
}
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
}
}
class test extends StatefulWidget {
@override
_testState createState() => _testState();
}
class _testState extends State<test> {
@override
Widget build(BuildContext context) {
return Container();
}
}
//addWishlistData() async {
// ProductDetailViewModel x = new ProductDetailViewModel();
// await wishlistData.add(x.checkWishlistData());
// print("-------------testWishlist---------------");
//
//}
// checkWishlist() async {
// ProductDetailViewModel x = new ProductDetailViewModel();
// wishlistVar = await x.checkWishlistData();
// print("wishlistVar>>>>>>>>>>>>>>>");
// print(wishlistVar);
//
// }

@ -0,0 +1,90 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
class AvailabilityInfo extends StatelessWidget {
final ProductDetailViewModel previousModel;
const AvailabilityInfo({Key key, this.previousModel}) : super(key: key);
@override
Widget build(BuildContext context) {
return previousModel.productLocationService.length == 0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noLocationAvailable,
),
)
: ListView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: previousModel.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Image.network(previousModel
.productLocationService[index].projectImageUrl),
),
SizedBox(
width: 10,
),
Expanded(
flex: 4,
child: Text(
previousModel.productLocationService[index]
.locationDescription +
"\n" +
convertCityName(
previousModel.productLocationService[0].cityName
.toString(),
),
style: TextStyle(fontSize: 12),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {},
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
),
],
),
Divider(height: 1.2, color: Colors.grey)
],
),
);
},
);
}
convertCityName(txt) {
String stringTxt;
String newTxt;
stringTxt = txt.toString();
newTxt = stringTxt.split('.')[1];
return newTxt;
}
}

@ -0,0 +1,56 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class DetailsInfo extends StatelessWidget {
final PharmacyProduct product;
const DetailsInfo({Key key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
child: Texts(
TranslationBase.of(context)
.description,
fontSize: 17,
color: Colors.grey,
),
),
SizedBox(
height: 10,
),
Divider(height: 1, color: Colors.grey),
SizedBox(
height: 15,
),
Container(
child: Texts(
projectViewModel.isArabic
? product.fullDescriptionn
: product
.fullDescription ??
"",
fontSize: 16,
),
),
SizedBox(
height: 20,
),
]),
);
}
}

@ -0,0 +1,47 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:flutter/material.dart';
class DiscountDescription extends StatelessWidget {
final PharmacyProduct product;
const DiscountDescription({Key key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 50,
color: Colors.yellowAccent,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerRight,
child: Text(
product
.discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
),
),
),
SizedBox(
width: 10,
),
Expanded(
flex: 0,
child: Container(
child: Image(
image: AssetImage(
'assets/images/offer.png'),
),
),
),
],
),
);
}
}

@ -0,0 +1,258 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../../../locator.dart';
import '../../../../../routes.dart';
import '../../cart-page/cart-order-page.dart';
import '../product-detail.dart';
class FooterWidget extends StatefulWidget {
final bool isAvailable;
final int maxQuantity;
final int minQuantity;
final int quantityLimit;
final PharmacyProduct item;
final Function addToCartFunction;
final ProductDetailViewModel model;
int quantity;
bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
{this.quantity,
this.isOverQuantity = false,
this.addToCartFunction,
this.model});
@override
_FooterWidgetState createState() => _FooterWidgetState();
}
class _FooterWidgetState extends State<FooterWidget> {
double quantityUI = 80;
bool showUI = false;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
width: double.infinity,
height: quantityUI,
child: Column(
children: [
showUI
? Container(
width: double.infinity,
height: 100,
color: Colors.white,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Quantity",
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
),
),
InkWell(
child: Icon(Icons.close, color: Colors.black),
onTap: () {
setState(() {
quantityUI = 80;
showUI = false;
});
},
)
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
Container(
height: 50.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
SizedBox(
width: 5,
),
for (int i = 1; i <= 10; i++)
QuantityBox(
label: i,
onTapFunc: onChangeValue,
isSelected: widget.quantity == i),
Container(
width: 100,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]),
color: Colors.white,
),
child: TextField(
decoration: InputDecoration(
labelText: ' Quantity # '),
onChanged: (text) {
if (int.tryParse(text) == null) {
text = '';
} else {
setState(() {
widget.quantity = int.parse(text);
if (widget.quantity >=
widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
}
});
}
},
),
),
],
),
)
],
),
),
)
: Container(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 70,
height: 50,
child: FlatButton(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 4,
child: Text(
widget.quantity.toString(),
style: TextStyle(fontSize: 20),
),
),
Expanded(
flex: 5,
child: Text(
TranslationBase.of(context).quantityShortcut,
style: TextStyle(fontSize: 16),
),
),
],
),
onPressed: () {
setState(() {
if (showUI) {
quantityUI = 80;
showUI = false;
} else {
quantityUI = 160;
showUI = true;
}
});
},
),
),
Container(
width: MediaQuery.of(context).size.width * 0.45,
child: SecondaryButton(
label: TranslationBase.of(context).addToCart.toUpperCase(),
disabled: !widget.isAvailable && widget.quantity == 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null,
disableColor: Color(0xFF4CAF50),
onTap: () async {
if (!authenticatedUserObject.isLogin) {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
} else
await widget.addToCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
},
fontWeight: FontWeight.w600,
borderColor: Color(0xFF4CAF50),
borderRadius: 3,
color: Color(0xFF4CAF50),
),
),
SizedBox(
width: 5,
),
Container(
width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton(
label: TranslationBase.of(context).buyNow.toUpperCase(),
disabled: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null,
onTap: () async {
await widget.addToCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
fontWeight: FontWeight.w600,
borderColor: Colors.grey[800],
borderRadius: 3,
disableColor: Colors.grey[700],
color: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null
? Colors.grey
: Colors.grey[800],
),
),
],
),
],
),
);
}
onChangeValue(int i) {
setState(() {
widget.quantity = i;
if (widget.quantity >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.quantity;
}
});
}
}

@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
class QuantityBox extends StatelessWidget {
final int label;
final bool isSelected;
final Function(int) onTapFunc;
QuantityBox({
Key key,
this.label,
this.onTapFunc, this.isSelected = false,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
InkWell(
child: Container(
decoration: BoxDecoration(
border: Border.all(color:isSelected?Colors.green: Colors.grey[300]),
color: Colors.white,
),
alignment: Alignment.center,
width: 50.0,
child: Text(
'$label',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
),
onTap:(){
onTapFunc(label);
}
),
SizedBox(
width: 5,
)
],
);
}
}

@ -0,0 +1,365 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'availability_info.dart';
import 'details_info.dart';
import 'discount_description.dart';
import 'footor/footer-widget.dart';
import 'shared/product_details_app_bar.dart';
String itemID;
PharmacyProduct specificationData;
class ProductDetailPage extends StatefulWidget {
final PharmacyProduct product;
ProductDetailPage(this.product);
@override
__ProductDetailPageState createState() => __ProductDetailPageState();
}
class __ProductDetailPageState extends State<ProductDetailPage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isTrue = true;
bool isDetails = true;
bool isReviews = false;
bool isAvailability = false;
String customerId;
bool isSelected = true;
bool isOverQuantity = false;
bool isInWishList = false;
int quantity = 0;
checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel model = new ProductDetailViewModel();
await model.checkWishlistData();
for (int i = 0; i < model.wishListItems.length; i++) {
if (itemID == model.wishListItems[i].product.id) {
isInWishList = true;
break;
} else {
isInWishList = false;
}
}
GifLoaderDialogUtils.hideDialog(context);
setState(() {});
}
void initState() {
quantity = 1;
specificationData = widget.product;
userInfo();
super.initState();
}
@override
void dispose() {
super.dispose();
}
void userInfo() async {
print(specificationData);
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
itemID = widget.product.id;
checkWishlist();
}
setState(() {});
}
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
allowAny: true,
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
customAppBar: ProductAppBar(
product: widget.product,
quantity: quantity,
model: model,
addToWishlistFunction: () async {
await addToWishlistFunction(itemID: itemID, model: model);
},
deleteFromWishlistFunction: () async {
await deleteFromWishlistFunction(itemID: itemID, model: model);
},
isInWishList:isInWishList,
addToCartFunction:addToCartFunction ,
),
body: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
color: Colors.white,
child: Column(
children: [
if (widget.product.images.isNotEmpty)
Container(
height: MediaQuery.of(context).size.height * .40,
child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
),
if (widget.product.discountDescription != null)
DiscountDescription(product: widget.product)
],
),
),
SizedBox(
height: 4,
),
Container(
color: Colors.white,
child: ProductNameAndPrice(
context,
widget.product,
customerId: customerId,
addToWishlistFunction: (item) {
addToWishlistFunction(itemID: item, model: model);
setState(() {});
},
deleteFromWishlistFunction: (item) {
deleteFromWishlistFunction(
itemID: item, model: model);
setState(() {});
},
notifyMeWhenAvailable: (context, itemId) {
notifyMeWhenAvailable(
itemId: itemId,
customerId: customerId,
model: model);
},
isInWishList: isInWishList,
),
),
SizedBox(
height: 6,
),
Container(
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(
vertical: 15, horizontal: 10),
child: Texts(
TranslationBase.of(context).specification,
fontSize: 15,
fontWeight: FontWeight.bold,
),
width: double.infinity,
),
// Divider(color: Colors.grey),
],
),
),
SizedBox(
height: 6,
),
Container(
// width: 500,
margin: EdgeInsets.only(bottom: 6),
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = true;
isReviews = false;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).details,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
CustomDivider(
color: isDetails
? Colors.green
: Colors.transparent,
)
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () async {
if (widget.product.approvedTotalReviews >
0) {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getProductReviewsData(
widget.product.id);
GifLoaderDialogUtils.hideDialog(
context);
} else {
model.clearReview();
}
setState(() {
isDetails = false;
isReviews = true;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
CustomDivider(
color: isReviews
? Colors.green
: Colors.transparent,
),
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getProductLocationData();
GifLoaderDialogUtils.hideDialog(context);
setState(() {
isDetails = false;
isReviews = false;
isAvailability = true;
});
},
child: Text(
TranslationBase.of(context).availability,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
CustomDivider(
color: isAvailability
? Colors.green
: Colors.transparent,
),
],
),
],
),
SizedBox(
height: 10,
),
isDetails
? DetailsInfo(
product: widget.product,
)
: isReviews
? ReviewsInfo(
product: widget.product,
previousModel: model,
)
: isAvailability
? AvailabilityInfo(
previousModel: model,
)
: Container(),
],
),
),
SizedBox(
height: 10,
),
RecommendedProducts(product: widget.product,productDetailViewModel: model,
addToWishlistFunction: (itemID) async {
await addToWishlistFunction(itemID: itemID, model: model);
}, deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction(itemID: itemID, model: model);
},)
],
),
),
bottomSheet: FooterWidget(
widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product,
quantity: quantity,
isOverQuantity: isOverQuantity,
addToCartFunction: addToCartFunction,
model: model,
),
));
}
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true;
await model.addToWishlistData(itemID);
setState(() {});
}
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = false;
await model.deleteWishlistData(itemID);
setState(() {});
}
addToCartFunction(
{quantity,
itemID,
ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context);
}
}
notifyMeWhenAvailable(
{itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId);
}

@ -0,0 +1,203 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../../../locator.dart';
import 'shared/icon_with_bg.dart';
class ProductNameAndPrice extends StatefulWidget {
BuildContext context;
PharmacyProduct item;
final customerId;
final bool isInWishList;
final Function notifyMeWhenAvailable;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
ProductNameAndPrice(this.context, this.item,
{this.customerId,
this.isInWishList,
this.notifyMeWhenAvailable,
this.addToWishlistFunction,
this.deleteFromWishlistFunction});
@override
_ProductNameAndPriceState createState() => _ProductNameAndPriceState();
}
class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
FractionallySizedBox(
widthFactor: 0.95,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(widget.item.price.toString() + " " + "SR",
fontWeight: FontWeight.bold, fontSize: 20),
Texts(
projectViewModel.isArabic
? widget.item.stockAvailabilityn
: widget.item.stockAvailability,
fontWeight: FontWeight.bold,
fontSize: 15,
color: widget.item.stockAvailability == 'Out of stock'
? Colors.red
: Colors.green,
),
// SizedBox(width: 20),
if (widget.authenticatedUserObject.isLogin)
widget.item.stockAvailability == 'Out of stock' &&
widget.customerId != null
? InkWell(
onTap: () => widget.notifyMeWhenAvailable(
context, widget.item.id),
child: Row(children: [
Texts(
TranslationBase.of(context).notifyMe,
decoration: TextDecoration.underline,
color: Colors.blue,
),
SizedBox(width: 4),
Icon(
FontAwesomeIcons.bell,
color: Colors.blue,
size: 15.0,
)
]),
)
: IconWithBg(
icon: !widget.isInWishList
? Icons.favorite_border
: Icons.favorite,
color: !widget.isInWishList
? Colors.white
: Colors.red[800],
onPress: () async {
{
if (widget.customerId != null) {
if (!widget.isInWishList) {
await widget
.addToWishlistFunction(widget.item.id);
} else {
await widget
.deleteFromWishlistFunction(widget.item.id);
}
} else {
return;
}
setState(() {});
}
},
)
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: projectViewModel.isArabic
? Alignment.topRight
: Alignment.topLeft,
child: Text(
projectViewModel.isArabic
? widget.item.namen
: widget.item.name,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
),
),
),
FractionallySizedBox(
widthFactor: 0.95,
child: Row(
children: [
Container(
child: Align(
alignment: Alignment.bottomLeft,
child: Row(
children: [
RatingBar.readOnly(
initialRating: double.parse(
widget.item.approvedRatingSum.toString()),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[400],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
SizedBox(
width: 10,
),
Texts(
"${widget.item.approvedRatingSum}",
fontWeight: FontWeight.bold,
fontSize: 12,
),
SizedBox(
width: 30,
),
Texts(
"(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})",
fontSize: 12,
),
SizedBox(
width: 70,
),
if (widget.item.rxMessage != null)
Row(
children: [
Text(
projectViewModel.isArabic
? widget.item.rxMessagen.toString()
: widget.item.rxMessage.toString(),
style: TextStyle(color: Colors.red, fontSize: 10),
),
SizedBox(
width: 5,
),
Icon(
FontAwesomeIcons.questionCircle,
color: Colors.red,
size: 15.0,
)
],
)
],
),
),
),
],
),
),
SizedBox(
height: 10,
),
],
);
}
}

@ -0,0 +1,346 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class RecommendedProducts extends StatefulWidget {
final PharmacyProduct product;
final String customerId;
final ProductDetailViewModel productDetailViewModel;
final bool isOverQuantity;
final bool isInWishList;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
RecommendedProducts(
{Key key,
this.product,
this.productDetailViewModel,
this.customerId,
this.isOverQuantity = false,
this.isInWishList = false,
this.addToWishlistFunction,
this.deleteFromWishlistFunction})
: super(key: key);
@override
_RecommendedProductsState createState() => _RecommendedProductsState();
}
class _RecommendedProductsState extends State<RecommendedProducts> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return SingleChildScrollView(
child: Container(
width: 410,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(top: 9),
width: 410,
color: Colors.white,
child: Texts(
TranslationBase.of(context).recommended,
fontWeight: FontWeight.bold, fontSize: 16
),
),
Container(
color: Colors.white,
height: 210,
margin: EdgeInsets.only(bottom: 75),
padding: EdgeInsets.only(bottom: 5),
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) =>
model.getRecommendedProducts(widget.product.id),
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: model.state== ViewState.BusyLocal?Container(
height: 80,
child: Center(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
):model.recommendedProductList.length != null
? ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model.recommendedProductList.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
RecommendedProductModel data =
model.recommendedProductList[index];
var json = data.toJson();
PharmacyProduct product =
new PharmacyProduct.fromJson(json);
await Navigator.pushReplacement(
context,
FadePage(
page: ProductDetailPage(product),
),
);
GifLoaderDialogUtils.hideDialog(context);
},
child: Card(
elevation: 2,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.grey[300], width: 2),
borderRadius: BorderRadius.circular(10),
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(15),
),
),
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(children: [
Container(
child: Align(
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(model.recommendedProductList[index].isinwishlist != true
? Icons.favorite_border : Icons.favorite),
color: model.recommendedProductList[index].isinwishlist != true
? Colors.grey : Colors.red,
onPressed: () async {
if (widget.authenticatedUserObject.isLogin
) {
if (!widget.isInWishList && model.recommendedProductList[index].isinwishlist != true) {
GifLoaderDialogUtils.showMyDialog(context);
await widget.addToWishlistFunction(model.recommendedProductList[index].id,
);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
model.recommendedProductList[index].isinwishlist = true;});
} else {
GifLoaderDialogUtils.showMyDialog(context);
await widget.deleteFromWishlistFunction(model.recommendedProductList[index].id,
);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
model.recommendedProductList[index].isinwishlist = false;
});
}
} else {
return;
}
setState(() {
// checkWishlist();
});
},
),
),
),
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 10, 16),
alignment: Alignment.center,
child: (model
.recommendedProductList[
index]
.images !=
null &&
model
.recommendedProductList[
index]
.images
.length >
0)
? Image.network(
model
.recommendedProductList[
index]
.images[0]
.src
.toString(),
fit: BoxFit.cover,
height: 60,
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: 60,
),
),
Container(
width: model
.recommendedProductList[
index]
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
),
),
child: model
.recommendedProductList[
index]
.rxMessage !=
null
? Texts(
projectViewModel.isArabic
? model
.recommendedProductList[
index]
.rxMessagen
: model
.recommendedProductList[
index]
.rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
: Texts(""),
),
]),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
projectViewModel.isArabic
? model
.recommendedProductList[
index]
.namen
: model
.recommendedProductList[
index]
.name,
style: TextStyle(
color: Colors.black,
fontSize: 13.0,
// fontWeight: FontWeight.bold,
),
),
Padding(
// padding: const EdgeInsets.only(top: 15, bottom: 10),
padding: const EdgeInsets.only(
top: 10, bottom: 5),
child: Texts(
"SAR ${model.recommendedProductList[index].price}",
bold: true,
fontSize: 14,
),
),
],
),
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
padding:
EdgeInsets.only(right: 10),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.recommendedProductList[
index]
.approvedRatingSum
.toDouble(),
size: 13.0,
filledColor:
Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon:
Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
Texts(
"(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})",
// bold: true,
fontSize: 12,
),
]),
],
),
),
),
);
})
: Container(
// color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Texts(
TranslationBase.of(context).nonRecommended,
color: Colors.black,
),
],
),
),
),
),
),
),
],
),
),
);
}
}

@ -0,0 +1,90 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class ReviewsInfo extends StatelessWidget {
final PharmacyProduct product;
final ProductDetailViewModel previousModel;
const ReviewsInfo({Key key, this.product, this.previousModel})
: super(key: key);
@override
Widget build(BuildContext context) {
return previousModel.productDetailService.length != 0 &&
previousModel.productDetailService[0].reviews.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: previousModel.productDetailService[0].reviews.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
child: Text(
previousModel.productDetailService[0]
.reviews[index].customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(left: 210),
child: RatingBar.readOnly(
initialRating: previousModel
.productDetailService[0].reviews[index].rating
.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
],
),
),
SizedBox(
height: 10,
),
Container(
child: Text(
previousModel
.productDetailService[0].reviews[index].reviewText,
style: TextStyle(fontSize: 20),
),
),
SizedBox(
height: 50,
),
Divider(height: 1, color: Colors.grey),
],
),
);
},
)
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noReviewsAvailable,
),
// Text('No Reviews Available'),
);
}
}

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
class CustomDivider extends StatelessWidget {
const CustomDivider({
Key key,
this.color,
}) : super(key: key);
final Color color;
@override
Widget build(BuildContext context) {
return Container(
width: 120,
height: 2,
color: color,
);
}
}

@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
class IconWithBg extends StatelessWidget {
final IconData icon;
final Color color;
final Function onPress;
const IconWithBg({Key key, this.icon, this.color, this.onPress})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30),
),
child: Center(
child: IconButton(
icon: Icon(icon, size: 20,),
color: color,
onPressed: () async {
onPress();
},
),
));
}
}

@ -0,0 +1,183 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../../../locator.dart';
import '../../../compare-list.dart';
import '../../cart-page/cart-order-page.dart';
import 'icon_with_bg.dart';
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
final PharmacyProduct product;
final ProductDetailViewModel model;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
final int quantity;
final bool isInWishList;
final Function addToCartFunction;
ProductAppBar(
{Key key,
this.product,
this.model,
this.addToWishlistFunction,
this.quantity,
this.deleteFromWishlistFunction,
this.isInWishList, this.addToCartFunction})
: super(key: key);
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: FractionallySizedBox(
widthFactor: 0.95,
child: Column(
children: [
SizedBox(
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
IconWithBg(
icon: Icons.arrow_back,
color: Colors.grey,
onPress: () {
Navigator.pop(context);
},
),
],
),
if (authenticatedUserObject.isLogin)
Row(
children: [
Stack(
children: [
IconWithBg(
icon: Icons.shopping_cart,
color: Colors.grey[800],
onPress: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
}),
if(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount !=0)
Positioned(
top:0, right: -1.0,
child: Container(
decoration: BoxDecoration(
color: Colors.red[800],
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.only(left: 5, right: 4.5),
height: 18,
child: Center(child: Texts(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)),
),
)
],
),
SizedBox(
width: 10,
),
IconWithBg(
icon: FontAwesomeIcons.ellipsisV,
color: Colors.grey,
onPress: () {
settingModalBottomSheet(context);
},
),
],
)
],
),
],
),
),
);
}
@override
Size get preferredSize => Size(double.maxFinite, 50);
settingModalBottomSheet(context) {
showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return Container(
child: new Wrap(
children: <Widget>[
if (product.stockAvailability != 'Out of stock')
new ListTile(
leading: Icon(Icons.shopping_cart),
title: Text(
TranslationBase.of(context).addToCart,
),
onTap: () async {
if (quantity > 0) {
{
await addToCartFunction(
quantity: quantity,
itemID: itemID,
model: model);
Navigator.of(context).pop();
}
} else {
AppToast.showErrorToast(
message: "you should add quantity");
}
}),
ListTile(
leading: Icon(
!isInWishList ? Icons.favorite_border : Icons.favorite,
color: !isInWishList ? Colors.white : Colors.red[800],
),
title: Text(
isInWishList
? TranslationBase.of(context).removeFromWishlist
: TranslationBase.of(context).addToWishlist,
),
onTap: () async {
if (isInWishList)
await deleteFromWishlistFunction();
else
await addToWishlistFunction();
Navigator.of(context).pop();
}),
ListTile(
leading: Icon(Icons.compare),
title: Text(
TranslationBase.of(context).compare,
),
onTap: () {
Provider.of<CompareList>(context, listen: false)
.addItem(specificationData);
Navigator.of(context).pop();
},
),
],
),
);
});
}
}

@ -45,6 +45,7 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
),
title: Container(
child: Row(
// widget.item.product.stock_quantity===0
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
@ -166,10 +167,22 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
"$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}",
fontSize: 12,
fontWeight: FontWeight.bold,
)
),
widget.item.product.stockQuantity == 0 ?
Texts(
projectProvider.isArabic
? widget.item.product.stockAvailabilityn
: widget.item.product.stockAvailability,
fontWeight: FontWeight.normal,
fontSize: 13,
color:Colors.red,
): Texts(""),
],
),
)
),
],
),
)

@ -1,6 +1,8 @@
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/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -12,8 +14,9 @@ import 'package:provider/provider.dart';
class ProductTileItem extends StatelessWidget {
final AppSharedPreferences sharedPref = AppSharedPreferences();
final PharmacyProduct item;
final double itemHeight;
ProductTileItem(this.item);
ProductTileItem(this.item, this.itemHeight);
void productOnClick(BuildContext ctx) {
_saveLastVisitProducts();
@ -23,6 +26,7 @@ class ProductTileItem extends StatelessWidget {
void _saveLastVisitProducts() async {
String lastVisited = "";
bool isIdExist = false;
List items = [];
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
@ -31,8 +35,27 @@ class ProductTileItem extends StatelessWidget {
if (id == item.id) {
isIdExist = true;
}
items.add(id);
});
}
if(items.length >= 15){
items.removeAt(0);
// lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), '');
}
lastVisited = "";
for(int i = items.length - 1; i >= 0; i--){
if (lastVisited == "") {
// it means there is no lastVisited yet
lastVisited = "${items[i]}";
} else {
// there is lastVisited id's and this product id is not found
lastVisited += ",${items[i]}";
}
}
if (!isIdExist) {
if (lastVisited == "") {
// it means there is no lastVisited yet
@ -41,8 +64,8 @@ class ProductTileItem extends StatelessWidget {
// there is lastVisited id's and this product id is not found
lastVisited += ",${item.id}";
}
sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited);
}
sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited);
}
@override
@ -51,75 +74,83 @@ class ProductTileItem extends StatelessWidget {
return InkWell(
onTap: () => productOnClick(context),
splashColor: Theme.of(context).primaryColor,
child: Card(
elevation: 2,
shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
child: Container(
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
border:Border.all(color: Colors.grey.shade300,width: 0.5),
borderRadius: BorderRadius.circular(8)
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: (item.images != null && item.images.length > 0)
? Image.network(
item.images[0].src,
fit: BoxFit.cover,
height: 80,
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: 80,
),
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 2.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: (item.images != null && item.images.length > 0)
? Image.network(
item.images[0].src,
fit: BoxFit.cover,
height: itemHeight / 2,
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: itemHeight / 2,
),
Container(
width: item.rxMessage != null
? MediaQuery.of(context).size.width / 5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
),
child: item.rxMessage != null ? Texts(
projectProvider.isArabic ? item.rxMessagen : item.rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
): Texts(""),
),
Container(
width: item.rxMessage != null
? MediaQuery.of(context).size.width / 5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
),
child: item.rxMessage != null
? Texts(
projectProvider.isArabic
? item.rxMessagen
: item.rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
],
: Texts(""),
)
],
),
SizedBox(height: 8,),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 6.0),
child: Texts(
projectProvider.isArabic ? item.namen : item.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
Container(
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
projectProvider.isArabic ? item.namen : item.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${item.price}",
bold: true,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
@ -129,24 +160,19 @@ class ProductTileItem extends StatelessWidget {
child: StarRating(
totalAverage: item.approvedTotalReviews > 0
? (item.approvedRatingSum.toDouble() /
item.approvedTotalReviews.toDouble())
.toDouble()
item.approvedTotalReviews.toDouble())
.toDouble()
: 0,
forceStars: true),
),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),*/
],
),
],
),
)
],
),
),
),
SizedBox(height: 5,),
],
),
),
);

@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
@ -43,7 +44,8 @@ class _BannerPagerState extends State<BannerPager> {
.mapIndexed(
(item, index) => InkWell(
onTap: () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
Navigator.push(
context, FadePage(page: OffersCategorisePage()));
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 1.0),
@ -55,10 +57,11 @@ class _BannerPagerState extends State<BannerPager> {
item,
fit: BoxFit.cover,
)
: Image.network(
item,
fit: BoxFit.cover,
),
: CachedNetworkImage(
imageUrl: item,
fit: BoxFit.fitWidth,
errorWidget: (context, url, error) =>
SizedBox()),
),
),
),

@ -0,0 +1,56 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../../final_products_page.dart';
import '../ProductTileItem.dart';
import 'ViewAllHomeWidget.dart';
class BestSellerWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<BestSellerViewModel>(
onModelReady: (model) => model.getBestSellerProducts(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).bestSellers,
FinalProductsPage(
id: "",
productType: 20,
)),
if (model.state != ViewState.BusyLocal)
Container(
height: MediaQuery.of(context).size.height / 3 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i], MediaQuery.of(context).size.height / 4 + 20),
scrollDirection: Axis.horizontal,
itemCount: model.bestSellerProduct.length,
),
) else
Container(
height: 80,
child: Center(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
),
],
),
),
));
}
}

@ -0,0 +1,81 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import '../../../offers_categorise_page.dart';
import 'GridViewCard.dart';
class GridViewButtons extends StatelessWidget {
final PharmacyModuleViewModel model;
GridViewButtons(this.model);
@override
Widget build(BuildContext context) {
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
return Container(
child: SizedBox(
height: gridHeight,
child: GridView.count(
childAspectRatio: 2.2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
controller: new ScrollController(keepScrollOffset: false),
shrinkWrap: true,
padding: const EdgeInsets.all(4.0),
crossAxisCount: 2,
children: [
DashboardItem(
imageName: 'pharmacy_module/bg_1.png',
hasColorFilter: false,
opacity: 0.8,
child: GridViewCard(
TranslationBase.of(context).offersAndPromotions,
'assets/images/pharmacy_module/offer_icon.png', () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_2.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () {
// model.checkUserIsActivated().then((isActivated) {
// if (isActivated) {
// Navigator.push(context, FadePage(page: LakumMainPage()));
// } else {
// Navigator.push(
// context, FadePage(page: LakumActivationVidaPage()));
// }
// });
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_3.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).myPrescriptions,
'assets/images/pharmacy_module/prescription_icon.png', () {
Navigator.push(
context, FadePage(page: HomePrescriptionsPage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_4.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(
TranslationBase.of(context).searchAndScanMedication,
'assets/images/pharmacy_module/search_scan_icon.png',
() {}),
),
],
),
),
);
}
}

@ -0,0 +1,84 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
class GridViewCard extends StatelessWidget {
final String text;
final String cardImage;
final Function handler;
GridViewCard(this.text, this.cardImage, this.handler);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: Container(
child: Row(
children: [
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(6),
child: Column(
children: [
Texts(
text,
color: Colors.white,
bold: true,
fontSize: SizeConfig.textMultiplier * 1.5,
),
],
),
),
),
Row(
children: [
BorderedButton(
TranslationBase.of(context).viewAll,
handler: handler,
tPadding: 0,
textColor: Color(0xFF5ab145),
bPadding: 0,
),
Expanded(child: Container()),
],
),
],
),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Image.asset(
cardImage,
fit: BoxFit.cover,
),
),
),
],
),
),
);
}
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
}
}

@ -0,0 +1,233 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class PrescriptionsWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionViewModel>(
onModelReady: (model) async {
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) {
model.getPrescription();
}
},
allowAny: true,
builder: (_, model, wi) => model.prescriptionsList.length > 0
? NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
height: model.prescriptionsList.length > 0
? MediaQuery.of(context).size.height * 0.28
: 0,
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).myPrescription,
HomePrescriptionsPage()),
Container(
padding: EdgeInsets.symmetric(
horizontal: 18.0, vertical: 14.0),
margin: EdgeInsets.only(left: 10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) {
return Container(
height: MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0,
),
color: Colors.white,
borderRadius: BorderRadius.circular(10.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(children: [
Container(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 10.0,
bottom: 15.0,
),
child: CircleAvatar(
radius: 30,
backgroundColor:
Colors.transparent,
child: Image.network(
model.prescriptionsList[index]
.doctorImageURL,
width: 60,
height: 60,
),
),
),
]),
Column(
children: [
Container(
margin:
EdgeInsets.only(left: 1),
padding: EdgeInsets.only(
left: 15.0, right: 15.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 4.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(
30.0)),
child: Text(
model.languageID == "ar"
? model
.prescriptionsList[
index]
.isInOutPatientDescriptionN
.toString()
: model
.prescriptionsList[
index]
.isInOutPatientDescription
.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
),
)),
Row(children: <Widget>[
Image.asset(
'assets/images/Icon-awesome-calendar.png',
width: 30,
height: 30,
),
Text(
DateUtil.convertStringToDate(
model
.prescriptionsList[
index]
.appointmentDate
.toString())
.toString()
.substring(0, 10),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
),
)
]),
],
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Row(children: <Widget>[
Text(
model.prescriptionsList[index]
.doctorTitle
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
model.prescriptionsList[index]
.doctorName
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
model.prescriptionsList[index]
.clinicDescription
.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.prescriptionsList[index]
.actualDoctorRate
.toDouble(),
// 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(),
);
}
}

@ -0,0 +1,59 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../../final_products_page.dart';
import '../ProductTileItem.dart';
import 'ViewAllHomeWidget.dart';
class RecentlyViewedWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<LastVisitedViewModel>(
onModelReady: (model) => model.getLastVisitedProducts(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: model.lastVisitedProducts.isNotEmpty ? Container(
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).recentlyViewed,
FinalProductsPage(
id: "",
productType: 3,
)),
if (model.state != ViewState.BusyLocal)
Container(
height: model.lastVisitedProducts.length > 0
? MediaQuery.of(context).size.height / 3 + 20
: 0,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.lastVisitedProducts[i], MediaQuery.of(context).size.height / 4 + 20),
scrollDirection: Axis.horizontal,
itemCount: model.lastVisitedProducts.length,
),
)
else
Container(
height: 80,
child: Center(
child:CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
),
],
),
) : Container(),
));
}
}

@ -0,0 +1,53 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../product-brands.dart';
import '../manufacturerItem.dart';
import 'ViewAllHomeWidget.dart';
class ShopByBrandWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<BrandViewModel>(
onModelReady: (model) => model.getTopManufacturerList(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: Column(
children: [
ViewAllHomeWidget(TranslationBase.of(context).shopByBrands,
ProductBrandsPage()),
if (model.state != ViewState.BusyLocal)
Container(
height: 150,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ManufacturerItem(model.manufacturerList[i]),
scrollDirection: Axis.horizontal,
itemCount: model.manufacturerList.length,
),
)
else
Container(
height: 80,
child: Center(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
),
],
),
),
));
}
}

@ -0,0 +1,46 @@
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
class ViewAllHomeWidget extends StatelessWidget {
final String title;
final Widget navigationWidget;
ViewAllHomeWidget(this.title, this.navigationWidget);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16, 10, 16, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
title,
bold: true,
fontSize: 16,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
fontWeight: FontWeight.bold,
vPadding: 6,
hPadding: 14,
handler: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
navigationWidget));
},
),
],
),
);
}
}

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
@ -23,28 +24,33 @@ class ManufacturerItem extends StatelessWidget {
),
);
},
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Container(
width: 100,
margin: EdgeInsets.symmetric(
horizontal: 8,
horizontal: 12,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
border: Border(
right: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: BorderSide(color: Colors.grey.shade300, width: 1),
left: BorderSide(color: Colors.grey.shade300, width: 1),
top: BorderSide(color: Colors.grey.shade300, width: 1)),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network(
item.image.src,
fit: BoxFit.cover,
),
),
decoration: BoxDecoration(
borderRadius:BorderRadius.circular(12) ,
border: Border(
right: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: BorderSide(color: Colors.grey.shade300, width: 1),
left: BorderSide(color: Colors.grey.shade300, width: 1),
top: BorderSide(color: Colors.grey.shade300, width: 1)),
),
child: item.image == null
? Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
alignment: Alignment.topCenter,
child: AppText(item.name, fontWeight: FontWeight.w500,fontSize: 14,),
)
: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network(
item.image.src,
fit: BoxFit.cover,
),
),
),
);
}

@ -5,68 +5,61 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
class WishlistPage extends StatefulWidget {
bool showBar;
WishlistPage(this.showBar);
@override
_WishlistPageState createState() => _WishlistPageState();
}
class _WishlistPageState extends State<WishlistPage> {
bool isTrue = true;
class WishlistPage extends StatelessWidget {
const WishlistPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<WishListViewModel>(
onModelReady: (model) => model.getWishlistData(),
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).wishlist,
isShowAppBar: widget.showBar,
isShowAppBar: true,
isShowDecPage: false,
isPharmacy: true,
baseViewModel: model,
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),
),
)
],
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),
),
),
],
child: Column(
children: [
Expanded(
flex: 20,
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.85, //250,
child: ProductCheckTypeWidget(model: model,),
),
),
],
),
),
),
);
}
}

@ -242,9 +242,10 @@ class _OrderPageState extends State<OrderPage>
color: Colors.blue[700],
borderRadius:
BorderRadius.circular(30.0)),
child: deliveredOrderList[index]
.orderStatusId ==
30
child: deliveredOrderList[index].orderStatusId == 30 ||
deliveredOrderList[index].orderStatusId == 997 ||
deliveredOrderList[index].orderStatusId == 994
// deliveredOrderList[index].orderStatusId == 30
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)
@ -507,9 +508,11 @@ class _OrderPageState extends State<OrderPage>
color: Colors.green,
borderRadius:
BorderRadius.circular(30.0)),
child: processingOrderList[index]
.orderStatusId ==
20
child: processingOrderList[index].orderStatusId == 20 ||
processingOrderList[index].orderStatusId == 995 ||
processingOrderList[index].orderStatusId == 998 ||
processingOrderList[index].orderStatusId == 999
// processingOrderList[index].orderStatusId == 20
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context)

@ -121,17 +121,40 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
),
color: getStatusBackgroundColor(),
borderRadius: BorderRadius.circular(30.0)),
child: Text(
child: model.orderListModel[0].orderStatusId == 30 ||
model.orderListModel[0].orderStatusId == 997 ||
model.orderListModel[0].orderStatusId == 994
// deliveredOrderList[index].orderStatusId == 30
? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
: Text(
languageID == "ar"
? model.orderListModel[0].orderStatusn
: model.orderListModel[0].orderStatus,
// TranslationBase.of(context).delivered,
? model.orderListModel[0].orderStatusn.toString()
: model.orderListModel[0].orderStatus.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
),
)
// Text(
// languageID == "ar"
// ? model.orderListModel[0].orderStatusn
// : model.orderListModel[0].orderStatus,
//// TranslationBase.of(context).delivered,
// style: TextStyle(
// color: Colors.white,
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
),
],
),

@ -33,8 +33,14 @@ class _AddAddressPageState extends State<AddAddressPage> {
} else {
_getCurrentLocation();
}
setState(() {
});
}
_getCurrentLocation() async {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
@ -42,9 +48,12 @@ class _AddAddressPageState extends State<AddAddressPage> {
}).catchError((e) {
_longitude = 0;
_latitude = 0;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
@ -59,8 +68,8 @@ class _AddAddressPageState extends State<AddAddressPage> {
body: Container(
height: height * 1,
child: PickupLocationFromMap(
latitude: _latitude,
longitude: _longitude,
latitude: _latitude??0,
longitude: _longitude??0,
isWithAppBar: false,
buttonColor: Color(0xFF5AB145),
buttonLabel: TranslationBase.of(context).save,

@ -78,6 +78,8 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
},
),
),
SizedBox(height: height * 0.10,)
],
),
),

@ -93,7 +93,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
},
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true,
isShowAppBar: false,
isShowDecPage: false,
isPharmacy: true,
body: user != null
@ -235,9 +235,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
WishlistPage(true)));
FadePage(page: WishlistPage()));
},
child: Column(
children: <Widget>[

@ -30,6 +30,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(),
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
AppScaffold(

@ -1,5 +1,7 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';

@ -0,0 +1,109 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'base/base_view.dart';
import 'package:provider/provider.dart';
class SubCategoriseModalsheet extends StatefulWidget {
String id;
String titleName;
SubCategoriseModalsheet({this.id, this.titleName});
@override
_SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName);
}
class _SubCategoriseModalsheetState extends State<SubCategoriseModalsheet> {
String id;
String titleName;
// List<CategoriseParentModel> categoriesList = [];
_SubCategoriseModalsheetState({this.id, this.titleName});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id),
builder: (_, model, wi) => AppScaffold(
// appBarTitle: titleName,
appBarTitle: TranslationBase.of(context).categorise,
isBottomBar: false,
isShowAppBar: true,
isPharmacy: true,
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: Container(
color: Colors.white,
child: Center(
child: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Padding(
padding: EdgeInsets.all(4.0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(projectViewModel.isArabic
? model.categoriseParent[index].namen
: model.categoriseParent[index].name),
SizedBox(
height: 10,
),
Divider(
thickness: 0.6,
color: Colors.black12,
)
],
),
onTap: () {
Navigator.push(
context,
FadePage(
page: SubCategorisePage(
title: model.categoriseParent[index].name,
id: model.categoriseParent[index].id,
parentId: id,
)),
);
},
),
),
);
}),
),
),
),
);
}
// getCatName() {
//
// if (widget.id == '1' )
// return Texts("text1");
// else if (widget.id == '2' )
// return Texts("text2");
// else if (widget.id == '3')
// return Texts("text3");
// else if (widget.id == '4' )
// return Texts("text4");
// }
}

@ -1,6 +1,11 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
@ -20,10 +25,14 @@ class SubCategorisePage extends StatefulWidget {
String title;
String parentId;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
SubCategorisePage({this.id, this.parentId, this.title});
@override
_SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId);
_SubCategorisePageState createState() =>
_SubCategorisePageState(id: id, title: title, parentId: parentId);
}
class _SubCategorisePageState extends State<SubCategorisePage> {
@ -51,7 +60,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
TextEditingController maxField = TextEditingController();
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: title,
isBottomBar: false,
isShowAppBar: true,
@ -83,7 +94,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png'
: parentId == '9'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png'
: parentId == '10'
: parentId ==
'10'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png'
: '',
fit: BoxFit.fill,
@ -95,12 +107,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
children: [
InkWell(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.all(10.0),
child: Container(
child: Texts(TranslationBase.of(context).viewCategorise),
child: Texts(TranslationBase.of(context)
.viewCategorise),
),
),
Icon(Icons.arrow_forward)
@ -112,21 +126,30 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
context: context,
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.89,
height:
MediaQuery.of(context).size.height *
0.89,
color: Colors.white,
child: Center(
child: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: model.subCategorise.length,
itemBuilder: (BuildContext context, int index) {
itemCount:
model.subCategorise.length,
itemBuilder: (BuildContext context,
int index) {
return Container(
child: Padding(
padding: EdgeInsets.all(8.0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Texts(model.subCategorise[index].name),
Texts(model
.subCategorise[
index]
.name),
Divider(
thickness: 0.6,
color: Colors.black12,
@ -137,8 +160,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: model.subCategorise[index].id,
page:
FinalProductsPage(
id: model
.subCategorise[
index]
.id,
),
),
);
@ -171,19 +198,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subCategorise.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
padding:
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 13.0),
padding: EdgeInsets.symmetric(
horizontal: 13.0),
child: Container(
height: 60.0,
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.orange.shade200.withOpacity(0.45),
color: Colors.orange.shade200
.withOpacity(0.45),
),
child: Center(
child: Icon(
@ -194,8 +225,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
),
Container(
width: MediaQuery.of(context).size.width * 0.17,
height: MediaQuery.of(context).size.height * 0.10,
width: MediaQuery.of(context)
.size
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center(
child: Texts(
model.subCategorise[index].name,
@ -256,16 +293,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
initialChildSize: 0.95,
maxChildSize: 0.95,
minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) {
builder: (BuildContext context,
ScrollController scrollController) {
return SingleChildScrollView(
controller: scrollController,
child: Container(
color: Colors.white,
height: MediaQuery.of(context).size.height * 1.95,
height: MediaQuery.of(context)
.size
.height *
1.95,
child: Column(
children: [
Padding(
padding: EdgeInsets.all(8.0),
padding:
EdgeInsets.all(8.0),
child: Row(
children: [
Icon(
@ -275,23 +317,30 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
width: 10.0,
),
Texts(
TranslationBase.of(context).refine,
TranslationBase.of(
context)
.refine,
// 'Refine',
fontWeight: FontWeight.w600,
fontWeight:
FontWeight.w600,
),
SizedBox(
width: 250.0,
),
InkWell(
child: Texts(
TranslationBase.of(context).closeIt,
TranslationBase.of(
context)
.closeIt,
// 'Close',
color: Colors.red,
fontWeight: FontWeight.w600,
fontWeight:
FontWeight.w600,
fontSize: 15.0,
),
onTap: () {
Navigator.pop(context);
Navigator.pop(
context);
},
),
],
@ -304,27 +353,39 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
ExpansionTile(
title: Texts(TranslationBase.of(context).categorise),
title: Texts(
TranslationBase.of(
context)
.categorise),
children: [
ProcedureListWidget(
model: model,
masterList: model.subCategorise,
removeHistory: (item) {
masterList: model
.subCategorise,
removeHistory:
(item) {
setState(() {
entityList.remove(item);
entityList
.remove(
item);
});
},
addHistory: (history) {
addHistory:
(history) {
setState(() {
entityList.add(history);
entityList.add(
history);
});
},
addSelectedHistories: () {
addSelectedHistories:
() {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) =>
isEntityListSelected(master),
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
)
],
),
@ -333,27 +394,40 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12,
),
ExpansionTile(
title: Texts(TranslationBase.of(context).brands),
title: Texts(
TranslationBase.of(
context)
.brands),
children: [
ProcedureListWidget(
model: model,
masterList: model.brandsList,
removeHistory: (item) {
masterList: model
.brandsList,
removeHistory:
(item) {
setState(() {
entityListBrands.remove(item);
entityListBrands
.remove(
item);
});
},
addHistory: (history) {
addHistory:
(history) {
setState(() {
entityListBrands.add(history);
entityListBrands
.add(
history);
});
},
addSelectedHistories: () {
addSelectedHistories:
() {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) =>
isEntityListSelectedBrands(master),
isEntityListSelected:
(master) =>
isEntityListSelectedBrands(
master),
)
],
),
@ -362,43 +436,69 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12,
),
ExpansionTile(
title: Texts(TranslationBase.of(context).price),
title: Texts(
TranslationBase.of(
context)
.price),
children: [
Container(
color: Color(0xffEEEEEE),
color: Color(
0xffEEEEEE),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment
.start,
children: [
Texts('Min'),
Texts(
'Min'),
Container(
color: Colors.white,
width: 200,
height: 40,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(),
color: Colors
.white,
width:
200,
height:
40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
),
controller: minField,
controller:
minField,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment
.start,
children: [
Texts('Max'),
Texts(
'Max'),
Container(
color: Colors.white,
width: 200,
height: 40,
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(),
color: Colors
.white,
width:
200,
height:
40,
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
),
controller: maxField,
controller:
maxField,
),
),
],
@ -413,20 +513,31 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.4,
height: MediaQuery.of(
context)
.size
.height *
0.4,
),
Padding(
padding: EdgeInsets.all(8.0),
padding:
EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Expanded(
child: Container(
width: 100,
child: Button(
label: TranslationBase.of(context).reset,
label: TranslationBase.of(
context)
.reset,
// 'Reset',
backgroundColor: Colors.red,
backgroundColor:
Colors
.red,
),
),
),
@ -436,37 +547,66 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container(
width: 200,
child: Button(
onTap: () async {
String categoriesId = "";
for (CategoriseParentModel category in entityList) {
if (categoriesId == "") {
categoriesId = category.id;
onTap:
() async {
String
categoriesId =
"";
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category
.id;
} else {
categoriesId = "$categoriesId,${category.id}";
categoriesId =
"$categoriesId,${category.id}";
}
}
String brandIds = "";
String
brandIds =
"";
for (CategoriseParentModel brand
in entityListBrands) {
if (brandIds == "") {
brandIds = brand.id;
if (brandIds ==
"") {
brandIds =
brand
.id;
} else {
brandIds = "$brandIds,${brand.id}";
brandIds =
"$brandIds,${brand.id}";
}
}
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils
.showMyDialog(
context);
await model.getFilteredSubProducts(
min: minField.text.toString(),
max: maxField.text.toString(),
categoryId: categoriesId,
brandId: brandIds);
GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context);
min: minField
.text
.toString(),
max: maxField
.text
.toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(
context);
},
label: TranslationBase.of(context).apply,
label: TranslationBase.of(
context)
.apply,
// 'Apply',
backgroundColor: Colors.green,
backgroundColor:
Colors
.green,
),
),
],
@ -533,22 +673,28 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
model.subProducts.isNotEmpty
? styleOne == true
? Container(
height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15,
height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 0.9,
),
itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) {
itemBuilder:
(BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: InkWell(
child: Card(
color: model.subProducts[index].discountName != null
color: model.subProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
@ -576,67 +722,118 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(110.0),
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(horizontal: 0),
width: MediaQuery.of(context).size.width / 3,
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
margin: EdgeInsets
.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model.subProducts[index].images.isNotEmpty
? model.subProducts[index].images[0].thumb
model
.subProducts[
index]
.images
.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model.subProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
padding:
EdgeInsets.all(4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Texts(
model.subProducts[index].rxMessage != null
? model.subProducts[index].rxMessage
model
.subProducts[
index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
),
),
],
),
Container(
margin: EdgeInsets.symmetric(
margin:
EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Texts(
model.subProducts[index].name,
model
.subProducts[
index]
.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
@ -646,21 +843,25 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row(
children: [
StarRating(
totalAverage:
model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model.subProducts[index].approvedRatingSum.toDouble() /
model.subProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars:
true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight
.w400,
)
],
),
@ -675,7 +876,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model.subProducts[index]),
page: ProductDetailPage(
model.subProducts[
index]),
)),
},
));
@ -683,11 +886,14 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
)
: Container(
height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122,
height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) {
itemBuilder:
(BuildContext context, int index) {
return InkWell(
child: Card(
child: Row(
@ -697,9 +903,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
Container(
decoration: BoxDecoration(),
decoration:
BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
padding:
EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
@ -707,11 +915,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
),
Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
margin: EdgeInsets
.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model.subProducts[index].images.isNotEmpty
? model.subProducts[index].images[0].thumb
model
.subProducts[
index]
.images
.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.contain,
height: 80,
@ -722,23 +941,45 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
Container(
width: model.subProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5.3
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
padding:
EdgeInsets.all(4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Texts(
model.subProducts[index].rxMessage != null
? model.subProducts[index].rxMessage
model
.subProducts[
index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
),
),
],
@ -752,19 +993,31 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
vertical: 0,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
SizedBox(
height: 4.0,
),
Container(
width: MediaQuery.of(context).size.width * 0.65,
width: MediaQuery.of(
context)
.size
.width *
0.65,
child: Texts(
model.subProducts[index].name,
model
.subProducts[
index]
.name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
fontWeight:
FontWeight.w500,
maxLines: 5,
),
),
@ -772,7 +1025,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: 8.0,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
@ -782,26 +1039,55 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row(
children: [
StarRating(
totalAverage:
model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model.subProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
widget.authenticatedUserObject.isLogin?
Container(
child: IconButton(
icon: Icon(Icons.shopping_cart,
size: 18,
color: Colors.blue,),
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(context);
if(model.subProducts[index].rxMessage == null){
await addToCartFunction(1, model.subProducts[index].id);
// GifLoaderDialogUtils.hideDialog(context);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);}
else{
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
}
GifLoaderDialogUtils.hideDialog(context);
}
),
):Container(),
],
),
),
@ -809,7 +1095,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model.subProducts[index]),
page: ProductDetailPage(
model.subProducts[index]),
)),
},
);
@ -851,7 +1138,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
}
bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id);
Iterable<CategoriseParentModel> history =
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) {
return true;
}
@ -859,10 +1147,15 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
}
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id);
Iterable<CategoriseParentModel> history =
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) {
return true;
}
return false;
}
addToCartFunction(quantity, itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID);
}
}

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart';
import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
class ProductDetailService extends BaseService {
@ -87,6 +88,9 @@ class ProductDetailService extends BaseService {
"language_id": 1
}
};
await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false,
onSuccess: (dynamic response, int statusCode) {
_addToCartModel.clear();
@ -97,7 +101,7 @@ class ProductDetailService extends BaseService {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: 'something went wrong please try again');
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
}, body: request);
}
@ -108,7 +112,7 @@ class ProductDetailService extends BaseService {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: 'something went wrong please try again');
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
});
}
@ -125,12 +129,13 @@ class ProductDetailService extends BaseService {
_wishListProducts.clear();
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
AppToast.showSuccessToast(message: 'You have added a product to the Wishlist');
});
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');
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
}, body: request);
}
@ -148,7 +153,8 @@ class ProductDetailService extends BaseService {
super.error = error;
});
}
Future delteItemFromWishlist(itemID) async {
Future deleteItemFromWishlist(itemID) async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
hasError = false;
await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist",
@ -157,9 +163,11 @@ class ProductDetailService extends BaseService {
response['shopping_carts'].forEach((item) {
_wishListProducts.add(Wishlist.fromJson(item));
});
AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist');
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage());
});
}

@ -28,6 +28,8 @@ class ReviewService extends BaseService {
_reviewList.clear();
response['reviews'].forEach((item) {
_reviewList.add(Review.fromJson(item));
print (response);
print (item['reviewText']);
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -51,9 +51,10 @@ class WishListService extends BaseService {
// }
Future getWishlist() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
//TODO we need to check why the customer id comes null
String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0";
hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?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) {

@ -1760,6 +1760,8 @@ class TranslationBase {
String get referralNumber => localizedValues['referralNumber'][locale.languageCode];
String get needPrescription => localizedValues['needPrescription'][locale.languageCode];
String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode];
String get requestID => localizedValues['requestID'][locale.languageCode];
String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode];
@ -1797,9 +1799,10 @@ class TranslationBase {
String get quantitySize => localizedValues['quantitySize'][locale.languageCode];
String get addToCart => localizedValues['addToCart'][locale.languageCode];
String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode];
String get addToWishlist =>
localizedValues['addToWishlist'][locale.languageCode];
String get removeFromWishlist =>
localizedValues['removeFromWishlist'][locale.languageCode];
String get buyNow => localizedValues['buyNow'][locale.languageCode];
String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode];
@ -2472,6 +2475,9 @@ class TranslationBase {
String get Latest => localizedValues["Latest"][locale.languageCode];
String get Tour => localizedValues["Tour"][locale.languageCode];
String get mostViewed => localizedValues["mostViewed"][locale.languageCode];
String get newProducts => localizedValues["newProducts"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
class GestureIconButton extends StatefulWidget {
GestureIconButton(
this.label,
this.icon, {
Key key,
this.onTap,
this.backgroundColor,
}) : super(key: key);
this.label,
this.icon, {
Key key,
this.onTap,
this.backgroundColor,
}) : super(key: key);
final String label;
final Widget icon;
@ -25,45 +25,48 @@ class _GestureIconButtonState extends State<GestureIconButton> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onLongPressStart: (_) =>
setState(() => _buttonLongPress = !_buttonLongPress),
onLongPressEnd: (_) =>
setState(() => _buttonLongPress = !_buttonLongPress),
child: Wrap(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: widget.backgroundColor != null
? widget.backgroundColor
: Colors.grey[200],
onTap: (){
setState(() {
_buttonLongPress = !_buttonLongPress;
});
widget.onTap();
},
// onLongPressStart: (_) =>
// setState(() => _buttonLongPress = !_buttonLongPress),
// onLongPressEnd: (_) =>
// setState(() => _buttonLongPress = !_buttonLongPress),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: widget.backgroundColor != null
? widget.backgroundColor
: Colors.grey[200],
),
color: widget.backgroundColor != null
? widget.backgroundColor
: Colors.grey.shade200,
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: widget.icon,
),
color: widget.backgroundColor != null
? widget.backgroundColor
: Colors.grey.shade200,
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: widget.icon,
),
Texts(
widget.label,
color: _buttonLongPress ? Colors.white : Colors.black,
),
],
),
Texts(
widget.label,
fontWeight: FontWeight.bold,
fontSize: 13.6,
color: _buttonLongPress ? Colors.white : Colors.black,
),
),
],
),
),
],
),
),
);
}

@ -27,7 +27,10 @@ class SecondaryButton extends StatefulWidget {
this.small = false,
this.disabled = false,
this.borderColor,
this.noBorderRadius = false})
this.noBorderRadius = false,
this.borderRadius,
this.disableColor,
this.fontWeight})
: super(key: key);
final String label;
@ -41,6 +44,10 @@ class SecondaryButton extends StatefulWidget {
final bool iconOnly;
final bool disabled;
final bool noBorderRadius;
final double borderRadius;
final Color disableColor;
final FontWeight fontWeight;
@override
_SecondaryButtonState createState() => _SecondaryButtonState();
@ -167,7 +174,8 @@ class _SecondaryButtonState extends State<SecondaryButton>
child: ClipRRect(
borderRadius: widget.noBorderRadius
? BorderRadius.all(Radius.circular(0.0))
: BorderRadius.all(Radius.circular(10.0)),
: BorderRadius.all(
Radius.circular(widget.borderRadius ?? 10.0), ),
child: Stack(
children: <Widget>[
Positioned(
@ -178,7 +186,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
height: 100,
decoration: BoxDecoration(
color: widget.disabled
? Colors.grey
? widget.disableColor ?? Colors.grey
: widget.color ?? Theme.of(context).buttonColor),
),
),
@ -241,6 +249,9 @@ class _SecondaryButtonState extends State<SecondaryButton>
color: widget.textColor,
fontSize: widget.small ? 12.0 : 14.0,
fontWeight: FontWeight.w600,
fontFamily: projectViewModel.isArabic
? 'Cairo'
: 'WorkSans'
),
),
)

@ -30,7 +30,7 @@ class StarRating extends StatelessWidget {
)
),
if (totalCount!=null)
SizedBox(width: 9.0),
SizedBox(width: 5.0),
if (totalCount!=null)
Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],)
]

@ -61,7 +61,7 @@ class PharmacyAppScaffold extends StatelessWidget {
),
title: Text(authenticatedUserObject.isLogin
? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle),
: appBarTitle.toUpperCase()),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack();

@ -4,8 +4,11 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -51,6 +54,8 @@ class AppScaffold extends StatelessWidget {
final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo;
final bool isHelp;
final bool isLocalLoader;
final Function backButtonTab;
final String icon;
final bool showDropDown;
final int dropdownIndexValue;
@ -61,6 +66,7 @@ class AppScaffold extends StatelessWidget {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar;
final Widget customAppBar;
AppScaffold({
@required this.body,
@ -95,6 +101,10 @@ class AppScaffold extends StatelessWidget {
this.dropdownIndexValue,
this.dropDownIndexChange,
this.onTap,
appBar,
this.customAppBar,
this.isLocalLoader = false,
this.backButtonTab
});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
@ -123,7 +133,12 @@ class AppScaffold extends StatelessWidget {
onTap: onTap,
)
: (isShowAppBar
? appBar = AppBarWidget(
?
customAppBar != null
? customAppBar
:
appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
@ -132,6 +147,7 @@ class AppScaffold extends StatelessWidget {
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
backButtonTab: backButtonTab,
)
: null)),
bottomSheet: bottomSheet,
@ -163,7 +179,18 @@ class AppScaffold extends StatelessWidget {
}
buildBodyWidget(context) {
return Stack(children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
return Stack(children: <Widget>[
Center(
child: isLoading
? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
)
: body),
isHelp == true ? RobotIcon() : Container()
]);
}
}
@ -263,6 +290,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
final bool showOfferPackagesCart;
final bool isShowDecPage;
final Function backButtonTab;
Function(String) badgeUpdater;
AppBarWidget(
@ -273,6 +301,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
this.showPharmacyCart = true,
this.isOfferPackages = false,
this.showOfferPackagesCart = false,
this.backButtonTab,
this.isShowDecPage = true});
@override
@ -285,8 +314,6 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
String _badgeText = "0";
class AppBarWidgetState extends State<AppBarWidget> {
String badgeText = "0";
@override
Widget build(BuildContext context) {
widget.badgeUpdater = badgeUpdateBlock;
@ -301,6 +328,8 @@ class AppBarWidgetState extends State<AppBarWidget> {
Widget buildAppBar(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return AppBar(
elevation: 0,
backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
@ -311,7 +340,9 @@ class AppBarWidgetState extends State<AppBarWidget> {
style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack();
return ArrowBack(
onTap: widget.backButtonTab,
);
},
),
centerTitle: true,
@ -329,8 +360,11 @@ class AppBarWidgetState extends State<AppBarWidget> {
icon: Badge(
position: BadgePosition.topStart(top: -15, start: -10),
badgeContent: Text(
_badgeText,
style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal),
orderPreviewViewModel.cartResponse.quantityCount.toString() /*_badgeText*/,
style: TextStyle(
fontSize: 9,
color: Colors.white,
fontWeight: FontWeight.normal),
),
child: Icon(Icons.shopping_cart)),
color: Colors.white,

@ -1,229 +0,0 @@
import 'package:diplomaticquarterapp/config/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/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
import '../progress_indicator/app_loader_widget.dart';
import 'network_base_view.dart';
import 'not_auh_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);
}

@ -8,8 +8,10 @@ import 'package:flutter/material.dart';
class NetworkBaseView extends StatefulWidget {
final BaseViewModel baseViewModel;
final Widget child;
final bool isLocalLoader;
final bool isLoading;
NetworkBaseView({Key key, this.baseViewModel, this.child});
NetworkBaseView({Key key, this.baseViewModel, this.child, this.isLocalLoader = false, this.isLoading});
@override
_NetworkBaseViewState createState() => _NetworkBaseViewState();
@ -29,7 +31,14 @@ class _NetworkBaseViewState extends State<NetworkBaseView>{
@override
Widget build(BuildContext context) {
return Container(
child: buildBaseViewWidget(),
child: (widget.baseViewModel!=null ) ?buildBaseViewWidget():Center(
child:widget.isLoading? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
):widget.child,
) ,
);
}
@ -41,7 +50,19 @@ class _NetworkBaseViewState extends State<NetworkBaseView>{
return widget.child;
break;
case ViewState.Busy:
return Container(
if(widget.isLocalLoader)
return Container(
height: 100,
child: Center(
child:CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
);
else return Container(
height: MediaQuery.of(context).size.height,
child: Stack(

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/d_q_icons_icons.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
@ -17,8 +18,6 @@ class BottomNavPharmacyBar extends StatefulWidget {
}
class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
int _index = 0;
_changeIndex(int index) {
widget.changeIndex(index);
}
@ -43,63 +42,36 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0,
title: TranslationBase.of(context).Alhabibapp,
),
Container(
height: 65.0,
child: Center(
child: VerticalDivider(
color: Colors.grey,
thickness: 0.5,
width: 0.3,
indent: 25.5,
),
),
),
BottomNavPharmacyItem(
icon: EvaIcons.list,
activeIcon: EvaIcons.list,
icon: DQIcons.categories_menu_icon,
activeIcon: DQIcons.categories_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 1,
title: TranslationBase.of(context).categorise,
),
// Expanded(
// child: SizedBox(
// height: 50,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// SizedBox(height: 22),
// ],
// ),
// ),
// ),
// Added Calendar Icon to access book appointment flow
BottomNavPharmacyItem(
icon: EvaIcons.heart,
activeIcon: EvaIcons.heart,
icon: EvaIcons.home,
activeIcon: EvaIcons.home,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 2,
title: TranslationBase.of(context).wishList),
currentIndex: 0,
isHome: true,
title: TranslationBase.of(context).home),
BottomNavPharmacyItem(
icon: EvaIcons.person,
activeIcon: EvaIcons.person,
icon: DQIcons.user_menu_icon,
activeIcon: DQIcons.user_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 3,
currentIndex: 2,
title: TranslationBase.of(context).myAccount,
),
BottomNavPharmacyItem(
icon: EvaIcons.shoppingCart,
activeIcon: EvaIcons.shoppingCart,
icon: DQIcons.cart_menu_icon,
activeIcon: DQIcons.cart_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 4,
currentIndex: 3,
title: TranslationBase.of(context).cart)
],
),

@ -59,16 +59,16 @@ class BottomNavHomeItem extends StatelessWidget {
Container(
child: Image.asset(
'assets/images/habib-logo.png',
height: 35.0,
),
height: 22.0,
),
SizedBox(
height: 11,
height: 9,
),
Texts(
title,
textAlign: TextAlign.center,
color: currentIndex == index ? secondaryColor : Colors.grey,
textAlign: TextAlign.start,
color: currentIndex == index ? Colors.grey : Colors.grey,
fontSize: 11,
),
// Added TextAlign Property

@ -1,6 +1,15 @@
import 'package:diplomaticquarterapp/Constants.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
class BottomNavPharmacyItem extends StatelessWidget {
final String title;
@ -10,6 +19,7 @@ class BottomNavPharmacyItem extends StatelessWidget {
final int index;
final int currentIndex;
final Function onTap;
final bool isHome;
final IconData activeIcon;
BottomNavPharmacyItem(
@ -19,54 +29,103 @@ class BottomNavPharmacyItem extends StatelessWidget {
this.currentIndex,
this.activeIcon,
this.title,
this.onTap});
this.onTap,
this.isHome = false});
@override
Widget build(BuildContext context) {
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
ProjectViewModel projectViewModel = Provider.of(context);
return Expanded(
child: SizedBox(
// height: 72.0,
child: Material(
type: MaterialType.transparency,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () => changeIndex(currentIndex),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 15,
),
currentIndex == index
? Divider(
color: Color(0xff5AB145),
thickness: 3.5,
)
: Divider(
thickness: 0,
),
Container(
child: Icon(currentIndex == index ? activeIcon : icon,
color:
currentIndex == index ? secondaryColor : Colors.grey,
size: 22.0),
),
SizedBox(
height: 11,
),
child: Stack(
clipBehavior: Clip.none,
children: [
Material(
type: MaterialType.transparency,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
if (!Provider.of<ProjectViewModel>(context, listen: false)
.isLogin &&
(currentIndex == 2 || currentIndex == 3))
Navigator.push(
context,
FadePage(page: WelcomeLogin()),
);
else
changeIndex(currentIndex);
},
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 15,
),
currentIndex == index
? Divider(
color: Color(0xff5AB145),
thickness: 3.5,
)
: Divider(
thickness: 0,
),
Container(
child: Icon(currentIndex == index ? activeIcon : icon,
color: isHome
? Color(0xff5AB145)
: currentIndex == index
? Colors.grey
: Colors.grey,
size: 22.0),
),
SizedBox(
height: 11,
),
// Added TextAlign Property
Texts(
title,
textAlign: TextAlign.center,
color: currentIndex == index ? secondaryColor : Colors.grey,
fontSize: 11,
// Added TextAlign Property
Texts(
title,
textAlign: TextAlign.center,
color: currentIndex == index ? Colors.grey : Colors.grey,
fontWeight: currentIndex == index
? FontWeight.bold
: FontWeight.w400,
fontSize: currentIndex == index ? 13 : 11,
),
],
),
],
),
),
),
if (currentIndex == 3 &&
Provider.of<OrderPreviewViewModel>(context, listen: false)
.cartResponse
.quantityCount !=
0)
Positioned(
top: 11.5,
right: -4.5,
child: Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.only(left: 7, right: 6.5),
height: 18,
child: Center(
child: Texts(
orderPreviewViewModel.cartResponse.quantityCount.toString(),
style: "caption",
medium: true,
color: Colors.white,
)),
),
)
],
),
),
);

@ -0,0 +1,50 @@
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/flutter_svg.dart';
class AccountItem extends StatelessWidget {
final String title;
final String itemIcon;
final bool isTerms;
const AccountItem({this.title, this.itemIcon, this.isTerms = false});
@override
Widget build(BuildContext context) {
return Row(
children: <Widget>[
isTerms == false
? Container(
height: 35.0,
width: 35.0,
child: SvgPicture.asset(
'$itemIcon',
width: 35,
height: 35,
),
)
: Container(
height: 35.0,
width: 35.0,
child: Image.asset(
'$itemIcon',
width: 35,
height: 35,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
width: 20,
),
Texts(
title,
fontSize: 15.0,
),
],
)
],
);
}
}

@ -0,0 +1,52 @@
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class AccountServices extends StatelessWidget {
final String title;
final String serviceImage;
final Function onTap;
const AccountServices({this.title, this.onTap, this.serviceImage});
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onTap,
// () {
// if (customerId == null) {
// AppToast.showErrorToast(
// message: "Customer not found");
// return;
// }
// Navigator.push(
// context,
// FadePage(
// page: OrderPage(
// customerID: customerId)));
// },
child: Column(
children: <Widget>[
// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
SvgPicture.asset(
'$serviceImage',
width: 55,
height: 55,
),
SizedBox(
height: 7,
),
Texts(
title,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
],
),
),
);
}
}

@ -1,6 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
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/pharmacies/screens/cart-page/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';

Loading…
Cancel
Save