From 1089ce3aa39de3ae72dfb467fcb94e45cb33efd4 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 27 Oct 2021 10:34:18 +0300 Subject: [PATCH 1/5] Updates --- lib/config/config.dart | 4 +- .../pharmacies/screens/cart-order-page.dart | 52 ++++++++++--------- .../screens/cart-page/cart-order-page.dart | 18 ++++--- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index bbbacaa4..2f2e823a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -14,8 +14,8 @@ const PACKAGES_PRODUCTS = '/api/products'; 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/'; diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index d93c3637..09c39f3d 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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'; @@ -22,11 +23,7 @@ import 'package:provider/provider.dart'; import 'cart-page/cart-order-preview.dart'; class CartOrderPage extends StatefulWidget { - - - const CartOrderPage({ Key key}) - : super(key: key); - + const CartOrderPage({Key key}) : super(key: key); @override _CartOrderPageState createState() => _CartOrderPageState(); @@ -39,7 +36,6 @@ class _CartOrderPageState extends State { void initState() { super.initState(); getData(); - } @override @@ -206,12 +202,13 @@ class _CartOrderPageState extends State { indent: 0, endIndent: 0, ), - Image.asset( - "assets/images/pharmacy_module/payment.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), + getPaymentMethods(), +// Image.asset( +// "assets/images/pharmacy_module/payment.png", +// width: mediaQuery.size.width - 20, +// height: 30.0, +// fit: BoxFit.scaleDown, +// ), SizedBox( height: 120, ) @@ -402,27 +399,32 @@ class _OrderBottomWidgetState extends State { onPressed: isAgree // && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { - if(cart.isCartItemsOutOfStock()){ - // Toast msg - AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) - }else { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } - } + if (cart.isCartItemsOutOfStock()) + { + // Toast msg + AppToast.showErrorToast( + message: TranslationBase.of(context) + .outOfStockMsg) + } + else + { + Navigator.push( + context, + FadePage( + page: OrderPreviewPage( + widget.addresses))) + } + } : null, child: new Text( "${TranslationBase.of(context).checkOut}", style: new TextStyle( color: - isAgree ? Colors.white : Colors.grey.shade300, + isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), color: Color(0xFF4CAF50), - disabledColor:Color(0xFF4CAF50), + disabledColor: Color(0xFF4CAF50), // disabledColor: Color(0xff005aff), ) // RaisedButton( diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 5d7f10e0..699f7054 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-con import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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'; @@ -198,12 +199,13 @@ class _CartOrderPageState extends State { indent: 0, endIndent: 0, ), - Image.asset( - "assets/images/pharmacy_module/payment_image.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), + getPaymentMethods(), +// Image.asset( +// "assets/images/pharmacy_module/payment_image.png", +// width: mediaQuery.size.width - 20, +// height: 30.0, +// fit: BoxFit.scaleDown, +// ), SizedBox( height: 120, ) @@ -407,8 +409,8 @@ class _OrderBottomWidgetState extends State { fontSize: 14), ), elevation: 0, - color: Color(0xff005aff), - disabledColor: Color(0xff005aff), + color: Color(0xFF4CAF50), + disabledColor: Color(0xFF4CAF50), ), ], ), From 428791c7256364df288cc80539497f05e6072821 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 27 Oct 2021 11:51:26 +0300 Subject: [PATCH 2/5] fixed design --- lib/config/config.dart | 4 +- .../screens/cart-page/cart-order-page.dart | 422 ------------------ .../widgets/home/PrescriptionsWidget.dart | 2 +- 3 files changed, 3 insertions(+), 425 deletions(-) delete mode 100644 lib/pages/pharmacies/screens/cart-page/cart-order-page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 2f2e823a..bbbacaa4 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -14,8 +14,8 @@ const PACKAGES_PRODUCTS = '/api/products'; 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/'; diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart deleted file mode 100644 index 699f7054..00000000 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ /dev/null @@ -1,422 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class CartOrderPage extends StatefulWidget { - final Function(int) changeTab; - - const CartOrderPage({Key key, this.changeTab}) : super(key: key); - - @override - _CartOrderPageState createState() => _CartOrderPageState(); -} - -class _CartOrderPageState extends State { - bool isLoading = true; - - @override - void initState() { - super.initState(); - getData(); - } - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context); - OrderPreviewViewModel model = Provider.of(context); - - final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - isLoading: isLoading, - isLocalLoader: true, - child: appScaffold = AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - showHomeAppBarIcon: false, - isShowDecPage: true, - baseViewModel: model, - backButtonTab: - widget.changeTab != null ? () => widget.changeTab(0) : null, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? Container( - height: height * 0.85, - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - getPaymentMethods(), -// Image.asset( -// "assets/images/pharmacy_module/payment_image.png", -// width: mediaQuery.size.width - 20, -// height: 30.0, -// fit: BoxFit.scaleDown, -// ), - SizedBox( - height: 120, - ) - ], - ), - ), - ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, -// 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), - ), - ); - } - - void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); - setState(() { - isLoading = false; - }); - } -} - -class OrderBottomWidget extends StatefulWidget { - final List addresses; - final double height; - - OrderBottomWidget(this.addresses, this.height); - - @override - _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); -} - -class _OrderBottomWidgetState extends State { - bool isAgree = false; - - @override - Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Divider( - color: Color(0xFFD6D6D6), - height: 1, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: widget.height * 0.070, - color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - isAgree = !isAgree; - }); - }, - child: Container( - width: 25.0, - height: widget.height * 0.070, - decoration: new BoxDecoration( - color: !isAgree ? Color(0xffeeeeee) : Colors.green, - shape: BoxShape.circle, - ), - child: !isAgree - ? null - : Padding( - padding: const EdgeInsets.all(0.0), - child: Icon( - Icons.check, - color: Colors.white, - size: 25, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - margin: const EdgeInsets.symmetric(vertical: 4), - child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, - fontSize: 13, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ), - InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, - child: Container( - child: Icon( - Icons.info, - size: 25, - color: Color(0xff005aff), - ), - ), - ), - ], - ), - ), - Container( - height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), - child: Row( - children: [ - Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: projectProvider.isArabic ? 12 : 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), - child: Texts( - "${TranslationBase.of(context).inclusiveVat}", - fontSize: 8, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - RaisedButton( - onPressed: isAgree - ? () => { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } - : null, - child: new Text( - "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), - ), - elevation: 0, - color: Color(0xFF4CAF50), - disabledColor: Color(0xFF4CAF50), - ), - ], - ), - ), - ], - ) - : Container(); - } -} diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index fe8ca977..a2bc77e1 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -30,7 +30,7 @@ class PrescriptionsWidget extends StatelessWidget { ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( margin: EdgeInsets.only(right: 10.0, left: 10.0), - height: MediaQuery.of(context).size.height * 0.18, + height: MediaQuery.of(context).size.height * 0.20, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, From c242910aa2b82db925985070c4af0aea7ca28cd9 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 27 Oct 2021 14:38:33 +0300 Subject: [PATCH 3/5] fixed issues --- lib/pages/offers_categorise_page.dart | 31 ++++++++++++++++--- .../pharmacies/screens/cart-order-page.dart | 2 +- .../screens/cart-order-preview.dart | 0 .../screens/pharmacy_module_page.dart | 3 +- .../widgets/home/PrescriptionsWidget.dart | 11 +++++-- 5 files changed, 39 insertions(+), 8 deletions(-) delete mode 100644 lib/pages/pharmacies/screens/cart-order-preview.dart diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index a95cd263..24ff4355 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.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:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; @@ -698,9 +699,31 @@ class _OffersCategorisePageState extends State { ), ) : Center( - child: Texts( - "SORRY , there's no listed offers now :(", - color: Colors.green, - )))); + 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: Texts( +// "SORRY , there's no listed offers now :(", +// color: Colors.green, +// ) + ))); } } diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index f81b3ef0..30509900 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -421,7 +421,7 @@ class _OrderBottomWidgetState extends State { fontSize: 14), ), color: Color(0xFF4CAF50), - disabledColor:Color(0xFF4CAF50), + disabledColor:Colors.grey[700], // disabledColor: Color(0xff005aff), ) // RaisedButton( diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 454b391c..fad16863 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -55,9 +55,10 @@ class _PharmacyPageState extends State { BannerPager(model), GridViewButtons(model), PrescriptionsWidget(), - ShopByBrandWidget(), +// ShopByBrandWidget(), RecentlyViewedWidget(), BestSellerWidget(), + ShopByBrandWidget(), ], ), ), diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index a2bc77e1..04449cfd 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -1,5 +1,7 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; @@ -11,6 +13,10 @@ import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class PrescriptionsWidget extends StatelessWidget { + + AuthenticatedUserObject authenticatedUserObject = + locator(); + @override Widget build(BuildContext context) { return BaseView( @@ -20,7 +26,7 @@ class PrescriptionsWidget extends StatelessWidget { } }, allowAny: true, - builder: (_, model, wi) => model.prescriptionsList.length > 0 + builder: (_, model, wi) => model.prescriptionsList.length > 0 && authenticatedUserObject.isLogin ? NetworkBaseView( isLocalLoader: true, baseViewModel: model, @@ -179,7 +185,8 @@ class PrescriptionsWidget extends StatelessWidget { ), ), ) - : Container(), + : Container( + ), ); } } From 2c30b5a494e622cca2fd2200df4347d604058563 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 27 Oct 2021 15:18:32 +0300 Subject: [PATCH 4/5] fix issues --- lib/core/service/client/base_app_client.dart | 1 + .../pharmacyModule/PharmacyAddressesViewModel.dart | 6 ++++++ lib/pages/final_products_page.dart | 2 +- lib/pages/landing/landing_page_pharmcy.dart | 2 +- lib/pages/parent_categorise_page.dart | 2 +- .../pharmacies/screens/{ => cart-page}/cart-order-page.dart | 2 +- .../screens/product-details/footor/footer-widget.dart | 2 +- .../pharmacies/screens/product-details/product-detail.dart | 2 +- .../product-details/shared/product_details_app_bar.dart | 2 +- lib/pages/sub_categorise_page.dart | 2 +- lib/widgets/pharmacy/product_tile.dart | 2 +- 11 files changed, 16 insertions(+), 9 deletions(-) rename lib/pages/pharmacies/screens/{ => cart-page}/cart-order-page.dart (99%) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 5abbe81e..108b9695 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -433,6 +433,7 @@ class BaseAppClient { } print("URL : $url"); + var ss = json.encode(queryParams); if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 2f2d1467..b6420c9c 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import '../../../locator.dart'; @@ -75,13 +77,17 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.createdOnUtc = DateTime.now().toString(); if (editedAddress == null) { + + ///TODO Fatima* await _pharmacyAddressService.addCustomerAddress(sendingAddress); + } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress); } if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; + Utils.showErrorToast(error); setState(ViewState.Error); } else { setState(ViewState.Idle); diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 854b66a6..9c3a9e43 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index aa6f0d1c..2e251f3b 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -4,7 +4,7 @@ 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/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 18133bb2..c40fa6bd 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart similarity index 99% rename from lib/pages/pharmacies/screens/cart-order-page.dart rename to lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 30509900..a15c5c50 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -19,7 +19,7 @@ import 'package:flutter/material.dart'; import 'package:http/http.dart'; import 'package:provider/provider.dart'; -import 'cart-page/cart-order-preview.dart'; +import 'cart-order-preview.dart'; class CartOrderPage extends StatefulWidget { 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 ca8222ac..69f16ac2 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.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'; diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 4cee4ba3..cb38ca4f 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -4,7 +4,7 @@ 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/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index a9e2a66c..5febe30c 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,7 +2,7 @@ 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/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 6c41f550..90806a82 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 1c2f87cc..af1e75ec 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; From e6378b7ada0ee1c0cca7d554695d5c5c72cc70dc Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 31 Oct 2021 13:51:03 +0300 Subject: [PATCH 5/5] fix issues --- lib/config/localized_values.dart | 2 + lib/pages/final_products_page.dart | 505 +++++++++++------- lib/pages/offers_categorise_page.dart | 2 +- lib/pages/parent_categorise_page.dart | 4 +- .../screens/cart-page/cart-order-page.dart | 2 +- .../product-details/footor/footer-widget.dart | 166 +++--- .../shared/product_details_app_bar.dart | 2 +- lib/pages/pharmacies/search_brands_page.dart | 35 +- .../pharmacies/widgets/ProductTileItem.dart | 56 +- .../widgets/home/PrescriptionsWidget.dart | 6 +- lib/pages/search_products_page.dart | 29 +- lib/pages/sub_categorise_page.dart | 4 +- lib/uitl/translations_delegate_base.dart | 4 + 13 files changed, 507 insertions(+), 310 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7f77d115..f73e5fe2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -759,6 +759,8 @@ const Map localizedValues = { "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, "needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"}, "outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"}, + "noArabicLetters": {"en": "It Is Not Allow to Use Arabic Letters", "ar": "غير مسموح باستخدام الحروف العربيه"}, + "noOffersAvailable": {"en": "No Offers Available!", "ar": "لايوجد عروض حاليا"}, "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 9c3a9e43..65adf282 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -198,7 +198,8 @@ class _FinalProductsPageState extends State { ), margin: EdgeInsets.symmetric( horizontal: 8, - vertical: 4, + vertical: 1, +// vertical: 2, ), child: Container( decoration: BoxDecoration( @@ -210,11 +211,17 @@ class _FinalProductsPageState extends State { color: Colors.white, ), padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + horizontal: 4, + ), + width: MediaQuery.of(context).size.width / 3, +// width: MediaQuery.of(context) +// .size +// .width / +// 1, +// height: MediaQuery.of(context) +// .size +// .width / +// 1, child: Column( crossAxisAlignment: CrossAxisAlignment @@ -224,7 +231,7 @@ class _FinalProductsPageState extends State { children: [ Container( margin: EdgeInsets - .fromLTRB(0, 16, + .fromLTRB(0, 1, 0, 0), alignment: Alignment .center, @@ -242,10 +249,68 @@ class _FinalProductsPageState extends State { .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, + height: 70, ), ), - Container( +// 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: 0, + vertical: 2, + ), width: model .finalProducts[ index] @@ -255,19 +320,18 @@ class _FinalProductsPageState extends State { context) .size .width / - 2.8 + 2.0 : 0, padding: - EdgeInsets.all( - 4), + EdgeInsets.fromLTRB(8,4,8,4), decoration: BoxDecoration( color: Color( 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), +// borderRadius: BorderRadius.only( +// topLeft: Radius +// .circular( +// 6)), ), child: model .finalProducts[ @@ -296,8 +360,6 @@ class _FinalProductsPageState extends State { ) : Texts(""), ), - ], - ), Container( margin: EdgeInsets .symmetric( @@ -439,205 +501,268 @@ class _FinalProductsPageState extends State { (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, + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 2.0, + top: 2.0, + right: 2.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( +// 8, 0, 8, 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: 70, + ), ), - ), - ], + ], + ), +// Column( +// children: [ +// Container( +// width: model +// .finalProducts[ +// index] +// .rxMessage != +// null +// ? MediaQuery.of( +// context) +// .size +// .width / +// 5.3 +// : 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: 130.0, + margin: + EdgeInsets.symmetric( + horizontal: 0, + vertical: 6, ), - Column( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ + Container( + margin: EdgeInsets + .symmetric( + horizontal: 4, + vertical: 0, + ), width: model - .finalProducts[ - index] - .rxMessage != - null + .finalProducts[ + index] + .rxMessage != + null ? MediaQuery.of( - context) - .size - .width / - 5.3 + context) + .size + .width / + 2.0 : 0, padding: - EdgeInsets.all( - 4), + EdgeInsets.all( + 4), decoration: - BoxDecoration( + BoxDecoration( color: Color( 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), +// 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(""), + ), + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.65, child: Texts( model - .finalProducts[ - index] - .rxMessage != - null - ? model - .finalProducts[ - index] - .rxMessage - : "", - color: - Colors.white, + .finalProducts[ + index] + .name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight - .w600, + FontWeight.w500, + maxLines: 5, ), ), - ], - ), - ], - ), - 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, ), - ), - SizedBox( - height: 8.0, - ), - 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, + ) + ], + ), + ], + ), ), - ), - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - if(model.finalProducts[index].rxMessage == null){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.finalProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage())); + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon(Icons.shopping_cart, + size: 18, + color: Colors.blue,), + onPressed: () async { + if(model.finalProducts[index].rxMessage == null){ + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.finalProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push( + context, + FadePage(page: CartOrderPage())); + } + else{ + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } - else{ - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } // - } + } - ), - ):Container(), - ], + ), + ):Container(), + ], + ), ), ), onTap: () => { diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index 24ff4355..2715b2b0 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -713,7 +713,7 @@ class _OffersCategorisePageState extends State { ), Padding( padding: const EdgeInsets.all(8.0), - child: Text(TranslationBase.of(context).noData, + child: Text(TranslationBase.of(context).noOffersAvailable, // 'There is no data', style: TextStyle(fontSize: 30), ), diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index c40fa6bd..b63319f5 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1031,7 +1031,7 @@ class _ParentCategorisePageState extends State { .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, + height: 70, ), ), ], @@ -1086,7 +1086,7 @@ class _ParentCategorisePageState extends State { ), Container( margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 0, vertical: 0, ), child: Column( diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index a15c5c50..79165766 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -421,7 +421,7 @@ class _OrderBottomWidgetState extends State { fontSize: 14), ), color: Color(0xFF4CAF50), - disabledColor:Colors.grey[700], + disabledColor:Color(0xFF848484), // disabledColor: Color(0xff005aff), ) // RaisedButton( 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 69f16ac2..b8bc5808 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -128,92 +128,104 @@ class _FooterWidgetState extends State { : 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), + Container( + height: 58, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 90, + height: 60, + 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), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), ), - ), - ], + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 80; + showUI = false; + } else { + quantityUI = 160; + showUI = true; + } + }); + }, ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 80; - showUI = false; - } else { - quantityUI = 160; - showUI = true; - } - }); - }, ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.45, - child: SecondaryButton( - label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, - onTap: () async { - if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); - } else - await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - }, - fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50), - borderRadius: 3, - color: Color(0xFF4CAF50), + SizedBox( + width: 10, ), - ), - 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.isRx, - onTap: () async { - await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - fontWeight: FontWeight.w600, - borderColor: Colors.grey[800], - borderRadius: 3, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800], + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + }, + fontWeight: FontWeight.w600, + borderColor: Color(0xFF4CAF50), + borderRadius: 3, + color: Color(0xFF4CAF50), + ), + ), + SizedBox( + width: 5, + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else { + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + );} + }, + fontWeight: FontWeight.w600, + borderColor: Colors.grey[800], + borderRadius: 3, + disableColor: Colors.grey[700], + color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800], + ), ), - ), - ], + ], + ), ), ], ), + ); } diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 5febe30c..22fcec7f 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -78,7 +78,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { borderRadius: BorderRadius.circular(15), ), padding: EdgeInsets.only(left: 5, right: 4.5), - height: 18, + height: 19, child: Center( child: Texts( Provider.of(context, listen: false).cartResponse.quantityCount.toString(), diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index d993ecdf..cb1281ff 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -1,11 +1,14 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class SearchBrandsPage extends StatefulWidget { @override @@ -23,7 +26,7 @@ class _SearchBrandsPageState extends State { onModelReady: (model) => model.searchProducts(), builder: (BuildContext context, model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Search', + appBarTitle: TranslationBase.of(context).search, isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -44,24 +47,36 @@ class _SearchBrandsPageState extends State { key: _formKey, child: TextFields( autoFocus: true, - hintText: 'Search', + hintText: TranslationBase.of(context).search, fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.deny(RegExp("[\u0621-\u064a-\ ]")) + ], + validator: (value) { + RegExp regExp = RegExp('[\u0621-\u064a-\ ]'); + 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); - msg = 'No Result Found'; + msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { - return 'please Enter Product Name'; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +// return 'please Enter Product Name'; +// } +// return null; +// }, ), ), ), @@ -70,7 +85,7 @@ class _SearchBrandsPageState extends State { ), InkWell( child: Texts( - 'Cancel', + TranslationBase.of(context).cancel, fontSize: 17.0, fontWeight: FontWeight.w500, ), diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 92ad8d1a..56b4cc7e 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -88,7 +88,7 @@ class ProductTileItem extends StatelessWidget { Stack( children: [ Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), alignment: Alignment.center, child: (item.images != null && item.images.length > 0) ? Image.network( @@ -102,17 +102,42 @@ class ProductTileItem extends StatelessWidget { height: itemHeight / 2, ), ), - Container( - width: item.rxMessage != null - ? MediaQuery.of(context).size.width / 5 - : 0, - padding: EdgeInsets.all(4), +// 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(""), +// ) + ], + ), + Padding( + padding: EdgeInsets.fromLTRB(4,2,4,2), + child: Container( +// width: item.rxMessage != null +// ? MediaQuery.of(context).size.width / 5 +// : 0, + // padding: EdgeInsets.fromLTRB(6,4,6,4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + ), - child: item.rxMessage != null + child: item.rxMessage != null ? Texts( projectProvider.isArabic ? item.rxMessagen @@ -123,12 +148,11 @@ class ProductTileItem extends StatelessWidget { fontWeight: FontWeight.w400, ) : Texts(""), - ) - ], - ), - SizedBox(height: 8,), + ), + ), + // SizedBox(height: 4,), Padding( - padding: const EdgeInsets.symmetric(horizontal: 6.0), + padding: const EdgeInsets.symmetric(horizontal: 4.0), child: Texts( projectProvider.isArabic ? item.namen : item.name, regular: true, @@ -139,7 +163,7 @@ class ProductTileItem extends StatelessWidget { Expanded( child: Container( margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 4, vertical: 0, ), child: Column( @@ -147,7 +171,7 @@ class ProductTileItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: const EdgeInsets.only(top: 2, bottom: 2), child: Texts( "SAR ${item.price}", fontWeight: FontWeight.w600, diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 04449cfd..261f4e99 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -36,7 +36,7 @@ class PrescriptionsWidget extends StatelessWidget { ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( margin: EdgeInsets.only(right: 10.0, left: 10.0), - height: MediaQuery.of(context).size.height * 0.20, + height: MediaQuery.of(context).size.height * 0.28, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, @@ -63,7 +63,7 @@ class PrescriptionsWidget extends StatelessWidget { top: 10.0, left: 10.0, right: 10.0, - bottom: 15.0, + bottom: 10.0, ), child: CircleAvatar( radius: 30, @@ -85,7 +85,7 @@ class PrescriptionsWidget extends StatelessWidget { border: Border.all( color: Colors.green, style: BorderStyle.solid, - width: 4.0, + width: 3.0, ), color: Colors.green, borderRadius: BorderRadius.circular(30.0)), diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 0aac68a0..3fa00712 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_mo import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -12,6 +13,7 @@ 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/services.dart'; import 'base/base_view.dart'; @@ -25,6 +27,7 @@ class _SearchProductsPageState extends State { final _formKey = GlobalKey(); String msg = ''; + @override Widget build(BuildContext context) { return BaseView( @@ -57,6 +60,18 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.deny(RegExp("[\u0621-\u064a-\ ]")) + ], + validator: (value) { + RegExp regExp = RegExp('[\u0621-\u064a-\ ]'); + 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); }, @@ -66,13 +81,13 @@ class _SearchProductsPageState extends State { msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { -// return 'please Enter Product Name'; - return TranslationBase.of(context).pleaseEnterProductName; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +//// return 'please Enter Product Name'; +// return TranslationBase.of(context).pleaseEnterProductName; +// } +// return null; +// }, ), ), ), diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 90806a82..49ebf48d 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -987,9 +987,9 @@ class _SubCategorisePageState extends State { ], ), Container( - height: 100.0, + height: 130.0, margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 0, vertical: 0, ), child: Column( diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 396afd00..82cc958c 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1765,6 +1765,10 @@ class TranslationBase { String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; + String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode]; + + String get noOffersAvailable => localizedValues['noOffersAvailable'][locale.languageCode]; + String get requestID => localizedValues['requestID'][locale.languageCode]; String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode];