From 12b20831df7230f34d31a63761d36b559ad1fa92 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 22 Nov 2021 09:54:06 +0300 Subject: [PATCH 1/4] fix app bar --- lib/pages/final_products_page.dart | 2 ++ lib/pages/parent_categorise_page.dart | 2 ++ lib/pages/pharmacies/compare.dart | 3 +++ lib/pages/pharmacies/my_reviews.dart | 3 +++ .../shared/product_details_app_bar.dart | 2 +- lib/pages/pharmacies/widgets/ProductOrderItem.dart | 4 +++- lib/pages/pharmacies/wishlist.dart | 3 +++ lib/pages/pharmacy/order/Order.dart | 3 +++ lib/pages/pharmacy/profile/profile.dart | 6 +++--- lib/pages/sub_categories_modalsheet.dart | 10 ++++++++-- lib/pages/sub_categorise_page.dart | 8 ++++++-- 11 files changed, 37 insertions(+), 9 deletions(-) diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 91e953ad..758ceb78 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -93,6 +93,8 @@ class _FinalProductsPageState extends State { isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: Container( height: MediaQuery.of(context).size.height * 5.87, diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 5a917897..c1b1b2b7 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -93,6 +93,8 @@ class _ParentCategorisePageState extends State { isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: SmartRefresher( enablePullDown: false, diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index 82a11610..f458304f 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -33,6 +33,9 @@ class _ComparePageState extends State { appBarTitle: TranslationBase.of(context).compare, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, body: SingleChildScrollView( child: Container( child: compareList(), diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index 08ba3d14..39304cac 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -26,6 +26,9 @@ class _MyReviewsPageState extends State { appBarTitle: TranslationBase.of(context).reviews, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.reviewListList.length == 0 ? Container( 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 f58438cf..e42018fc 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 @@ -157,7 +157,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { quantity: quantity, itemID: itemID, model: model, - context: context); + ); Navigator.of(context).pop(); } diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index fa0ead15..34566d8a 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -248,7 +248,9 @@ class _ProductOrderItemState extends State { } else { newValue = widget.item.quantity - 1; } - } else { + widget.item.quantity = newValue; + } else + { _quantityController.text = "${widget.item.quantity}"; _totalPrice = "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index 3d1c8114..a70f2cab 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -17,6 +17,9 @@ class WishlistPage extends StatelessWidget { isShowAppBar: true, isShowDecPage: false, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.wishListList.length == 0 ? Container( diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 9eda1004..ef5c9346 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -66,6 +66,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix baseViewModel: model, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, body: Container( child: Column( children: [ diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 1f2520b6..72fa43dc 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -108,10 +108,10 @@ class _ProfilePageState extends State { builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, isShowAppBar: true, - isShowDecPage: true, + isShowDecPage: false, isPharmacy: true, - - //isBottomBar: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, isMainPharmacyPages: true, body: user != null ? Container( diff --git a/lib/pages/sub_categories_modalsheet.dart b/lib/pages/sub_categories_modalsheet.dart index d6499c8e..ed2403db 100644 --- a/lib/pages/sub_categories_modalsheet.dart +++ b/lib/pages/sub_categories_modalsheet.dart @@ -40,11 +40,13 @@ class _SubCategoriseModalsheetState extends State { builder: (_, model, wi) => AppScaffold( // appBarTitle: titleName, appBarTitle: TranslationBase.of(context).categorise, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, isPharmacy: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: Container( color: Colors.white, @@ -77,7 +79,11 @@ class _SubCategoriseModalsheetState extends State { context, FadePage( page: SubCategorisePage( - title: model.categoriseParent[index].name, + title: projectViewModel + .isArabic + ? model.categoriseParent[index].namen + : model.categoriseParent[index].name, + // title: model.categoriseParent[index].name, id: model.categoriseParent[index].id, parentId: id, )), diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 4bc069dc..a0b54f9f 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -76,12 +77,15 @@ class _SubCategorisePageState extends State { allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => - PharmacyAppScaffold( + AppScaffold( + isPharmacy: true, appBarTitle: title, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: SmartRefresher( controller: controller, From 7bbabd798ab0101b7440bffcd141bed00568c059 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 22 Nov 2021 10:32:22 +0300 Subject: [PATCH 2/4] fix issue --- lib/pages/pharmacy/order/OrderDetails.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index fc4ae184..6b7c957e 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -84,6 +84,9 @@ class _OrderDetailsPageState extends State { appBarTitle: TranslationBase.of(context).orderDetail, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.orderListModel.length > 0 ? Container( From 21c315c1a30b5ed16ea5895002d593de11262f51 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 22 Nov 2021 11:27:21 +0300 Subject: [PATCH 3/4] fix wishlist issue --- lib/pages/final_products_page.dart | 2 +- lib/pages/parent_categorise_page.dart | 3 +-- lib/pages/pharmacies/ProductCheckTypeWidget.dart | 1 + .../product-details/shared/product_details_app_bar.dart | 2 +- lib/pages/pharmacies/wishlist.dart | 4 ++-- lib/pages/sub_categorise_page.dart | 3 +-- lib/widgets/pharmacy/product_tile.dart | 9 ++++++++- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 758ceb78..253d7c08 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -487,7 +487,7 @@ class _FinalProductsPageState extends State { color: CustomColors.green, ), onPressed: () async { - if (model.finalProducts[index].rxMessage == null) { + if (model.finalProducts[index].isRx == false) { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.finalProducts[index].id); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index c1b1b2b7..c025eb3c 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1273,8 +1273,7 @@ class _ParentCategorisePageState extends State { ), onPressed: () async { - if (model.parentProducts[index].rxMessage == - null) { + if (model.parentProducts[index].isRx == false) { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.parentProducts[index].id); diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index d0a112c6..8ac83fd2 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -37,6 +37,7 @@ class _ProductCheckTypeWidgetState extends State { productImage: widget.model.wishListList[index].product.images[0].src, productID: widget.model.wishListList[index].product.id, onDelete: deleteWishListItem, + isRx:widget.model.wishListList[index].product.isRx, ), ), 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 ad638be1..18749662 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 @@ -149,7 +149,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { return Container( child: new Wrap( children: [ - if (product.stockAvailability != 'Out of stock') + if (product.stockAvailability != 'Out of stock' && product.isRx != true) new ListTile( leading: Icon(Icons.shopping_cart), title: Text( diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index a70f2cab..00088b59 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -38,8 +38,8 @@ class WishlistPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', + child: Text(TranslationBase.of(context).noData, + // 'There is no data', style: TextStyle(fontSize: 30), ), ) diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index a0b54f9f..60b85361 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1219,8 +1219,7 @@ class _SubCategorisePageState extends State { if (model .subProducts[ index] - .rxMessage == - null) { + .isRx == false) { GifLoaderDialogUtils .showMyDialog( context); diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index b7293ce1..73565ee7 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -2,6 +2,7 @@ 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-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -27,6 +28,7 @@ class productTile extends StatelessWidget { final dynamic productID; final Function onDelete; final dynamic approvedTotalReviews; + final dynamic isRx; // final VoidCallback deleteWishlistItems; @@ -47,6 +49,7 @@ class productTile extends StatelessWidget { this.productID, this.onDelete, this.approvedTotalReviews, + this.isRx }); @override @@ -163,10 +166,14 @@ class productTile extends StatelessWidget { color: Colors.green, ), onPressed: () async { + if(isRx == false){ GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, productID, context); GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage(); + Utils.navigateToCartPage();} + else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } }, ), ], From 127096ec04e5decf1ef58fd904fb9e16451405bd Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 22 Nov 2021 12:00:27 +0300 Subject: [PATCH 4/4] fixed wishlist design --- lib/widgets/pharmacy/product_tile.dart | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 73565ee7..23a6dd9b 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -9,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class productTile extends StatelessWidget { @@ -54,6 +56,7 @@ class productTile extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( height: 180, width: double.infinity, @@ -90,7 +93,16 @@ class productTile extends StatelessWidget { children: [ Container( margin: EdgeInsets.all(5), - child: Align( + child: projectViewModel + .isArabic ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), + ), + ), + ): Align( alignment: Alignment.topLeft, child: RichText( text: TextSpan( @@ -102,7 +114,17 @@ class productTile extends StatelessWidget { ), Container( margin: EdgeInsets.all(5), - child: Align( + child: projectViewModel + .isArabic ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), + ), + ), + ) + :Align( alignment: Alignment.topLeft, child: RichText( text: TextSpan(