From 66acda38a341824f08734ccd3edac2c59c369a66 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 12 Oct 2021 11:22:39 +0300 Subject: [PATCH 1/2] add to cart fix --- .../product-details/footor/footer-widget.dart | 8 ++-- .../pharmacy/bottom_nav_pharmacy_item.dart | 48 ++++++++++++------- 2 files changed, 35 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 583c904f..b941fd33 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -185,7 +185,7 @@ class _FooterWidgetState extends State { width: MediaQuery.of(context).size.width * 0.45, child: SecondaryButton( label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity > 0 || + disabled: !widget.isAvailable && widget.quantity == 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null, disableColor: Color(0xFF4CAF50), @@ -196,9 +196,9 @@ class _FooterWidgetState extends State { ); } else await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); }, fontWeight: FontWeight.w600, borderColor: Color(0xFF4CAF50), diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 94e260d0..880615a4 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -47,7 +47,7 @@ class BottomNavPharmacyItem extends StatelessWidget { splashColor: Colors.transparent, onTap: () { if (!Provider.of(context, listen: false) - .isLogin && + .isLogin && (currentIndex == 2 || currentIndex == 3)) Navigator.push( context, @@ -65,19 +65,19 @@ class BottomNavPharmacyItem extends StatelessWidget { ), currentIndex == index ? Divider( - color: Color(0xff5AB145), - thickness: 3.5, - ) + color: Color(0xff5AB145), + thickness: 3.5, + ) : Divider( - thickness: 0, - ), + thickness: 0, + ), Container( child: Icon(currentIndex == index ? activeIcon : icon, color: isHome ? Color(0xff5AB145) : currentIndex == index - ? Colors.grey - : Colors.grey, + ? Colors.grey + : Colors.grey, size: 22.0), ), SizedBox( @@ -89,26 +89,40 @@ class BottomNavPharmacyItem extends StatelessWidget { title, textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, - fontWeight: - currentIndex == index ? FontWeight.bold : FontWeight.w400, + fontWeight: currentIndex == index + ? FontWeight.bold + : FontWeight.w400, fontSize: currentIndex == index ? 13 : 11, ), ], ), ), ), - if(currentIndex == 3 &&Provider.of(context, listen: false).cartResponse.quantityCount !=0) + if (currentIndex == 3 && + Provider.of(context, listen: false) + .cartResponse + .quantityCount != + 0) Positioned( - top: 5, right: -3.5, + top: 11.5, + right: -4.5, child: Container( decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(15), - + color: Colors.red, + borderRadius: BorderRadius.circular(15), ), - padding: EdgeInsets.only(left: 5, right: 4.5), + padding: EdgeInsets.only(left: 7, right: 6.5), height: 18, - child: Center(child: Texts(Provider.of(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)), + child: Center( + child: Texts( + Provider.of(context, listen: false) + .cartResponse + .quantityCount + .toString(), + style: "caption", + medium: true, + color: Colors.white, + )), ), ) ], From a8fb7152b174c99e441010a76815f86afadbe48c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 12 Oct 2021 11:27:47 +0300 Subject: [PATCH 2/2] add to cart fix --- .../pharmacy/bottom_nav_pharmacy_item.dart | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index acfaa63a..ff0cac32 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -50,7 +50,7 @@ class BottomNavPharmacyItem extends StatelessWidget { splashColor: Colors.transparent, onTap: () { if (!Provider.of(context, listen: false) - .isLogin && + .isLogin && (currentIndex == 2 || currentIndex == 3)) Navigator.push( context, @@ -68,19 +68,19 @@ class BottomNavPharmacyItem extends StatelessWidget { ), currentIndex == index ? Divider( - color: Color(0xff5AB145), - thickness: 3.5, - ) + color: Color(0xff5AB145), + thickness: 3.5, + ) : Divider( - thickness: 0, - ), + thickness: 0, + ), Container( child: Icon(currentIndex == index ? activeIcon : icon, color: isHome ? Color(0xff5AB145) : currentIndex == index - ? Colors.grey - : Colors.grey, + ? Colors.grey + : Colors.grey, size: 22.0), ), SizedBox( @@ -92,8 +92,9 @@ class BottomNavPharmacyItem extends StatelessWidget { title, textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, - fontWeight: - currentIndex == index ? FontWeight.bold : FontWeight.w400, + fontWeight: currentIndex == index + ? FontWeight.bold + : FontWeight.w400, fontSize: currentIndex == index ? 13 : 11, ), ], @@ -110,13 +111,18 @@ class BottomNavPharmacyItem extends StatelessWidget { right: -4.5, child: Container( decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(15), - + color: Colors.red, + borderRadius: BorderRadius.circular(15), ), padding: EdgeInsets.only(left: 7, right: 6.5), height: 18, - child: Center(child: Texts(orderPreviewViewModel.cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)), + child: Center( + child: Texts( + orderPreviewViewModel.cartResponse.quantityCount.toString(), + style: "caption", + medium: true, + color: Colors.white, + )), ), ) ],