diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 968fe029..014ba7fb 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -49,7 +49,7 @@ class ProductDetailViewModel extends BaseViewModel{ Future notifyMe(customerId, itemID) async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _productDetailService.notifyMe(customerId, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -60,7 +60,7 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToCartData(quantity, itemID) async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _productDetailService.addToCart(quantity, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index fb4b934f..ff1fc5b7 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -16,7 +16,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'base/base_view.dart'; class ParentCategorisePage extends StatefulWidget { @@ -119,78 +119,65 @@ class _ParentCategorisePageState extends State { ), ), onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: - Axis.vertical, - itemCount: model - .categoriseParent.length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Padding( - padding: - EdgeInsets.all(4.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts(projectViewModel - .isArabic - ? model - .categoriseParent[ - index] - .namen - : model - .categoriseParent[ - index] - .name), - Divider( - thickness: 0.6, - color: Colors - .black12, - ) - ], - ), - onTap: () { - Navigator.push( - context, - FadePage( - page: - SubCategorisePage( - title: model - .categoriseParent[ - index] - .name, - id: model - .categoriseParent[ - index] - .id, - parentId: id, - )), - ); - }, - ), - ), - ); - }), - ), - ); - }, + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + ) + ), ); +// showModalBottomSheet( +// isScrollControlled: true, +// context: context, +// builder: (BuildContext context) { +// return Container( +// // height: MediaQuery.of(context) +// // .size +// // .height * +// // 0.89, +// color: Colors.white, +// child: Center( +// child: ListView.builder( +// scrollDirection: Axis.vertical, +// itemCount: model.categoriseParent.length, +// itemBuilder: (BuildContext context, int index) { +// return Container( +// child: Padding( +// padding: EdgeInsets.all(4.0), +// child: InkWell( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Texts(projectViewModel.isArabic +// ? model.categoriseParent[index].namen +// : model.categoriseParent[index].name), +// Divider( +// thickness: 0.6, +// color: Colors.black12, +// ) +// ], +// ), +// onTap: () { +// Navigator.push( +// context, +// FadePage( +// page: SubCategorisePage( +// title: model.categoriseParent[index].name, +// id: model.categoriseParent[index].id, +// parentId: id, +// )), +// ); +// }, +// ), +// ), +// ); +// }), +// ), +// ); +// }, +// ); }, ), ), @@ -347,16 +334,21 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - 'Refine', + + TranslationBase.of(context).refine, +// 'Refine', + fontWeight: FontWeight.w600, + ), SizedBox( width: 250.0, ), InkWell( child: Texts( - 'Close', +// 'Close', + TranslationBase.of(context).closeIt, color: Colors.red, fontWeight: FontWeight.w600, @@ -377,8 +369,10 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: - Texts('Categorise'), + + title: Texts( TranslationBase.of( + context) + .categorise), children: [ ProcedureListWidget( model: model, @@ -416,7 +410,9 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Brands'), + title: Texts( TranslationBase.of( + context) + .brands), children: [ ProcedureListWidget( model: model, @@ -455,7 +451,9 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Price'), + title: Texts( TranslationBase.of( + context) + .price), children: [ Container( color: Color( @@ -546,9 +544,14 @@ class _ParentCategorisePageState extends State { Container( width: 100, child: Button( - label: 'Reset', - backgroundColor: - Colors.red, + + label: TranslationBase.of( + context) + .reset, + backgroundColor: Colors.red, + + + ), ), SizedBox( @@ -612,10 +615,13 @@ class _ParentCategorisePageState extends State { Navigator.pop( context); }, - label: 'Apply', - backgroundColor: - Colors - .green, + + label: TranslationBase.of( + context) + .apply, + backgroundColor: Colors.green, + + ), ), ], diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index 47aa382f..08ba3d14 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -44,8 +44,8 @@ class _MyReviewsPageState extends State { ), 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), ), ) @@ -121,7 +121,7 @@ reviewDetails(data, rate, myRate) { : data.product.name, style: TextStyle( color: Colors.black54, - fontSize: languageID == 'ar' ? 7 : 13, + fontSize: languageID == 'ar' ? 12 : 13, fontWeight: FontWeight.bold), ), ), @@ -187,7 +187,7 @@ reviewDetails(data, rate, myRate) { padding: languageID == 'ar' ? EdgeInsets.only(right: 10) : EdgeInsets.only(left: 10), - child: Text(data.createdOnUtc.toString())), + child: Text(data.createdOnUtc.toString().substring(0 , 11))), ], ), ), 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 854f5d4c..583c904f 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,5 +1,6 @@ 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/product-details/footor/quantity_box.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -10,6 +11,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; import '../../cart-order-page.dart'; +import '../product-detail.dart'; class FooterWidget extends StatefulWidget { final bool isAvailable; @@ -18,13 +20,17 @@ class FooterWidget extends StatefulWidget { final int quantityLimit; final PharmacyProduct item; final Function addToCartFunction; + final ProductDetailViewModel model; int quantity; bool isOverQuantity; FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, - {this.quantity, this.isOverQuantity = false, this.addToCartFunction}); + {this.quantity, + this.isOverQuantity = false, + this.addToCartFunction, + this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -98,38 +104,31 @@ class _FooterWidgetState extends State { label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), - Column( - children: [ - Container( - width: 100, - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey[300]), - color: Colors.white, - ), - child: TextField( - decoration: InputDecoration( - labelText: 'quantity #'), - onChanged: (text) { - print(widget.quantity); - print(widget.quantityLimit); - if (int.tryParse(text) == null) { - text = ''; + Container( + width: 100, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey[300]), + color: Colors.white, + ), + child: TextField( + decoration: InputDecoration( + labelText: ' Quantity # '), + onChanged: (text) { + if (int.tryParse(text) == null) { + text = ''; + } else { + setState(() { + widget.quantity = int.parse(text); + if (widget.quantity >= + widget.quantityLimit) { + widget.isOverQuantity = true; } else { - setState(() { - widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { - widget.isOverQuantity = true; - } else { - widget.isOverQuantity = false; - } - }); + widget.isOverQuantity = false; } - }, - ), - ), - ], + }); + } + }, + ), ), ], ), @@ -175,7 +174,7 @@ class _FooterWidgetState extends State { quantityUI = 80; showUI = false; } else { - quantityUI = 150; + quantityUI = 160; showUI = true; } }); @@ -197,10 +196,13 @@ class _FooterWidgetState extends State { ); } else await widget.addToCartFunction( - widget.quantity, widget.item.id, context); + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); }, + fontWeight: FontWeight.w600, borderColor: Color(0xFF4CAF50), - borderRadius: 5, + borderRadius: 3, color: Color(0xFF4CAF50), ), ), @@ -215,14 +217,18 @@ class _FooterWidgetState extends State { widget.quantity > widget.quantityLimit || widget.item.rxMessage != null, onTap: () async { - await widget.addToCartFunction( - widget.quantity, widget.item.id, context); + await widget.addToCartFunction( + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); Navigator.push( context, FadePage(page: CartOrderPage()), ); }, - borderRadius: 5, + fontWeight: FontWeight.w600, + borderColor: Colors.grey[800], + borderRadius: 3, disableColor: Colors.grey[700], color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 6ac5ec25..ef3b7d8a 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -103,7 +104,8 @@ class __ProductDetailPageState extends State { deleteFromWishlistFunction: () async { await deleteFromWishlistFunction(itemID: itemID, model: model); }, - isInWishList:isInWishList + isInWishList:isInWishList, + addToCartFunction:addToCartFunction , ), body: SingleChildScrollView( child: Column( @@ -309,8 +311,9 @@ class __ProductDetailPageState extends State { ), ), SizedBox( - height: 80, - ) + height: 10, + ), + RecommendedProducts(product: widget.product) ], ), ), @@ -323,6 +326,7 @@ class __ProductDetailPageState extends State { quantity: quantity, isOverQuantity: isOverQuantity, addToCartFunction: addToCartFunction, + model: model, ), )); } @@ -338,17 +342,17 @@ class __ProductDetailPageState extends State { await model.deleteWishlistData(itemID); setState(() {}); } + addToCartFunction( + {quantity, + itemID, + ProductDetailViewModel model}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.addToCartData(quantity, itemID); + GifLoaderDialogUtils.hideDialog(context); + } } -addToCartFunction( - {quantity, - itemID, - BuildContext context, - ProductDetailViewModel model}) async { - GifLoaderDialogUtils.showMyDialog(context); - await model.addToCartData(quantity, itemID); - GifLoaderDialogUtils.hideDialog(context); -} + notifyMeWhenAvailable( {itemId, customerId, ProductDetailViewModel model}) async { diff --git a/lib/pages/pharmacies/screens/product-details/recommended_products.dart b/lib/pages/pharmacies/screens/product-details/recommended_products.dart new file mode 100644 index 00000000..2070a29e --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/recommended_products.dart @@ -0,0 +1,377 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class RecommendedProducts extends StatefulWidget { + final PharmacyProduct product; + final String customerId; + final ProductDetailViewModel productDetailViewModel; + final bool isOverQuantity; + final bool isInWishList; + final Function addToWishlistFunction; + final Function deleteFromWishlistFunction; + + RecommendedProducts( + {Key key, + this.product, + this.productDetailViewModel, + this.customerId, + this.isOverQuantity = false, + this.isInWishList = false, + this.addToWishlistFunction, + this.deleteFromWishlistFunction}) + : super(key: key); + + @override + _RecommendedProductsState createState() => _RecommendedProductsState(); +} + +class _RecommendedProductsState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return SingleChildScrollView( + child: Container( + width: 410, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 9), + width: 410, + color: Colors.white, + child: Texts( + TranslationBase.of(context).recommended, + fontWeight: FontWeight.bold, fontSize: 16 + ), + ), + Container( + color: Colors.white, + height: 210, + margin: EdgeInsets.only(bottom: 75), + padding: EdgeInsets.only(bottom: 5), + // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), + child: BaseView( + onModelReady: (model) => + model.getRecommendedProducts(widget.product.id), + builder: (_, model, wi) => NetworkBaseView( + isLocalLoader: true, + baseViewModel: model, + child: Container( + child: model.state== ViewState.BusyLocal?Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ):model.recommendedProductList.length != null + ? ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + RecommendedProductModel data = + model.recommendedProductList[index]; + var json = data.toJson(); + PharmacyProduct product = + new PharmacyProduct.fromJson(json); + await Navigator.pushReplacement( + context, + FadePage( + page: ProductDetailPage(product), + ), + ); + GifLoaderDialogUtils.hideDialog(context); + }, + child: Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 0, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: IconButton( + icon: Icon(model + .recommendedProductList[ + index] + .isinwishlist != + true + ? Icons.favorite_border + : Icons.favorite), + color: model + .recommendedProductList[ + index] + .isinwishlist != + true + ? Colors.grey + : Colors.red, + onPressed: () async { + if (widget.customerId != null) { + if (!widget.isInWishList && + model + .recommendedProductList[ + index] + .isinwishlist != + true) { + GifLoaderDialogUtils + .showMyDialog(context); + await widget.addToWishlistFunction( + itemID: model + .recommendedProductList[ + index] + .id, + model: widget + .productDetailViewModel); +// checkWishlist(); + GifLoaderDialogUtils + .hideDialog(context); + setState(() { + model + .recommendedProductList[ + index] + .isinwishlist = true; + }); + } else { + GifLoaderDialogUtils + .showMyDialog(context); + await widget.deleteFromWishlistFunction( + itemID: model + .recommendedProductList[ + index] + .id, + model: widget + .productDetailViewModel); + GifLoaderDialogUtils + .hideDialog(context); + setState(() { + model + .recommendedProductList[ + index] + .isinwishlist = false; + }); + } + } else { + return; + } + setState(() { + // checkWishlist(); + }); + }, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 10, 16), + alignment: Alignment.center, + child: (model + .recommendedProductList[ + index] + .images != + null && + model + .recommendedProductList[ + index] + .images + .length > + 0) + ? Image.network( + model + .recommendedProductList[ + index] + .images[0] + .src + .toString(), + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), + ), + Container( + width: model + .recommendedProductList[ + index] + .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: model + .recommendedProductList[ + index] + .rxMessage != + null + ? Texts( + projectViewModel.isArabic + ? model + .recommendedProductList[ + index] + .rxMessagen + : model + .recommendedProductList[ + index] + .rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + : Texts(""), + ), + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + projectViewModel.isArabic + ? model + .recommendedProductList[ + index] + .namen + : model + .recommendedProductList[ + index] + .name, + style: TextStyle( + color: Colors.black, + fontSize: 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets.only( + top: 10, bottom: 5), + child: Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.only(right: 10), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[ + index] + .approvedRatingSum + .toDouble(), + size: 13.0, + filledColor: + Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: + Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ), + ); + }) + : Container( + // color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).nonRecommended, + color: Colors.black, + ), + ], + ), + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} 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 8069d0ed..ee1bcd60 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 @@ -23,6 +23,8 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { final Function deleteFromWishlistFunction; final int quantity; final bool isInWishList; + final Function addToCartFunction; + ProductAppBar( {Key key, @@ -31,7 +33,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { this.addToWishlistFunction, this.quantity, this.deleteFromWishlistFunction, - this.isInWishList}) + this.isInWishList, this.addToCartFunction}) : super(key: key); AuthenticatedUserObject authenticatedUserObject = @@ -83,7 +85,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { top:0, right: -1.0, child: Container( decoration: BoxDecoration( - color: Colors.red, + color: Colors.red[800], borderRadius: BorderRadius.circular(15), ), @@ -136,7 +138,6 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { await addToCartFunction( quantity: quantity, itemID: itemID, - context: context, model: model); Navigator.of(context).pop(); diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 2ba92674..7ffcbdbd 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -243,9 +243,10 @@ class _OrderPageState extends State color: Colors.blue[700], borderRadius: BorderRadius.circular(30.0)), - child: deliveredOrderList[index] - .orderStatusId == - 30 + child: deliveredOrderList[index].orderStatusId == 30 || + deliveredOrderList[index].orderStatusId == 997 || + deliveredOrderList[index].orderStatusId == 994 +// deliveredOrderList[index].orderStatusId == 30 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) @@ -508,9 +509,11 @@ class _OrderPageState extends State color: Colors.green, borderRadius: BorderRadius.circular(30.0)), - child: processingOrderList[index] - .orderStatusId == - 20 + child: processingOrderList[index].orderStatusId == 20 || + processingOrderList[index].orderStatusId == 995 || + processingOrderList[index].orderStatusId == 998 || + processingOrderList[index].orderStatusId == 999 +// processingOrderList[index].orderStatusId == 20 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 2f113e50..1275042a 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -121,17 +121,40 @@ class _OrderDetailsPageState extends State { ), color: getStatusBackgroundColor(), borderRadius: BorderRadius.circular(30.0)), - child: Text( + child: model.orderListModel[0].orderStatusId == 30 || + model.orderListModel[0].orderStatusId == 997 || + model.orderListModel[0].orderStatusId == 994 +// deliveredOrderList[index].orderStatusId == 30 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( languageID == "ar" - ? model.orderListModel[0].orderStatusn - : model.orderListModel[0].orderStatus, -// TranslationBase.of(context).delivered, + ? model.orderListModel[0].orderStatusn.toString() + : model.orderListModel[0].orderStatus.toString(), style: TextStyle( color: Colors.white, fontSize: 13.0, fontWeight: FontWeight.bold, ), - ), + ) +// Text( +// languageID == "ar" +// ? model.orderListModel[0].orderStatusn +// : model.orderListModel[0].orderStatus, +//// TranslationBase.of(context).delivered, +// style: TextStyle( +// color: Colors.white, +// fontSize: 13.0, +// fontWeight: FontWeight.bold, +// ), +// ), ), ], ), diff --git a/lib/pages/sub_categories_modalsheet.dart b/lib/pages/sub_categories_modalsheet.dart new file mode 100644 index 00000000..f1ff0e08 --- /dev/null +++ b/lib/pages/sub_categories_modalsheet.dart @@ -0,0 +1,108 @@ + +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'base/base_view.dart'; +import 'package:provider/provider.dart'; + + + + +class SubCategoriseModalsheet extends StatefulWidget { + String id; + String titleName; + + SubCategoriseModalsheet({this.id, this.titleName}); + @override + _SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName); + +} + +class _SubCategoriseModalsheetState extends State { + String id; + String titleName; +// List categoriesList = []; + _SubCategoriseModalsheetState({this.id, this.titleName}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategoriseParent(i: id), + builder: (_, model, wi) => AppScaffold( + // appBarTitle: titleName, + appBarTitle: TranslationBase.of(context).categorise, + isBottomBar: false, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.categoriseParent.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(projectViewModel.isArabic + ? model.categoriseParent[index].namen + : model.categoriseParent[index].name), + SizedBox( + height: 10, + ), + Divider( + thickness: 0.6, + color: Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), + ), + ); + }), + ), + ), + + ), + ); + } +// getCatName() { +// +// if (widget.id == '1' ) +// return Texts("text1"); +// else if (widget.id == '2' ) +// return Texts("text2"); +// else if (widget.id == '3') +// return Texts("text3"); +// else if (widget.id == '4' ) +// return Texts("text4"); +// } + + +} \ No newline at end of file diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 51c535b9..bfa7e343 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -23,7 +23,8 @@ class SubCategorisePage extends StatefulWidget { SubCategorisePage({this.id, this.parentId, this.title}); @override - _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); + _SubCategorisePageState createState() => + _SubCategorisePageState(id: id, title: title, parentId: parentId); } class _SubCategorisePageState extends State { @@ -51,7 +52,9 @@ class _SubCategorisePageState extends State { TextEditingController maxField = TextEditingController(); return BaseView( onModelReady: (model) => model.getSubCategorise(i: id), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( appBarTitle: title, isBottomBar: false, isShowAppBar: true, @@ -83,7 +86,8 @@ class _SubCategorisePageState extends State { ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' : parentId == '9' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : parentId == '10' + : parentId == + '10' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' : '', fit: BoxFit.fill, @@ -95,12 +99,14 @@ class _SubCategorisePageState extends State { children: [ InkWell( child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(10.0), child: Container( - child: Texts(TranslationBase.of(context).viewCategorise), + child: Texts(TranslationBase.of(context) + .viewCategorise), ), ), Icon(Icons.arrow_forward) @@ -112,21 +118,30 @@ class _SubCategorisePageState extends State { context: context, builder: (BuildContext context) { return Container( - height: MediaQuery.of(context).size.height * 0.89, + height: + MediaQuery.of(context).size.height * + 0.89, color: Colors.white, child: Center( child: ListView.builder( scrollDirection: Axis.vertical, - itemCount: model.subCategorise.length, - itemBuilder: (BuildContext context, int index) { + itemCount: + model.subCategorise.length, + itemBuilder: (BuildContext context, + int index) { return Container( child: Padding( padding: EdgeInsets.all(8.0), child: InkWell( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - Texts(model.subCategorise[index].name), + Texts(model + .subCategorise[ + index] + .name), Divider( thickness: 0.6, color: Colors.black12, @@ -137,8 +152,12 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: FinalProductsPage( - id: model.subCategorise[index].id, + page: + FinalProductsPage( + id: model + .subCategorise[ + index] + .id, ), ), ); @@ -171,19 +190,23 @@ class _SubCategorisePageState extends State { itemCount: model.subCategorise.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), + padding: + EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 13.0), + padding: EdgeInsets.symmetric( + horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200.withOpacity(0.45), + color: Colors.orange.shade200 + .withOpacity(0.45), ), child: Center( child: Icon( @@ -194,8 +217,14 @@ class _SubCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context).size.width * 0.17, - height: MediaQuery.of(context).size.height * 0.10, + width: MediaQuery.of(context) + .size + .width * + 0.17, + height: MediaQuery.of(context) + .size + .height * + 0.10, child: Center( child: Texts( model.subCategorise[index].name, @@ -256,16 +285,21 @@ class _SubCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, + ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context).size.height * 1.95, + height: MediaQuery.of(context) + .size + .height * + 1.95, child: Column( children: [ Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -275,23 +309,30 @@ class _SubCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of(context).refine, + TranslationBase.of( + context) + .refine, // 'Refine', - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, ), SizedBox( width: 250.0, ), InkWell( child: Texts( - TranslationBase.of(context).closeIt, + TranslationBase.of( + context) + .closeIt, // 'Close', color: Colors.red, - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop(context); + Navigator.pop( + context); }, ), ], @@ -304,27 +345,39 @@ class _SubCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts(TranslationBase.of(context).categorise), + title: Texts( + TranslationBase.of( + context) + .categorise), children: [ ProcedureListWidget( model: model, - masterList: model.subCategorise, - removeHistory: (item) { + masterList: model + .subCategorise, + removeHistory: + (item) { setState(() { - entityList.remove(item); + entityList + .remove( + item); }); }, - addHistory: (history) { + addHistory: + (history) { setState(() { - entityList.add(history); + entityList.add( + history); }); }, - addSelectedHistories: () { + addSelectedHistories: + () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => - isEntityListSelected(master), + isEntityListSelected: + (master) => + isEntityListSelected( + master), ) ], ), @@ -333,27 +386,40 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts(TranslationBase.of(context).brands), + title: Texts( + TranslationBase.of( + context) + .brands), children: [ ProcedureListWidget( model: model, - masterList: model.brandsList, - removeHistory: (item) { + masterList: model + .brandsList, + removeHistory: + (item) { setState(() { - entityListBrands.remove(item); + entityListBrands + .remove( + item); }); }, - addHistory: (history) { + addHistory: + (history) { setState(() { - entityListBrands.add(history); + entityListBrands + .add( + history); }); }, - addSelectedHistories: () { + addSelectedHistories: + () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => - isEntityListSelectedBrands(master), + isEntityListSelected: + (master) => + isEntityListSelectedBrands( + master), ) ], ), @@ -362,43 +428,69 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts(TranslationBase.of(context).price), + title: Texts( + TranslationBase.of( + context) + .price), children: [ Container( - color: Color(0xffEEEEEE), + color: Color( + 0xffEEEEEE), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: + MainAxisAlignment + .spaceAround, children: [ Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ - Texts('Min'), + Texts( + 'Min'), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - controller: minField, + controller: + minField, ), ), ], ), Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ - Texts('Max'), + Texts( + 'Max'), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - controller: maxField, + controller: + maxField, ), ), ], @@ -413,20 +505,31 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of(context).size.height * 0.4, + height: MediaQuery.of( + context) + .size + .height * + 0.4, ), Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, children: [ Expanded( child: Container( width: 100, child: Button( - label: TranslationBase.of(context).reset, + label: TranslationBase.of( + context) + .reset, // 'Reset', - backgroundColor: Colors.red, + backgroundColor: + Colors + .red, ), ), ), @@ -436,37 +539,66 @@ class _SubCategorisePageState extends State { Container( width: 200, child: Button( - onTap: () async { - String categoriesId = ""; - for (CategoriseParentModel category in entityList) { - if (categoriesId == "") { - categoriesId = category.id; + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = + category + .id; } else { - categoriesId = "$categoriesId,${category.id}"; + categoriesId = + "$categoriesId,${category.id}"; } } - String brandIds = ""; + String + brandIds = + ""; for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == "") { - brandIds = brand.id; + if (brandIds == + "") { + brandIds = + brand + .id; } else { - brandIds = "$brandIds,${brand.id}"; + brandIds = + "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils + .showMyDialog( + context); await model.getFilteredSubProducts( - min: minField.text.toString(), - max: maxField.text.toString(), - categoryId: categoriesId, - brandId: brandIds); - GifLoaderDialogUtils.hideDialog(context); - Navigator.pop(context); + min: minField + .text + .toString(), + max: maxField + .text + .toString(), + categoryId: + categoriesId, + brandId: + brandIds); + GifLoaderDialogUtils + .hideDialog( + context); + Navigator.pop( + context); }, - label: TranslationBase.of(context).apply, + label: TranslationBase.of( + context) + .apply, // 'Apply', - backgroundColor: Colors.green, + backgroundColor: + Colors + .green, ), ), ], @@ -533,22 +665,28 @@ class _SubCategorisePageState extends State { model.subProducts.isNotEmpty ? styleOne == true ? Container( - height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15, + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 0.9, ), itemCount: model.subProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.subProducts[index].discountName != null + color: model.subProducts[index] + .discountName != + null ? Color(0xffFFFF00) : Colors.white, elevation: 0, @@ -576,67 +714,118 @@ class _SubCategorisePageState extends State { ), child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(110.0), ), color: Colors.white, ), - padding: EdgeInsets.symmetric(horizontal: 0), - width: MediaQuery.of(context).size.width / 3, + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Stack( children: [ Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, + margin: EdgeInsets + .fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, child: Image.network( - model.subProducts[index].images.isNotEmpty - ? model.subProducts[index].images[0].thumb + model + .subProducts[ + index] + .images + .isNotEmpty + ? model + .subProducts[ + index] + .images[0] + .thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model.subProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .subProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + BorderRadius.only( + topLeft: Radius + .circular( + 6)), ), child: Texts( - model.subProducts[index].rxMessage != null - ? model.subProducts[index].rxMessage + model + .subProducts[ + index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), ), ], ), Container( - margin: EdgeInsets.symmetric( + margin: + EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ Texts( - model.subProducts[index].name, + model + .subProducts[ + index] + .name, regular: true, fontSize: 12, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -646,21 +835,25 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.subProducts[index].approvedRatingSum > 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model.subProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum.toDouble() / + model.subProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight + .w400, ) ], ), @@ -675,7 +868,9 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.subProducts[index]), + page: ProductDetailPage( + model.subProducts[ + index]), )), }, )); @@ -683,11 +878,14 @@ class _SubCategorisePageState extends State { ), ) : Container( - height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122, + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.subProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -697,9 +895,11 @@ class _SubCategorisePageState extends State { Column( children: [ Container( - decoration: BoxDecoration(), + decoration: + BoxDecoration(), child: Padding( - padding: EdgeInsets.only( + padding: + EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -707,11 +907,22 @@ class _SubCategorisePageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, child: Image.network( - model.subProducts[index].images.isNotEmpty - ? model.subProducts[index].images[0].thumb + model + .subProducts[ + index] + .images + .isNotEmpty + ? model + .subProducts[ + 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, @@ -722,23 +933,45 @@ class _SubCategorisePageState extends State { Column( children: [ Container( - width: model.subProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .subProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + BorderRadius.only( + topLeft: Radius + .circular( + 6)), ), child: Texts( - model.subProducts[index].rxMessage != null - ? model.subProducts[index].rxMessage + model + .subProducts[ + index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), ), ], @@ -752,19 +985,31 @@ class _SubCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of(context).size.width * 0.65, + width: MediaQuery.of( + context) + .size + .width * + 0.65, child: Texts( - model.subProducts[index].name, + model + .subProducts[ + index] + .name, regular: true, fontSize: 13.2, - fontWeight: FontWeight.w500, + fontWeight: + FontWeight.w500, maxLines: 5, ), ), @@ -772,7 +1017,11 @@ class _SubCategorisePageState extends State { height: 8.0, ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -782,20 +1031,26 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.subProducts[index].approvedRatingSum > 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model.subProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum + .toDouble() / + model + .subProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, forceStars: true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ) ], ), @@ -809,7 +1064,8 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.subProducts[index]), + page: ProductDetailPage( + model.subProducts[index]), )), }, ); @@ -851,7 +1107,8 @@ class _SubCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = entityList.where((element) => masterKey.id == element.id); + Iterable history = + entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -859,7 +1116,8 @@ class _SubCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = + entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 990b5f23..4f457cad 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -89,6 +89,9 @@ class ProductDetailService extends BaseService { "language_id": 1 } }; + + + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, onSuccess: (dynamic response, int statusCode) { _addToCartModel.clear(); diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart index 44839955..c85d68e2 100644 --- a/lib/services/pharmacy_services/review_service.dart +++ b/lib/services/pharmacy_services/review_service.dart @@ -28,6 +28,8 @@ class ReviewService extends BaseService { _reviewList.clear(); response['reviews'].forEach((item) { _reviewList.add(Review.fromJson(item)); + print (response); + print (item['reviewText']); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 4b2f23a9..4ada4d86 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -29,7 +29,10 @@ class SecondaryButton extends StatefulWidget { this.small = false, this.disabled = false, this.borderColor, - this.noBorderRadius = false, this.borderRadius, this.disableColor}) + this.noBorderRadius = false, + this.borderRadius, + this.disableColor, + this.fontWeight}) : super(key: key); final String label; @@ -45,7 +48,7 @@ class SecondaryButton extends StatefulWidget { final bool noBorderRadius; final double borderRadius; final Color disableColor; - + final FontWeight fontWeight; @override @@ -173,7 +176,8 @@ class _SecondaryButtonState extends State child: ClipRRect( borderRadius: widget.noBorderRadius ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(widget.borderRadius??10.0)), + : BorderRadius.all( + Radius.circular(widget.borderRadius ?? 10.0), ), child: Stack( children: [ Positioned( @@ -184,7 +188,7 @@ class _SecondaryButtonState extends State height: 100, decoration: BoxDecoration( color: widget.disabled - ? widget.disableColor??Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor), ), ), @@ -246,7 +250,7 @@ class _SecondaryButtonState extends State style: TextStyle( color: widget.textColor, fontSize: widget.small ? 12.0 : 14.0, - // fontWeight: FontWeight.w800, + fontWeight: widget.fontWeight, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),