Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into fatima-new

# Conflicts:
#	lib/config/config.dart
#	lib/pages/parent_categorise_page.dart
#	lib/pages/pharmacies/screens/pharmacy_module_page.dart
#	lib/pages/pharmacies/wishlist.dart
merge-requests/425/head
Fatimah Alshammari 4 years ago
commit 8baad999c5

@ -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

@ -13,16 +13,16 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
//const BASE_URL = 'https://uat.hmgwebservices.com/';
// 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 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/';
const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';
@ -551,8 +551,8 @@ 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 =

@ -74,7 +74,10 @@ const Map localizedValues = {
'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'},
'search': {'en': 'Search', 'ar': 'بحث'},
'noResultFound': {'en': 'No Result Found', 'ar': 'المنتج غير موجود'},
'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'},
'pleaseEnterProductName': {
'en': 'Please Enter Product Name',
'ar': 'ادخل اسم المنتج'
},
'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'},
'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'},
'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'},
@ -621,7 +624,10 @@ const Map localizedValues = {
"DepositorName": {"en": "Depositor Name", "ar": "اسم المودع *"},
"MobileNumber": {"en": "Mobile Number", "ar": "رقم الجوال"},
"Ok": {"en": "Ok", "ar": "حسنا"},
"averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"},
"averageWaitingTime": {
"en": "Average Waiting Time:",
"ar": "متوسط ​​وقت الانتظار:"
},
"WaterConsumedInWeek": {
"en": "Water consumed in a week",
"ar": "معدل شرب الماء خلال الاسبوع"
@ -724,7 +730,7 @@ const Map localizedValues = {
"products": {"en": "Products", "ar": "المنتجات"},
"reviews": {"en": "Reviews", "ar": "التقيمات"},
"brands": {"en": "Brands", "ar": "العلامات التجارية"},
"productDetails": {"en": "Product Details", "ar": "تفاصيل المنتج"},
"productDetails": {"en": "Product Details", "ar": "تفاصيل المنتج"},
// "medicationRefill": {"en": "Medication Refill", "ar": "تعبئة الأدوية"},
"pillReminder": {"en": "Pill Reminder", "ar": "تذكير الأدويه"},
"shippingAddresses": {"en": "Shipping Addresses", "ar": "عناوين الشحن"},
@ -898,10 +904,7 @@ const Map localizedValues = {
"myAccount": {"en": "My Account", "ar": "حسابي"},
"cart": {"en": "Cart", "ar": "التسوق"},
"Alhabibapp": {"en": "Al habib app", "ar": "تطبيق الحبيب"},
"searchProductHere": {
"en": "Search Product here",
"ar": "البحث عن منتج"
},
"searchProductHere": {"en": "Search Product here", "ar": "البحث عن منتج"},
"HHCNotAuthMsg": {
"en":
"This service provides a set of home health care services, continuous and comprehensive follow-up in their places of residence for those who cannot access health facilities, such as (laboratory analyzes - radiology - vaccinations - physical therapy), etc.",
@ -1552,6 +1555,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": "إشتري الان"},
@ -2239,39 +2243,55 @@ const Map localizedValues = {
"ar": "وقت المواعيد الكلي:"
},
"info-eye": {
"en": "This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.",
"ar": " خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية."
"en":
"This service allows you to view all the eye measurements, lenses, and eyeglasses that have been made in the Habib Medical Group.",
"ar":
" خدمة قياسات النظر: هذه الخدمة تمكنك من الاطلاع على جميع قياسات النظر والعدسات والنظارات التي تمت في مجموعة الحبيب الطبية."
},
"info-vaccines": {
"en": "This service allows you to view all the vaccinations that were taken in Al Habib Medical Group.",
"ar": "خدمة تطعيماتي: هذه الخدمة تمكنك من الاطلاع على جميع التطعيمات التي تمت في مجموعة الحبيب الطبية."
"en":
"This service allows you to view all the vaccinations that were taken in Al Habib Medical Group.",
"ar":
"خدمة تطعيماتي: هذه الخدمة تمكنك من الاطلاع على جميع التطعيمات التي تمت في مجموعة الحبيب الطبية."
},
"info-trackers": {
"en": "This service allows you to record the readings of the measurement of sugar, pressure, and weight and then refer to them as a reference in addition to view the statistics charts.",
"ar": "متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة."
"en":
"This service allows you to record the readings of the measurement of sugar, pressure, and weight and then refer to them as a reference in addition to view the statistics charts.",
"ar":
"متابعة قراءاتي: هذه الخدمة تمكنك من تسجيل قراءات قياس السكر والضغط والوزن بشكل دوري ومن ثم الاطلاع عليها كمرجع وكذلك الاطلاع على الرسوم البيانية لمتابعة تطور الحالة."
},
"info-health-data": {
"en": "This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.",
"ar": "تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك."
"en":
"This service is designed to allows you to synchronize the health data from your smart watches into your health record system in Habib Medical Group so that the doctors you are visiting can analyze your health & activity level.",
"ar":
"تم تصميم هذه الخدمة للسماح لك بمزامنة البيانات الصحية من ساعاتك الذكية الى نظام السجلات الصحية الخاص بك في مجموعة حبيب الطبية حتى يتمكن الأطباء الذين تزورهم من تحليل مستوى صحتك ونشاطك."
},
"info-ask-doc": {
"en": "This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.",
"ar": "اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب."
"en":
"This service allows you to ask the doctor you have visited during the last 14 days. When you receive a response from the doctor, you will be notified via the system to view the doctor's reply.",
"ar":
"اسال طبيبك: هذه الخدمة تمكنك من توجيه استفسارات الى الطبيب الذي قمت بزيارته خلال اخر 14 يوم وكذلك عند تلقى الرد من الطبيب سوف يتم ابلاغك عن طريق النظام للاطلاع على رد الطبيب."
},
"info-auto-wifi": {
"en": "This service allows you to connect to the Internet directly without the need for entering a user name or password.",
"ar": "الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور."
},
"auto-wifi": {
"en": "Connect To Internet",
"ar": "الإتصال بالإنترنت"
"en":
"This service allows you to connect to the Internet directly without the need for entering a user name or password.",
"ar":
"الاتصال بالانترنت: هذه الخدمة تمكنك من الاتصال بالانترنت مباشرة دون الحاجة الى اسم مستخدم او كلمة مرور."
},
"auto-wifi": {"en": "Connect To Internet", "ar": "الإتصال بالإنترنت"},
"child-vaccine-info": {
"en": "This service to remind you of the deadlines of the necessary vaccinations for your childs against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.",
"ar": "هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل."
"en":
"This service to remind you of the deadlines of the necessary vaccinations for your childs against diseases targeted by immunization according to the MOH vaccinations schedule by sending a reminding message and notifications of the vaccination date to the registered mobile phone.",
"ar":
"هذه الخدمة تم تصميمها لتذكيرك بالمواعيد النهائية للتحصينات اللازمة لطفلك ضد الأمراض المستهدفة بالتحصين وفقًا لجدول تطعيمات وزارة الصحة عن طريق إرسال رسالة تذكير وإشعارات عن مواعيد التطعيم على الجوال المسجل."
},
"h2o-info": {
"en": "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.",
"ar": "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر."
"en":
"This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.",
"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'];

@ -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 {
@ -49,10 +50,14 @@ class BaseAppClient {
//Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
var pharmacyToken = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN);
var user = await sharedPref.getObject(USER_PROFILE);
Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'};
Map<String, String> headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
if (!isExternal) {
String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
@ -69,11 +74,12 @@ class BaseAppClient {
body['generalid'] = GENERAL_ID;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
@ -96,7 +102,9 @@ class BaseAppClient {
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientID'] = body['PatientID'] != null
? body['PatientID']
: user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['PatientOutSA'] = body.containsKey('PatientOutSA')
? body['PatientOutSA'] != null
@ -109,7 +117,10 @@ class BaseAppClient {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': pharmacyToken,
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Mobilenumber': user != null
? Utils.getPhoneNumberWithoutZero(
user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user['PatientID'].toString(),
};
@ -122,7 +133,8 @@ class BaseAppClient {
print(jsonBody);
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: headers);
final response = await http.post(url.trim(),
body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -134,7 +146,8 @@ class BaseAppClient {
onSuccess(parsed, statusCode);
} else {
if (parsed['ErrorType'] == 4) {
navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']);
navigateToAppUpdate(
AppGlobal.context, parsed['ErrorEndUserMessage']);
}
if (isAllowAny) {
onSuccess(parsed, statusCode);
@ -149,24 +162,34 @@ class BaseAppClient {
if (parsed != null) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
}
} else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
} else if (parsed['MessageStatus'] == 2 &&
parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message", statusCode);
onFailure("Server Error found with no available message",
statusCode);
} else {
onFailure(parsed['ErrorSearchMsg'], statusCode);
}
} else {
onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
}
}
} else if (!parsed['IsAuthenticated']) {
@ -180,7 +203,9 @@ class BaseAppClient {
if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
}
@ -217,13 +242,16 @@ class BaseAppClient {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Mobilenumber': user != null
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
};
if (!isExternal) {
String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
@ -245,11 +273,12 @@ class BaseAppClient {
: PATIENT_OUT_SA;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
@ -272,7 +301,9 @@ class BaseAppClient {
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientID'] = body['PatientID'] != null
? body['PatientID']
: user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = SESSION_ID; //getSe
headers = {
@ -291,7 +322,8 @@ class BaseAppClient {
print("Body : ${json.encode(body)}");
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: headers);
final response = await http.post(url.trim(),
body: json.encode(body), headers: headers);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -303,7 +335,8 @@ class BaseAppClient {
onSuccess(parsed, statusCode);
} else {
if (parsed['ErrorType'] == 4) {
navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']);
navigateToAppUpdate(
AppGlobal.context, parsed['ErrorEndUserMessage']);
}
if (isAllowAny) {
onSuccess(parsed, statusCode);
@ -318,24 +351,34 @@ class BaseAppClient {
if (parsed != null) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
}
} else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
} else if (parsed['MessageStatus'] == 2 &&
parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode);
} else {
if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message", statusCode);
onFailure("Server Error found with no available message",
statusCode);
} else {
onFailure(parsed['ErrorSearchMsg'], statusCode);
}
} else {
onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
}
}
} else if (!parsed['IsAuthenticated']) {
@ -349,7 +392,9 @@ class BaseAppClient {
if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
}
@ -365,7 +410,8 @@ class BaseAppClient {
}
Future navigateToAppUpdate(context, String text) async {
Navigator.pushReplacement(context, FadePage(page: AppUpdatePage(appUpdateText: text)));
Navigator.pushReplacement(
context, FadePage(page: AppUpdatePage(appUpdateText: text)));
}
get(String endPoint,
@ -389,7 +435,10 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
final response = await http.get(
url.trim(),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
@ -433,16 +482,20 @@ class BaseAppClient {
'Content-Type': 'text/html; charset=utf-8',
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'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);
AppToast.showErrorToast(
message: TranslationBase.of(AppGlobal.context).pharmacyRelogin);
Navigator.of(AppGlobal.context).pushNamed(HOME);
} else {
onFailure('Error While Fetching data', statusCode);
@ -470,7 +523,10 @@ class BaseAppClient {
final response = await http.post(
url.trim(),
body: json.encode(body),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
@ -503,7 +559,10 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
final response = await http.get(
url.trim(),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
@ -530,7 +589,10 @@ class BaseAppClient {
final response = await http.put(
url.trim(),
body: json.encode(body),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
@ -563,7 +625,10 @@ class BaseAppClient {
if (await Utils.checkConnection()) {
final response = await http.delete(
url.trim(),
headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
@ -583,8 +648,10 @@ class BaseAppClient {
await sharedPref.remove(LOGIN_TOKEN_ID);
await sharedPref.remove(PHARMACY_CUSTOMER_ID);
await authenticatedUserObject.getUser();
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).isLogin = false;
var model = Provider.of<ToDoCountProviderModel>(AppGlobal.context, listen: false);
Provider.of<ProjectViewModel>(AppGlobal.context, listen: false).isLogin =
false;
var model =
Provider.of<ToDoCountProviderModel>(AppGlobal.context, listen: false);
_vitalSignService.weightKg = "";
_vitalSignService.heightCm = "";
model.setState(0, false);
@ -598,7 +665,8 @@ class BaseAppClient {
static defaultHttpParameters() async {
String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var user = await sharedPref.getObject(USER_PROFILE);
var params = {};
if (user != null) {
@ -634,7 +702,8 @@ class BaseAppClient {
try {
if (isExternal) {
String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
var user = await sharedPref.getObject(USER_PROFILE);
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
@ -657,11 +726,12 @@ class BaseAppClient {
: PATIENT_OUT_SA;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
@ -684,7 +754,9 @@ class BaseAppClient {
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID'];
body['PatientID'] = body['PatientID'] != null
? body['PatientID']
: user['PatientID'];
body['PatientOutSA'] = user['OutSA'];
body['SessionID'] = SESSION_ID; //getSessionId(token);
}
@ -696,21 +768,25 @@ class BaseAppClient {
var ss = json.encode(body);
if (await Utils.checkConnection()) {
final response = await http.post(url.trim(), body: json.encode(body), headers: {
final response =
await http.post(url.trim(), body: json.encode(body), headers: {
// 'Content-Type': 'application/json',
// 'Accept': 'application/json',
// 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Mobilenumber': user != null
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
});
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));
@ -718,7 +794,8 @@ class BaseAppClient {
onSuccess(parsed, statusCode);
} else {
if (parsed['ErrorType'] == 4) {
navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']);
navigateToAppUpdate(
AppGlobal.context, parsed['ErrorEndUserMessage']);
}
if (isAllowAny) {
onSuccess(parsed, statusCode);
@ -733,21 +810,31 @@ class BaseAppClient {
if (parsed != null) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
logout();
}
}
} else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
} else if (parsed['MessageStatus'] == 1 ||
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
} else if (parsed['MessageStatus'] == 2 &&
parsed['IsAuthenticated']) {
if (parsed['message'] == null &&
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message", statusCode);
onFailure("Server Error found with no available message",
statusCode);
} else {
onFailure(parsed['ErrorSearchMsg'], statusCode);
}
} else {
onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
}
} else if (!parsed['IsAuthenticated']) {
await logout();
@ -760,7 +847,9 @@ class BaseAppClient {
if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
}

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

@ -113,7 +113,7 @@ 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,
@ -121,10 +121,11 @@ class PharmacyModuleService extends BaseService {
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;
@ -135,6 +136,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',
@ -146,6 +149,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;
@ -161,6 +165,7 @@ class PharmacyModuleService extends BaseService {
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
// lastVisited = "2458,4561";
try {
await baseAppClient
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
@ -169,8 +174,10 @@ class PharmacyModuleService extends BaseService {
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) {

@ -9,36 +9,15 @@ class PrescriptionService extends BaseService {
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;
print("Print PRESCRIPTION url" + url);
await baseAppClient.post(url,
await baseAppClient.post(PRESCRIPTION,
onSuccess: (dynamic response, int statusCode) {
_prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {

@ -95,8 +95,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) {
@ -131,7 +132,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) {
@ -149,7 +151,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) {
@ -168,7 +172,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) {
@ -186,7 +191,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) {
@ -204,7 +211,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) {
@ -241,11 +249,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));
@ -266,7 +278,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));
@ -280,7 +293,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;
@ -304,7 +318,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;
@ -329,12 +344,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));
@ -346,16 +363,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);
// }
}
}

@ -9,6 +9,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';
@ -17,12 +19,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,24 +42,31 @@ class OrderPreviewViewModel extends BaseViewModel {
getShoppingCart();
}
}
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;
}
setState(ViewState.Idle);
// 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);
@ -112,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;
}
@ -165,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);
@ -176,8 +188,10 @@ class OrderPreviewViewModel extends BaseViewModel {
getShippingOption() async {
setState(ViewState.Busy);
await _orderService.getShippingOption(paymentCheckoutData.address).then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
await _orderService
.getShippingOption(paymentCheckoutData.address)
.then((res) {
paymentCheckoutData.shippingOption = ShippingOption.fromJson(res);
paymentCheckoutData.updateData();
});
if (_orderService.hasError) {
@ -192,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);

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

@ -6,48 +6,41 @@ 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);
@ -55,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);
@ -77,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);
@ -89,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);
}
}
@ -109,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;
@ -166,32 +117,4 @@ class PharmacyModuleViewModel extends BaseViewModel {
return false;
}
}
getPrescription() async {
print("Print PRESCRIPTION url");
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);
// }
// }
}

@ -5,6 +5,8 @@ import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart';
import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import '../../../locator.dart';
@ -36,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;
@ -69,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);
@ -90,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);
@ -113,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);
}

@ -7,6 +7,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/AlHabibMedicalService/home_health_care_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/product_categories_view_model.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart';
// import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
@ -119,6 +120,10 @@ import 'core/viewModels/pharmacies_view_model.dart';
import 'core/service/pharmacies_service.dart';
import 'core/service/insurance_service.dart';
import 'core/viewModels/insurance_card_View_model.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/pharmacy_module_view_model.dart';
import 'core/viewModels/pharmacyModule/product_detail_view_model.dart';
@ -289,24 +294,31 @@ 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.registerLazySingleton(
() => OffersAndPackagesServices()); // offerPackagesServices Service
locator.registerFactory(
() => OfferCategoriesViewModel()); // Categories View Model
locator.registerFactory(() => PackagesViewModel()); // Products View Model
//pharmacy
// locator.registerFactory(() => PharmacyCategoriseViewModel());
// locator.registerFactory(() => OffersCategoriseViewModel());

@ -7,11 +7,13 @@ import 'package:diplomaticquarterapp/services/robo_search/search_provider.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:flutter/material.dart';
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';
@ -78,12 +80,15 @@ class _MyApp extends State<MyApp> {
),
ChangeNotifierProvider<CompareList>(
create: (context) => CompareList()),
ChangeNotifierProvider<OrderPreviewViewModel>(
create: (context) => OrderPreviewViewModel()),
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
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

@ -825,15 +825,11 @@ class _HomePageState extends State<HomePage> {
} else {
GifLoaderDialogUtils.showMyDialog(context);
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
if (pharmacyModuleViewModel.error.isNotEmpty) {
await pharmacyModuleViewModel.createUser().then((value) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
});
} else {
await pharmacyModuleViewModel.verifyCustomer().then((value) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
}
});
});
}
}

@ -2,8 +2,9 @@ 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/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.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(),
],
),
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) {

@ -68,7 +68,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 {

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

@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -26,7 +26,8 @@ class ParentCategorisePage extends StatefulWidget {
ParentCategorisePage({this.id, this.titleName});
@override
_ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName);
_ParentCategorisePageState createState() =>
_ParentCategorisePageState(id: id, titleName: titleName);
}
class _ParentCategorisePageState extends State<ParentCategorisePage> {
@ -57,7 +58,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: titleName,
isBottomBar: false,
isShowAppBar: true,
@ -108,7 +112,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: InkWell(
child: Container(
child: Texts(
TranslationBase.of(context).viewCategorise,
TranslationBase.of(context)
.viewCategorise,
// 'View All Categories',
fontWeight: FontWeight.w300,
),
@ -194,22 +199,28 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Center(
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length,
itemCount: model.categoriseParent.length > 8
? 8
: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) {
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(
@ -220,7 +231,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
),
),
Container(
width: MediaQuery.of(context).size.width * 0.197,
width: MediaQuery.of(context)
.size
.width *
0.197,
// height: MediaQuery.of(context)
// .size
// .height *
@ -228,8 +242,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Center(
child: Texts(
projectViewModel.isArabic
? model.categoriseParent[index].namen
: model.categoriseParent[index].name,
? model
.categoriseParent[index]
.namen
: model
.categoriseParent[index]
.name,
fontSize: 13.4,
fontWeight: FontWeight.w600,
maxLines: 3,
@ -243,8 +261,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context,
FadePage(
page: SubCategorisePage(
title: model.categoriseParent[index].name,
id: model.categoriseParent[index].id,
title: model
.categoriseParent[index].name,
id: model
.categoriseParent[index].id,
parentId: id,
)),
);
@ -290,16 +310,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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(
@ -309,9 +334,15 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
width: 10.0,
),
Texts(
<<<<<<< HEAD
TranslationBase.of(context).refine,
// 'Refine',
fontWeight: FontWeight.w600,
=======
'Refine',
fontWeight:
FontWeight.w600,
>>>>>>> bcd99555e3e980ea8ec5f30a74c9e167c8520d9f
),
SizedBox(
width: 250.0,
@ -321,11 +352,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
// 'Close',
TranslationBase.of(context).closeIt,
color: Colors.red,
fontWeight: FontWeight.w600,
fontWeight:
FontWeight.w600,
fontSize: 15.0,
),
onTap: () {
Navigator.pop(context);
Navigator.pop(
context);
},
),
],
@ -338,29 +371,43 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column(
children: [
ExpansionTile(
<<<<<<< HEAD
title: Texts( TranslationBase.of(
context)
.categorise),
=======
title:
Texts('Categorise'),
>>>>>>> bcd99555e3e980ea8ec5f30a74c9e167c8520d9f
children: [
ProcedureListWidget(
model: model,
masterList: model.categoriseParent,
removeHistory: (item) {
masterList: model
.categoriseParent,
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),
)
],
),
@ -375,23 +422,33 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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),
)
],
),
@ -405,40 +462,63 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.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,
),
),
],
@ -453,20 +533,33 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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: [
Container(
width: 100,
child: Button(
<<<<<<< HEAD
label: TranslationBase.of(
context)
.reset,
backgroundColor: Colors.red,
=======
label: 'Reset',
backgroundColor:
Colors.red,
>>>>>>> bcd99555e3e980ea8ec5f30a74c9e167c8520d9f
),
),
SizedBox(
@ -475,40 +568,72 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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.getFilteredProducts(
min: minField.text.toString(),
max: maxField.text.toString(),
categoryId: categoriesId,
brandId: brandIds);
GifLoaderDialogUtils.hideDialog(context);
min: minField
.text
.toString(),
max: maxField
.text
.toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(context);
Navigator.pop(
context);
},
<<<<<<< HEAD
label: TranslationBase.of(
context)
.apply,
backgroundColor: Colors.green,
=======
label: 'Apply',
backgroundColor:
Colors
.green,
>>>>>>> bcd99555e3e980ea8ec5f30a74c9e167c8520d9f
),
),
],
@ -575,22 +700,28 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
model.parentProducts.isNotEmpty
? styleOne == true
? Container(
height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15,
height: model.parentProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 0.9,
),
itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) {
itemBuilder:
(BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: InkWell(
child: Card(
color: model.parentProducts[index].discountName != null
color: model.parentProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
@ -618,106 +749,187 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
),
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: [
if (model.parentProducts[index].discountName != null)
if (model
.parentProducts[
index]
.discountName !=
null)
RotatedBox(
quarterTurns: 4,
child: Container(
decoration: BoxDecoration(),
decoration:
BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
padding:
EdgeInsets
.only(
right: 5.0,
top: 20.0,
bottom: 5.0,
),
child: Texts(
'offer'.toUpperCase(),
color: Colors.red,
fontSize: 13.0,
fontWeight: FontWeight.w900,
'offer'
.toUpperCase(),
color: Colors
.red,
fontSize:
13.0,
fontWeight:
FontWeight
.w900,
),
),
transform: new Matrix4.rotationZ(5.837200),
transform: new Matrix4
.rotationZ(
5.837200),
),
),
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.parentProducts[index].images.isNotEmpty
? model.parentProducts[index].images[0].thumb
model
.parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model.parentProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
width: model
.parentProducts[
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.parentProducts[index].rxMessage != null
? model.parentProducts[index].rxMessage
model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
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: [
if (model.parentProducts[index].discountName != null)
if (model
.parentProducts[
index]
.discountName !=
null)
Container(
width: double.infinity,
width: double
.infinity,
height: 13.0,
decoration: BoxDecoration(
color: Color(0xff5AB145),
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
),
child: Center(
child: Texts(
model.parentProducts[index].discountName,
model
.parentProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
color: Colors
.white,
fontSize:
10.4,
),
),
),
Texts(
projectViewModel.isArabic
? model.parentProducts[index].namen
: model.parentProducts[index].name,
projectViewModel
.isArabic
? model
.parentProducts[
index]
.namen
: model
.parentProducts[
index]
.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w700,
fontWeight:
FontWeight.w700,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
@ -727,22 +939,25 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Row(
children: [
StarRating(
totalAverage:
model.parentProducts[index].approvedRatingSum > 0
? (model.parentProducts[index]
.approvedRatingSum
.toDouble() /
model.parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum.toDouble() /
model.parentProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars:
true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight
.w400,
)
],
),
@ -757,7 +972,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model.parentProducts[index]),
page: ProductDetailPage(
model.parentProducts[
index]),
)),
},
));
@ -765,11 +982,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
),
)
: Container(
height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122,
height: model.parentProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder(
physics: NeverScrollableScrollPhysics(),
itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) {
itemBuilder:
(BuildContext context, int index) {
return InkWell(
child: Card(
child: Row(
@ -779,9 +999,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column(
children: [
Container(
decoration: BoxDecoration(),
decoration:
BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
padding:
EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
@ -789,11 +1011,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
),
),
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.parentProducts[index].images.isNotEmpty
? model.parentProducts[index].images[0].thumb
model
.parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.contain,
height: 80,
@ -804,23 +1037,45 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column(
children: [
Container(
width: model.parentProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
width: model
.parentProducts[
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.parentProducts[index].rxMessage != null
? model.parentProducts[index].rxMessage
model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
),
),
],
@ -833,21 +1088,37 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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(
projectViewModel.isArabic
? model.parentProducts[index].namen
: model.parentProducts[index].name,
projectViewModel
.isArabic
? model
.parentProducts[
index]
.namen
: model
.parentProducts[
index]
.name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
fontWeight:
FontWeight.w500,
maxLines: 5,
),
),
@ -855,7 +1126,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
height: 8.0,
),
Padding(
padding: const EdgeInsets.only(top: 4, bottom: 4),
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
@ -865,21 +1140,26 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Row(
children: [
StarRating(
totalAverage:
model.parentProducts[index].approvedRatingSum > 0
? (model.parentProducts[index].approvedRatingSum
.toDouble() /
model.parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum
.toDouble() /
model
.parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
fontWeight:
FontWeight.w400,
)
],
),
@ -893,7 +1173,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model.parentProducts[index]),
page: ProductDetailPage(model
.parentProducts[index]),
)),
},
);
@ -935,7 +1216,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
}
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;
}
@ -943,7 +1225,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
}
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;
}

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

@ -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(

File diff suppressed because it is too large Load Diff

@ -7,219 +7,258 @@ 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/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 {
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),
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,
)
],
),
),
),
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,
),
)
: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
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: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
),
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,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
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),
)
],
),
),
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,155 +277,150 @@ 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(
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: [
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),
margin: EdgeInsets.symmetric(
horizontal: 0, vertical: 0),
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,
),
),
),
Texts(
"${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}",
fontSize:
projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
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),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 4),
child: Texts(
"${TranslationBase.of(context).inclusiveVat}",
fontSize: 8,
color: Colors.grey,
fontWeight: FontWeight.bold,
),
),
],
),
),
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.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,
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,
),
],
)
: Container(),
));
),
),
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();
}
}

