diff --git a/lib/pages/pharmacies/screens/product-details/details_info.dart b/lib/pages/pharmacies/screens/product-details/details_info.dart index a347e941..bc5e7f80 100644 --- a/lib/pages/pharmacies/screens/product-details/details_info.dart +++ b/lib/pages/pharmacies/screens/product-details/details_info.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.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:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,13 +23,11 @@ class DetailsInfo extends StatelessWidget { CrossAxisAlignment.start, children: [ Container( - child: Text( + child: Texts( TranslationBase.of(context) .description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + fontSize: 17, + color: Colors.grey, ), ), SizedBox( @@ -39,15 +38,13 @@ class DetailsInfo extends StatelessWidget { height: 15, ), Container( - child: Text( + child: Texts( projectViewModel.isArabic ? product.fullDescriptionn : product .fullDescription ?? "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), + fontSize: 16, ), ), SizedBox( diff --git a/lib/pages/pharmacies/screens/product-details/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footer-widget.dart index db048b46..72a76f39 100644 --- a/lib/pages/pharmacies/screens/product-details/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footer-widget.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -9,7 +10,7 @@ class FooterWidget extends StatefulWidget { final bool isAvailble; final int maxQuantity; final int minQuantity; - final int quantityLimit; + final int quantityLimit; final PharmacyProduct item; final Function addToCartFunction; @@ -403,84 +404,47 @@ class _FooterWidgetState extends State { }, ), ), - !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 190, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - widget.addToCartFunction(widget.price, widget.item.id, context); - }, - child: Container( - alignment: Alignment.center, - width: 190, - height: 46, - color: Colors.green, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), + + Container( + width: MediaQuery.of(context).size.width* 0.4, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction(widget.price, widget.item.id, context); + }, + borderRadius: 5, + color:Colors.green, + + ), ), + SizedBox( width: 5, ), - !widget.isAvailble && widget.price > 0 || - widget.price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 120, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - print('buy now'); - widget.addToCartFunction(widget.price, widget.item.id, context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - child: Container( - alignment: Alignment.center, - width: 120, - height: 46, - color: Colors.blue, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), + + Container( + width: MediaQuery.of(context).size.width* 0.3, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () { + widget.addToCartFunction( + widget.price, widget.item.id, context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + }, + borderRadius: 5, + color: !widget.isAvailble && widget.price > 0 || + widget.price > widget.quantityLimit || + widget.item.rxMessage != null?Colors.grey:Colors.grey[800], ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 015e7958..2a1bfc3f 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -157,8 +157,7 @@ class __ProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - - padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -349,22 +348,26 @@ class __ProductDetailPageState extends State ], ), ), - Row( - children: [ - customerId != null - ? Container( - width: 410, - height: 50, - color: Colors.white, - child: Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - ) - : Container(), - ], - ), - RecommendedProducts(product: widget.product) + + ///TODO Elham* check if we need recommanded + // Row( + // children: [ + // customerId != null + // ? Container( + // width: 410, + // height: 50, + // color: Colors.white, + // child: Texts( + // TranslationBase.of(context).recommended, + // bold: true, + // ), + // ) + // : Container(), + // ], + // ), + // RecommendedProducts(product: widget.product) + + SizedBox(height: 80,) ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 14b94269..0be6a213 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -143,12 +143,13 @@ class _ProductNameAndPriceState extends State { ), SizedBox(width: 10,), Texts( - "${widget.item.approvedTotalReviews}", + "${widget.item.approvedRatingSum}", + fontWeight: FontWeight.bold, fontSize: 12, ), SizedBox(width: 30,), Texts( - "(${widget.item.approvedTotalReviews} ${TranslationBase.of(context).review})", + "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", fontSize: 12, ), ], diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8c4ba851..9d5df436 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -29,7 +29,7 @@ class SecondaryButton extends StatefulWidget { this.small = false, this.disabled = false, this.borderColor, - this.noBorderRadius = false}) + this.noBorderRadius = false, this.borderRadius}) : super(key: key); final String label; @@ -43,6 +43,9 @@ class SecondaryButton extends StatefulWidget { final bool iconOnly; final bool disabled; final bool noBorderRadius; + final double borderRadius; + + @override _SecondaryButtonState createState() => _SecondaryButtonState(); @@ -169,7 +172,7 @@ class _SecondaryButtonState extends State child: ClipRRect( borderRadius: widget.noBorderRadius ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(10.0)), + : BorderRadius.all(Radius.circular(widget.borderRadius??10.0)), child: Stack( children: [ Positioned(