From 8f044a635a18b3a10d2bcf097b23c01e02a1a003 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 28 Nov 2021 14:31:28 +0200 Subject: [PATCH 1/4] fix footer design --- .../product-details/footor/footer-widget.dart | 58 +++++++++++++------ lib/widgets/buttons/secondary_button.dart | 10 ++-- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index e0cf8168..3807714e 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -57,7 +57,15 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: Color(0xFF707070), width: 0), + boxShadow: [ + BoxShadow( + color: Color(0xFFCCCCCC), + spreadRadius: 0, + blurRadius: 4, + offset: Offset(2, 2), // changes position of shadow + ), + ], + // border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, @@ -219,12 +227,12 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).addToCart, - disabled: (!widget.isAvailable && widget.quantity > 0) || - widget.quantity > widget.quantityLimit || - widget.item.isRx, - fontSize: 16, + disabled: isAddToCartDisable(), + fontSize: 15, onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -235,8 +243,9 @@ class _FooterWidgetState extends State { model: widget.model); }, fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50).withOpacity(0.7), borderRadius: 6, + disableColor:Color(0xFFD6D6D6), + textColor: isAddToCartDisable()?Color(0xFFACACAC):Colors.white, color: Color(0xFF535353), ), ), @@ -245,12 +254,13 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).buyNow, - fontSize: 16, - disabled: (!widget.isAvailable && widget.quantity > 0) || - (widget.quantity > widget.quantityLimit) || - widget.item.isRx, + fontSize: 15, + disabled: isBuyNowDisable(), + onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -261,15 +271,11 @@ class _FooterWidgetState extends State { model: widget.model); } }, + textColor: isBuyNowDisable()?Color(0xFFACACAC):Colors.white, fontWeight: FontWeight.w600, - borderColor: Colors.grey[800].withOpacity(0.7), borderRadius: 6, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.isRx - ? Color(0xFF535353).withOpacity(0.7) - : Color(0xFF5AB145), + disableColor: Color(0xFFD6D6D6), + color: Color(0xFF5AB145), ), ), ], @@ -280,6 +286,24 @@ class _FooterWidgetState extends State { ); } + bool isBuyNowDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + (widget.quantity > widget.quantityLimit) || + widget.item.isRx; + + + } + + bool isAddToCartDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + widget.quantity > widget.quantityLimit || + widget.item.isRx; + + + } + void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8f0ae5f1..a5ac63aa 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -200,9 +200,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width * 2.2, height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( - shape: BoxShape.circle, + // shape: BoxShape.circle, color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor, ), ), @@ -212,8 +212,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -246,8 +246,10 @@ class _SecondaryButtonState extends State bottom: widget.small ? 4.0 : 3.0), child: Text( widget.label, + textAlign: TextAlign.center, style: TextStyle( color: widget.textColor, + fontSize: widget.small ? 12.0 : widget.fontSize??14.0, fontWeight: FontWeight.w700, fontFamily: projectViewModel.isArabic From f623828d7835d43d748f79aef7121bb6ff81b9ab Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 12:06:41 +0200 Subject: [PATCH 2/4] fix arabic language --- .../product-details/footor/footer-widget.dart | 2 - lib/pages/search_products_page.dart | 127 ++++++++++++------ 2 files changed, 89 insertions(+), 40 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 3807714e..5d974cc4 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -287,7 +287,6 @@ class _FooterWidgetState extends State { } bool isBuyNowDisable(){ - // return true; return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx; @@ -296,7 +295,6 @@ class _FooterWidgetState extends State { } bool isAddToCartDisable(){ - // return true; return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx; diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 8ec9f014..74e4ff37 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -11,12 +11,16 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'base/base_view.dart'; +import 'package:intl/intl.dart' as international; + + class SearchProductsPage extends StatefulWidget { @override @@ -27,6 +31,8 @@ class _SearchProductsPageState extends State { final textController = TextEditingController(); final _formKey = GlobalKey(); String msg = ''; + String validText=""; + bool isTextValid = true; @override Widget build(BuildContext context) { @@ -55,47 +61,90 @@ class _SearchProductsPageState extends State { width: MediaQuery.of(context).size.width * 0.70, child: Form( key: _formKey, - child: TextFields( - autoFocus: true, - hintText: TranslationBase.of(context).search, - fontSize: 14.5, - prefixIcon: Icon(Icons.search), - inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'([A-Za-z0-9 a space])')) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context) - .pleaseEnterProductName; - } else if (!regExp.hasMatch(value)) { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .noArabicLetters); - } - return null; - }, - onSaved: (value) { - //searchMedicine(model, context); - }, - onSubmit: (value) { - searchMedicine(model, context); + child: Column( + children: [ + TextFields( + autoFocus: true, + hintText: TranslationBase.of(context).search, + fontSize: 14.5, + prefixIcon: Icon(Icons.search), + inputAction: TextInputAction.search, + + validator: (value) { + RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + } else if (isRTL(value))) { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .noArabicLetters); + } + return null; + }, + onChanged: (value){ + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = ""; + isTextValid = true; + }); + }) + ; + + + } else if (isRTL(value)) { + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = validText; + isTextValid = false; + }); + }) + ; + + }else{ + + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = value; + validText = value; + isTextValid = true; + }); + }) + ; + + } + + }, + onSaved: (value) { + setState(() { + textController.text = validText; + isTextValid = false; + }); + //searchMedicine(model, context); + }, + onSubmit: (value) { + searchMedicine(model, context); // msg = 'No Result Found'; - msg = TranslationBase.of(context).noResultFound; - }, - controller: textController, -// validator: (value) { -// if (value.isEmpty) { -//// return 'please Enter Product Name'; -// return TranslationBase.of(context).pleaseEnterProductName; -// } -// return null; -// }, + msg = TranslationBase.of(context).noResultFound; + }, + controller: textController, + ), + SizedBox( + width: 10.0, + ), + if(!isTextValid) + AppText( TranslationBase.of(context) + .noArabicLetters, color: Colors.red,), + ], ), ), ), + + SizedBox( width: 10.0, ), @@ -337,7 +386,9 @@ class _SearchProductsPageState extends State { ), ); } - + bool isRTL(String text) { + return international.Bidi.detectRtlDirectionality(text); + } searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { Utils.hideKeyboard(context); if (_formKey.currentState.validate()) From 3e667d6b8745a2262bb48288e8ab331322ed3b62 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 12:07:08 +0200 Subject: [PATCH 3/4] fix arabic language --- lib/pages/search_products_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 74e4ff37..f74d38d6 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -75,7 +75,7 @@ class _SearchProductsPageState extends State { if (value.isEmpty) { TranslationBase.of(context) .pleaseEnterProductName; - } else if (isRTL(value))) { + } else if (isRTL(value)) { AppToast.showErrorToast( message: TranslationBase.of(context) .noArabicLetters); From 16c1064a4585fe95e40ba3dbae885cca9f94a9a1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 15:15:44 +0200 Subject: [PATCH 4/4] PMAU-19 --- lib/config/config.dart | 4 +- .../pharmacies/widgets/home/BannerPager.dart | 28 +++++++++++- lib/widgets/others/entity_checkbox_list.dart | 43 ++++++++++++------- 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index dafe7ab9..42861cce 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -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/'; diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6302f263..8c62f458 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -50,7 +53,7 @@ class _BannerPagerState extends State { (item, index) { return InkWell( onTap: () { - Navigator.push(context, FadePage(page: OffersCategorisePage())); + bannerNavigator(index); }, child: Container( margin: EdgeInsets.symmetric(horizontal: 1.0), @@ -93,4 +96,27 @@ class _BannerPagerState extends State { ], )); } + + bannerNavigator(index){ + switch(index) { + case 1: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + case 2: { + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + } + break; + case 5: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + + default: { + + } + break; + } + + } } diff --git a/lib/widgets/others/entity_checkbox_list.dart b/lib/widgets/others/entity_checkbox_list.dart index c03fe029..0a34778f 100644 --- a/lib/widgets/others/entity_checkbox_list.dart +++ b/lib/widgets/others/entity_checkbox_list.dart @@ -93,24 +93,22 @@ class _ProcedureListWidgetState extends State { historyInfo), activeColor: Colors.red[800], onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); + selectOption(historyInfo); + }), Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts(historyInfo.name, - variant: "bodyText", - bold: true, - color: Colors.black), + child: InkWell( + onTap:(){ + selectOption(historyInfo); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.name, + variant: "bodyText", + bold: true, + color: Colors.black), + ), ), ), ], @@ -142,6 +140,19 @@ class _ProcedureListWidgetState extends State { ); } + + selectOption(historyInfo){ + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + } + void filterSearchResults(String query) { List dummySearchList = List(); dummySearchList.addAll(widget.masterList);