From b7a037819ab31e01aec7cad28c61ab7c05e70b9e Mon Sep 17 00:00:00 2001 From: Atuoha Date: Wed, 12 Oct 2022 12:22:00 +0100 Subject: [PATCH] task: adjustments --- lib/utilities/build_cart.dart | 21 ++++++++++--------- lib/views/main/customer/order.dart | 15 ++++++------- lib/views/main/product/details.dart | 6 +++--- screenshots/{New folder => }/cart_2.png | Bin screenshots/{New folder => }/cart_number.png | Bin 5 files changed, 22 insertions(+), 20 deletions(-) rename screenshots/{New folder => }/cart_2.png (100%) rename screenshots/{New folder => }/cart_number.png (100%) diff --git a/lib/utilities/build_cart.dart b/lib/utilities/build_cart.dart index 1f2193c..8913f79 100644 --- a/lib/utilities/build_cart.dart +++ b/lib/utilities/build_cart.dart @@ -72,18 +72,19 @@ Dismissible buildCart( child: Card( elevation: 3, child: GestureDetector( - onTap: () async{ - await FirebaseFirestore.instance + onTap: () async { + print('dkfjsdklfjsdklf'); + await FirebaseFirestore.instance .collection('products') .doc(item.docId) - .get().then((value) => - - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => DetailsScreen(product: value), - ), - ) - ); + .get() + .then( + (value) => Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => DetailsScreen(product: value), + ), + ), + ); }, child: ListTile( contentPadding: const EdgeInsets.only( diff --git a/lib/views/main/customer/order.dart b/lib/views/main/customer/order.dart index f0a7c48..46812ed 100644 --- a/lib/views/main/customer/order.dart +++ b/lib/views/main/customer/order.dart @@ -236,13 +236,14 @@ class CustomerOrderScreen extends StatelessWidget { .collection('products') .doc(subData.docId) .get() - .then((value) => - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - DetailsScreen(product: value), - ), - )); + .then( + (value) => Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => + DetailsScreen(product: value), + ), + ), + ); }, icon: const Icon( Icons.chevron_right, diff --git a/lib/views/main/product/details.dart b/lib/views/main/product/details.dart index 646e10f..9eb2db6 100644 --- a/lib/views/main/product/details.dart +++ b/lib/views/main/product/details.dart @@ -184,12 +184,12 @@ class _DetailsScreenState extends State floatingActionButton: FloatingActionBubble( items: [ Bubble( - title: cartData.isItemOnCart(widget.product.prod_id) + title: cartData.isItemOnCart(widget.product['prod_id']) ? "Remove from cart" : "Add to cart", iconColor: Colors.white, bubbleColor: primaryColor, - icon: cartData.isItemOnCart(widget.product.prod_id) + icon: cartData.isItemOnCart(widget.product['prod_id']) ? Icons.shopping_cart : Icons.shopping_cart_outlined, titleStyle: const TextStyle( @@ -197,7 +197,7 @@ class _DetailsScreenState extends State color: Colors.white, ), onPress: () { - if (cartData.isItemOnCart(widget.product.prod_id)) { + if (cartData.isItemOnCart(widget.product['prod_id'])) { removeFromCart(); } else { addToCart(); diff --git a/screenshots/New folder/cart_2.png b/screenshots/cart_2.png similarity index 100% rename from screenshots/New folder/cart_2.png rename to screenshots/cart_2.png diff --git a/screenshots/New folder/cart_number.png b/screenshots/cart_number.png similarity index 100% rename from screenshots/New folder/cart_number.png rename to screenshots/cart_number.png