Skip to content

Commit 188055f

Browse files
bug fix (Add quantity to cart)
1 parent 5701b44 commit 188055f

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

lib/views/category_screen_view/item_details.dart

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,23 @@ class ItemDetails extends StatelessWidget {
340340
child: customButton(
341341
title: "Add to cart",
342342
onPressed: () {
343-
controller.addToCart(
344-
color: data['p_colors'][controller.colorIndex.value],
345-
image: data['p_images'][0],
346-
quantity: controller.quantity.value,
347-
sellerName: data['p_seller'],
348-
title: data['p_name'],
349-
totalPrice: controller.totalPrice.value,
350-
vendorId: data['vendor_id'],
351-
context: context,
352-
);
353-
VxToast.show(context, msg: "Added to Cart");
354-
controller.resetValues();
355-
Get.back();
343+
if (controller.quantity.value > 0) {
344+
controller.addToCart(
345+
color: data['p_colors'][controller.colorIndex.value],
346+
image: data['p_images'][0],
347+
quantity: controller.quantity.value,
348+
sellerName: data['p_seller'],
349+
title: data['p_name'],
350+
totalPrice: controller.totalPrice.value,
351+
vendorId: data['vendor_id'],
352+
context: context,
353+
);
354+
VxToast.show(context, msg: "Added to Cart");
355+
controller.resetValues();
356+
Get.back();
357+
} else {
358+
VxToast.show(context, msg: "Please select Quantity");
359+
}
356360
},
357361
color: redColor,
358362
textColor: whiteColor,

0 commit comments

Comments
 (0)