From 7427cd68ff6fb5b727f8c27d492503145f17c41d Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 3 Oct 2021 14:08:40 +0300 Subject: [PATCH 1/2] fix bottom nav bar ui --- .../pharmacy/bottom_nav_pharmacy_bar.dart | 35 ++++++++++--------- .../bottom_nav_pharmacy_home_item.dart | 8 ++--- .../pharmacy/bottom_nav_pharmacy_item.dart | 17 ++++++--- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart index 4921c1c5..237b4cae 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -44,17 +44,17 @@ class _BottomNavPharmacyBarState extends State { 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, - ), - ), - ), + // Container( + // height: 65.0, + // child: Center( + // child: VerticalDivider( + // color: Colors.grey, + // thickness: 0.5, + // width: 0.3, + // indent: 25.5, + // ), + // ), + // ), BottomNavPharmacyItem( icon: EvaIcons.list, @@ -79,12 +79,13 @@ class _BottomNavPharmacyBarState extends State { // 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, @@ -95,8 +96,8 @@ class _BottomNavPharmacyBarState extends State { title: TranslationBase.of(context).myAccount, ), BottomNavPharmacyItem( - icon: EvaIcons.shoppingCart, - activeIcon: EvaIcons.shoppingCart, + icon: EvaIcons.shoppingCartOutline, + activeIcon: EvaIcons.shoppingCartOutline, changeIndex: _changeIndex, index: widget.index, currentIndex: 4, diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart index 2920b2c8..fba53c1c 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -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 diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 47ff1b23..bff756f1 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -10,6 +10,7 @@ class BottomNavPharmacyItem extends StatelessWidget { final int index; final int currentIndex; final Function onTap; + final bool isHome; final IconData activeIcon; BottomNavPharmacyItem( @@ -19,7 +20,8 @@ class BottomNavPharmacyItem extends StatelessWidget { this.currentIndex, this.activeIcon, this.title, - this.onTap}); + this.onTap, + this.isHome = false}); @override Widget build(BuildContext context) { @@ -49,8 +51,11 @@ class BottomNavPharmacyItem extends StatelessWidget { ), Container( child: Icon(currentIndex == index ? activeIcon : icon, - color: - currentIndex == index ? secondaryColor : Colors.grey, + color: isHome + ? Color(0xff5AB145) + : currentIndex == index + ? Colors.grey + : Colors.grey, size: 22.0), ), SizedBox( @@ -61,8 +66,10 @@ class BottomNavPharmacyItem extends StatelessWidget { Texts( title, textAlign: TextAlign.center, - color: currentIndex == index ? secondaryColor : Colors.grey, - fontSize: 11, + color: currentIndex == index ? Colors.grey : Colors.grey, + fontWeight: + currentIndex == index ? FontWeight.bold : FontWeight.w400, + fontSize: currentIndex == index ? 13 : 11, ), ], ), From dbf7ebf287b905bf279878de52883680d0a7450e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 4 Oct 2021 10:47:08 +0300 Subject: [PATCH 2/2] fix most viewed & best sellers moduls --- lib/config/config.dart | 16 +- lib/config/localized_values.dart | 73 +- lib/core/service/client/base_app_client.dart | 216 +++-- .../service/pharmacy_categorise_service.dart | 54 +- .../product_categories_view_model.dart | 27 + lib/locator.dart | 9 +- lib/pages/final_products_page.dart | 897 +++++++++--------- lib/uitl/translations_delegate_base.dart | 44 +- .../others/app_scaffold_pharmacy_widget.dart | 2 +- 9 files changed, 773 insertions(+), 565 deletions(-) create mode 100644 lib/core/viewModels/product_categories_view_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 5af95569..660559d3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -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://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 PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; +// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // Pharmacy Production URLs -// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; -// 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 = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 28d53047..7d764249 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -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.", @@ -2239,39 +2242,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 child’s 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 child’s 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": "منتجات جديدة"} }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a6a2fb02..e74a353b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -29,7 +29,8 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = locator(); +AuthenticatedUserObject authenticatedUserObject = + locator(); VitalSignService _vitalSignService = locator(); 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 headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; + Map 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(AppGlobal.context, listen: false).isLogin = false; - var model = Provider.of(AppGlobal.context, listen: false); + Provider.of(AppGlobal.context, listen: false).isLogin = + false; + var model = + Provider.of(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,14 +768,17 @@ 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() : "", }); @@ -718,7 +793,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 +809,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 +846,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); } } } diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index c13f0548..ce24c980 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -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; @@ -331,10 +346,11 @@ class PharmacyCategoriseService extends BaseService { Future getMostViewedProducts() async { Map 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)); @@ -352,10 +368,12 @@ class PharmacyCategoriseService extends BaseService { Future getNewProducts() async { Map 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)); diff --git a/lib/core/viewModels/product_categories_view_model.dart b/lib/core/viewModels/product_categories_view_model.dart new file mode 100644 index 00000000..fa31accd --- /dev/null +++ b/lib/core/viewModels/product_categories_view_model.dart @@ -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(); + + List 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); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index bc8996b5..92c6bf63 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -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'; @@ -294,6 +295,7 @@ void setupLocator() { locator.registerFactory(() => LacumTranferViewModel()); locator.registerFactory(() => LacumRegistrationViewModel()); locator.registerFactory(() => EdOnlineViewModel()); + locator.registerFactory(() => ProductCategoriesViewModel()); //pharmacy locator.registerFactory(() => PharmacyCategoriseViewModel()); @@ -302,11 +304,12 @@ void setupLocator() { // 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()); diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 843d1d56..d5826706 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -1,6 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -9,12 +8,11 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget 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:flutter/src/widgets/image.dart' as flutterImage; import 'base/base_view.dart'; - dynamic languageID; + class FinalProductsPage extends StatefulWidget { final String id; final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed @@ -29,6 +27,7 @@ class _FinalProductsPageState extends State { String id; _FinalProductsPageState({this.id}); String categoriseName = "Personal Care"; + String appBarTitle = ""; bool styleOne = true; bool styleTwo = false; Icon styleIcon = Icon( @@ -45,29 +44,35 @@ class _FinalProductsPageState extends State { getLanguageID(); super.initState(); } + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) { if (widget.productType == 1) { model.getFinalProducts(i: id); + appBarTitle = TranslationBase.of(context).products; } else if (widget.productType == 2) { model.getManufacturerProducts(id); } else if (widget.productType == 3) { model.getLastVisitedProducts(); - } else if (widget.productType == 4){ + appBarTitle = TranslationBase.of(context).recentlyViewed; + } else if (widget.productType == 4) { model.getMostViewedProducts(); - } else if (widget.productType == 5){ + appBarTitle = TranslationBase.of(context).mostViewed; + } else if (widget.productType == 5) { model.getNewProducts(); + appBarTitle = TranslationBase.of(context).newProducts; } else { model.getBestSellerProducts(); + appBarTitle = TranslationBase.of(context).bestSellers; } }, allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( - appBarTitle: TranslationBase.of(context).products, + appBarTitle: appBarTitle, isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -86,7 +91,8 @@ class _FinalProductsPageState extends State { Padding( padding: EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).products, + "$appBarTitle " + + TranslationBase.of(context).products, fontWeight: FontWeight.w600, ), ), @@ -138,464 +144,507 @@ class _FinalProductsPageState extends State { ), styleOne == true ? Expanded( - child:model.finalProducts.length > 0 - ? Container( - height: MediaQuery.of(context).size.height * 3.90, - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 1.0, - ), - itemCount: model.finalProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.finalProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - 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: Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - 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.finalProducts[index].rxMessage != null - ? MediaQuery.of( - context) - .size - .width / - 2.8 - : 0, - padding: - EdgeInsets.all(4), - decoration: BoxDecoration( - color: - Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child:model.finalProducts[index].rxMessage != null - ? Texts( languageID == 'ar' ? model.finalProducts[index].rxMessagen - : model.finalProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w600, - ): Texts(""), - ), - ], + child: model.finalProducts.length > 0 + ? Container( + height: MediaQuery.of(context).size.height * + 3.90, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.finalProducts.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: + model.finalProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: Radius.circular( + 110.0), + ), + color: Colors.white, ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, child: Column( crossAxisAlignment: CrossAxisAlignment .start, children: [ - if (model - .finalProducts[ - index] - .discountName != - null) - Container( - width: - double.infinity, - height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), + Stack( + children: [ + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .finalProducts[ + index] + .images + .isNotEmpty + ? model + .finalProducts[ + 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, + ), ), - child: Center( - child: Texts( + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 2.8 + : 0, + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: model + .finalProducts[ + index] + .rxMessage != + null + ? Texts( + languageID == + 'ar' + ? model + .finalProducts[ + index] + .rxMessagen + : model + .finalProducts[index] + .rxMessage, + color: Colors + .white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w600, + ) + : Texts(""), + ), + ], + ), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .finalProducts[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .finalProducts[ + index] + .discountName, + regular: + true, + color: Colors + .white, + fontSize: + 10.4, + ), + ), + ), + Texts( model .finalProducts[ index] - .discountName, + .name, regular: true, - color: - Colors.white, - fontSize: 10.4, + fontSize: 12, + fontWeight: + FontWeight + .w400, ), - ), - ), - Texts( - model - .finalProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w400, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model.finalProducts[index].approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum - .toDouble() / - model - .finalProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), ], ), ), - ], - ), + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.finalProducts[ + index]), + )), + }, + )); + }, + ), + ) + : Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/images/pharmacy/empty_box.png', + width: 100, + height: 100, ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.finalProducts[index]), - )), - }, - )); - }, - ), - ) - : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: Alignment.center, - child: Image.asset( - 'assets/images/pharmacy/empty_box.png', - width: 100, - height: 100, - ), - ), - Text( - TranslationBase.of(context).noResult, - style: TextStyle( - fontSize: 20.0, + Text( + TranslationBase.of(context).noResult, + style: TextStyle( + fontSize: 20.0, // fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ], - ), - ),) + ) : Expanded( child: model.finalProducts.length > 0 - ? Container( - height: MediaQuery.of(context).size.height * 5.0, - child: ListView.builder( - itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), + ? Container( + height: MediaQuery.of(context).size.height * + 5.0, + child: ListView.builder( + itemCount: model.finalProducts.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .finalProducts[ + index] + .images + .isNotEmpty + ? model + .finalProducts[ + 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, + ), + ), + ], ), - ), - Container( - margin: - EdgeInsets.fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - 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, + Column( + children: [ + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 3.5 + : 0, + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .finalProducts[ + index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: + Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w600, + ), + ), + ], ), + ], + ), + Container( + height: 100.0, + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - ], - ), - Column( - children: [ - Container( - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( context) .size - .width / - 3.5 - : 0, - padding: - EdgeInsets.all(4), - decoration: BoxDecoration( - color: - Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: Texts( - model - .finalProducts[ - index] - .rxMessage != - null - ? model + .width * + 0.65, + child: Texts( + model .finalProducts[ index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w600, - ), - ), - ], - ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: - MediaQuery.of(context) - .size - .width * - 0.65, - child: Texts( - model.finalProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, + .name, + regular: true, + fontSize: 13.2, + fontWeight: + FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / + model.finalProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model - .finalProducts[ - index] - .approvedRatingSum - .toDouble() / - model - .finalProducts[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), ], ), ), - ], + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.finalProducts[ + index]), + )), + }, + ); + }), + ) + : Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/images/pharmacy/empty_box.png', + width: 100, + height: 100, + ), ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.finalProducts[index]), - )), - }, - ); - }), - ) - : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: Alignment.center, - child: Image.asset( - 'assets/images/pharmacy/empty_box.png', - width: 100, - height: 100, - ), - ), - Text( - TranslationBase.of(context).noResult, - style: TextStyle( - fontSize: 20.0, + Text( + TranslationBase.of(context).noResult, + style: TextStyle( + fontSize: 20.0, // fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ], - ), - ), ) ], ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index f6363a22..158d8afb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -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,13 @@ 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 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 +1770,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 { diff --git a/lib/widgets/others/app_scaffold_pharmacy_widget.dart b/lib/widgets/others/app_scaffold_pharmacy_widget.dart index 001bc955..a286baa5 100644 --- a/lib/widgets/others/app_scaffold_pharmacy_widget.dart +++ b/lib/widgets/others/app_scaffold_pharmacy_widget.dart @@ -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();