File diff suppressed because it is too large Load Diff

@ -1,75 +1,65 @@
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/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.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/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.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/pages/pharmacies/widgets/manufacturerItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.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/buttons/borderedButton.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:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../../locator.dart';
import '../../final_products_page.dart';
import 'lacum-activitaion-vida-page.dart';
bool isInWishlist = false;
int price = 0;
var itemID;
var product;
var customerId;
var item;
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() {
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,534 +71,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, 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(),
],),
),
),
),
),
);
}
}
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 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();
}
}

@ -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,252 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.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-order-page.dart';
class FooterWidget extends StatefulWidget {
final bool isAvailable;
final int maxQuantity;
final int minQuantity;
final int quantityLimit;
final PharmacyProduct item;
final Function addToCartFunction;
int quantity;
bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
{this.quantity, this.isOverQuantity = false, this.addToCartFunction});
@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),
Column(
children: [
Container(
width: 100,
decoration: BoxDecoration(
border:
Border.all(color: Colors.grey[300]),
color: Colors.white,
),
child: TextField(
decoration: InputDecoration(
labelText: 'quantity #'),
onChanged: (text) {
print(widget.quantity);
print(widget.quantityLimit);
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 = 150;
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(
widget.quantity, widget.item.id, context);
},
borderColor: Color(0xFF4CAF50),
borderRadius: 5,
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(
widget.quantity, widget.item.id, context);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
borderRadius: 5,
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,356 @@
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/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
),
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: 80,
)
],
),
),
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,
),
));
}
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,
BuildContext context,
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,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,182 @@
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-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;
ProductAppBar(
{Key key,
this.product,
this.model,
this.addToWishlistFunction,
this.quantity,
this.deleteFromWishlistFunction,
this.isInWishList})
: 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,
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,
context: context,
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();
},
),
],
),
);
});
}
}

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -13,8 +13,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();
@ -24,6 +25,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 =
@ -32,8 +34,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
@ -42,8 +63,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
@ -52,75 +73,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,
),
),
@ -130,24 +159,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,69 +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(
TranslationBase.of(context).noData,
// '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,),
),
),
],
),
),
),
);
}
}

