From 8f044a635a18b3a10d2bcf097b23c01e02a1a003 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 28 Nov 2021 14:31:28 +0200 Subject: [PATCH] fix footer design --- .../product-details/footor/footer-widget.dart | 58 +++++++++++++------ lib/widgets/buttons/secondary_button.dart | 10 ++-- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index e0cf8168..3807714e 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -57,7 +57,15 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: Color(0xFF707070), width: 0), + boxShadow: [ + BoxShadow( + color: Color(0xFFCCCCCC), + spreadRadius: 0, + blurRadius: 4, + offset: Offset(2, 2), // changes position of shadow + ), + ], + // border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, @@ -219,12 +227,12 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).addToCart, - disabled: (!widget.isAvailable && widget.quantity > 0) || - widget.quantity > widget.quantityLimit || - widget.item.isRx, - fontSize: 16, + disabled: isAddToCartDisable(), + fontSize: 15, onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -235,8 +243,9 @@ class _FooterWidgetState extends State { model: widget.model); }, fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50).withOpacity(0.7), borderRadius: 6, + disableColor:Color(0xFFD6D6D6), + textColor: isAddToCartDisable()?Color(0xFFACACAC):Colors.white, color: Color(0xFF535353), ), ), @@ -245,12 +254,13 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).buyNow, - fontSize: 16, - disabled: (!widget.isAvailable && widget.quantity > 0) || - (widget.quantity > widget.quantityLimit) || - widget.item.isRx, + fontSize: 15, + disabled: isBuyNowDisable(), + onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -261,15 +271,11 @@ class _FooterWidgetState extends State { model: widget.model); } }, + textColor: isBuyNowDisable()?Color(0xFFACACAC):Colors.white, fontWeight: FontWeight.w600, - borderColor: Colors.grey[800].withOpacity(0.7), borderRadius: 6, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.isRx - ? Color(0xFF535353).withOpacity(0.7) - : Color(0xFF5AB145), + disableColor: Color(0xFFD6D6D6), + color: Color(0xFF5AB145), ), ), ], @@ -280,6 +286,24 @@ class _FooterWidgetState extends State { ); } + bool isBuyNowDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + (widget.quantity > widget.quantityLimit) || + widget.item.isRx; + + + } + + bool isAddToCartDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + widget.quantity > widget.quantityLimit || + widget.item.isRx; + + + } + void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8f0ae5f1..a5ac63aa 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -200,9 +200,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width * 2.2, height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( - shape: BoxShape.circle, + // shape: BoxShape.circle, color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor, ), ), @@ -212,8 +212,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -246,8 +246,10 @@ class _SecondaryButtonState extends State bottom: widget.small ? 4.0 : 3.0), child: Text( widget.label, + textAlign: TextAlign.center, style: TextStyle( color: widget.textColor, + fontSize: widget.small ? 12.0 : widget.fontSize??14.0, fontWeight: FontWeight.w700, fontFamily: projectViewModel.isArabic