@ -35,8 +35,14 @@ class _AddAddressPageState extends State<AddAddressPage> {
} else {
_getCurrentLocation();
}
setState(() {
});
}
_getCurrentLocation() async {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
@ -44,9 +50,12 @@ class _AddAddressPageState extends State<AddAddressPage> {
}).catchError((e) {
_longitude = 0;
_latitude = 0;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
@ -63,8 +72,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,

@ -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(

@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';

@ -1,6 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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';

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/models/pharmacy/specification.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
class ProductDetailService extends BaseService {
bool isLogin = false;
@ -98,7 +99,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);
}
@ -109,7 +110,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());
});
}
@ -126,12 +127,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);
}
@ -149,7 +151,7 @@ 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",

@ -55,9 +55,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) {

@ -66,8 +66,10 @@ class TranslationBase {
localizedValues['enterDocName'][locale.languageCode];
String get search => localizedValues['search'][locale.languageCode];
String get noResultFound => localizedValues['noResultFound'][locale.languageCode];
String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode];
String get noResultFound =>
localizedValues['noResultFound'][locale.languageCode];
String get pleaseEnterProductName =>
localizedValues['pleaseEnterProductName'][locale.languageCode];
String get bookNow => localizedValues['bookNow'][locale.languageCode];
@ -669,7 +671,8 @@ class TranslationBase {
String get mobileNumber =>
localizedValues['MobileNumber'][locale.languageCode];
String get ok => localizedValues['Ok'][locale.languageCode];
String get averageWaitingTime => localizedValues['averageWaitingTime'][locale.languageCode];
String get averageWaitingTime =>
localizedValues['averageWaitingTime'][locale.languageCode];
String get waterConsumedInWeek =>
localizedValues['WaterConsumedInWeek'][locale.languageCode];
String get waterConsumedInMonth =>
@ -731,9 +734,12 @@ class TranslationBase {
String get brands => localizedValues['brands'][locale.languageCode];
String get products => localizedValues['products'][locale.languageCode];
String get reviews => localizedValues['reviews'][locale.languageCode];
String get productDetails => localizedValues['productDetails'][locale.languageCode];
String get noReviewsAvailable => localizedValues['noReviewsAvailable'][locale.languageCode];
String get noLocationAvailable => localizedValues['noLocationAvailable'][locale.languageCode];
String get productDetails =>
localizedValues['productDetails'][locale.languageCode];
String get noReviewsAvailable =>
localizedValues['noReviewsAvailable'][locale.languageCode];
String get noLocationAvailable =>
localizedValues['noLocationAvailable'][locale.languageCode];
String get myPrescriptions =>
localizedValues['myPrescriptions'][locale.languageCode];
String get medicationRefill =>
@ -912,7 +918,8 @@ class TranslationBase {
String get refine => localizedValues['refine'][locale.languageCode];
String get apply => localizedValues['apply'][locale.languageCode];
String get reset => localizedValues['reset'][locale.languageCode];
String get viewCategorise => localizedValues['viewCategorise'][locale.languageCode];
String get viewCategorise =>
localizedValues['viewCategorise'][locale.languageCode];
String get cart => localizedValues['cart'][locale.languageCode];
String get wishList => localizedValues['wishList'][locale.languageCode];
String get Alhabibapp => localizedValues['Alhabibapp'][locale.languageCode];
@ -1389,14 +1396,15 @@ 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];
String get noData =>
localizedValues['noData'][locale.languageCode];
String get no_data =>
localizedValues['no_data'][locale.languageCode];
String get noData => localizedValues['noData'][locale.languageCode];
String get no_data => localizedValues['no_data'][locale.languageCode];
String get year => localizedValues['Year'][locale.languageCode];
String get month => localizedValues['Month'][locale.languageCode];
@ -1764,24 +1772,22 @@ class TranslationBase {
String get timeNeeded => localizedValues["time-needed"][locale.languageCode];
String get totalTimeNeeded =>
localizedValues["total-time-needed"][locale.languageCode];
String get infoEye =>
localizedValues["info-eye"][locale.languageCode];
String get infoEye => localizedValues["info-eye"][locale.languageCode];
String get infoVaccines =>
localizedValues["info-vaccines"][locale.languageCode];
String get infoTrackers =>
localizedValues["info-trackers"][locale.languageCode];
String get infoHealthData =>
localizedValues["info-health-data"][locale.languageCode];
String get infoAskDoc =>
localizedValues["info-ask-doc"][locale.languageCode];
String get infoAskDoc => localizedValues["info-ask-doc"][locale.languageCode];
String get infoAutoWifi =>
localizedValues["info-auto-wifi"][locale.languageCode];
String get autoWifi =>
localizedValues["auto-wifi"][locale.languageCode];
String get autoWifi => localizedValues["auto-wifi"][locale.languageCode];
String get childVaccineInfo =>
localizedValues["child-vaccine-info"][locale.languageCode];
String get h2oInfo =>
localizedValues["h2o-info"][locale.languageCode];
String get h2oInfo => localizedValues["h2o-info"][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,
),
),
],
),
),
],
),
),
);
}

@ -29,7 +29,7 @@ class SecondaryButton extends StatefulWidget {
this.small = false,
this.disabled = false,
this.borderColor,
this.noBorderRadius = false})
this.noBorderRadius = false, this.borderRadius, this.disableColor})
: super(key: key);
final String label;
@ -43,6 +43,10 @@ class SecondaryButton extends StatefulWidget {
final bool iconOnly;
final bool disabled;
final bool noBorderRadius;
final double borderRadius;
final Color disableColor;
@override
_SecondaryButtonState createState() => _SecondaryButtonState();
@ -169,7 +173,7 @@ 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(
@ -180,7 +184,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),
),
),

@ -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],)
]

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

@ -58,10 +58,13 @@ class AppScaffold extends StatelessWidget {
final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo;
final bool isHelp;
final bool isLocalLoader;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppBarWidget appBar;
final Widget customAppBar;
AppScaffold(
{@required this.body,
this.appBarTitle = '',
@ -85,7 +88,9 @@ class AppScaffold extends StatelessWidget {
this.infoList,
this.isHelp = false,
this.showHomeAppBarIcon = true,
this.imagesInfo});
this.imagesInfo,
appBar,
this.customAppBar, this.isLocalLoader= false});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
@ -99,16 +104,18 @@ class AppScaffold extends StatelessWidget {
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
? customAppBar != null
? customAppBar
: appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
: null,
bottomSheet: bottomSheet,
body: SafeArea(
@ -140,7 +147,17 @@ class AppScaffold extends StatelessWidget {
buildBodyWidget(context) {
return Stack(
children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
children: <Widget>[
Center(
child:isLoading? CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
):body),
isHelp == true ? RobotIcon() : Container()]);
}
}
@ -177,6 +194,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
}
String _badgeText = "0";
class AppBarWidgetState extends State<AppBarWidget> {
@override
Widget build(BuildContext context) {
@ -217,17 +235,19 @@ class AppBarWidgetState extends State<AppBarWidget> {
),
centerTitle: true,
actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart)
? IconButton(
icon: Badge(
shape: BadgeShape.circle,
badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)),
child: Icon(Icons.shopping_cart)),
color: Colors.white,
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
})
: Container(),
// (widget.isPharmacy && widget.showPharmacyCart)
// ? Container()
// // ? IconButton(
// // icon: Badge(
// // shape: BadgeShape.circle,
// // badgeContent:
// // Text(_badgeText, style: TextStyle(color: Colors.white)),
// // child: Icon(Icons.shopping_cart)),
// // color: Colors.white,
// // onPressed: () {
// // Navigator.of(context).popUntil(ModalRoute.withName('/'));
// // })
// : Container(),
(widget.isOfferPackages && widget.showOfferPackagesCart)
? IconButton(
icon: Badge(

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

@ -9,8 +9,10 @@ import 'package:flutter_gifimage/flutter_gifimage.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();
@ -30,7 +32,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,
) ,
);
}
@ -42,7 +51,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,3 +1,4 @@
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';
@ -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,89 @@ class BottomNavPharmacyItem extends StatelessWidget {
this.currentIndex,
this.activeIcon,
this.title,
this.onTap});
this.onTap,
this.isHome = false});
@override
Widget build(BuildContext 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: 5, right: -3.5,
child: Container(
decoration: BoxDecoration(
color: Colors.red,
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,)),
),
)
],
),
),
);

@ -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,
),
],
),
),
);
}
}
Loading…
Cancel
Save