fixed issue add to cart
This commit is contained in:
@@ -36,6 +36,7 @@ class ProductProvider extends ChangeNotifier {
|
||||
bool hasMore = true;
|
||||
|
||||
bool iscroll = true;
|
||||
|
||||
Future<void> gettAllProduct(
|
||||
BuildContext context, String id, bool status, String search) async {
|
||||
if (isLoadingg || !hasMore) return;
|
||||
@@ -132,12 +133,13 @@ class ProductProvider extends ChangeNotifier {
|
||||
ProductDetailsData productDetails = ProductDetailsData();
|
||||
bool isProductLoading = true;
|
||||
|
||||
Future<void> getProduuctDetails(BuildContext context, String id) async {
|
||||
Future<void> getProduuctDetails(
|
||||
BuildContext context, String id, int quantity, String price) async {
|
||||
var data = {};
|
||||
productDetails = ProductDetailsData();
|
||||
isProductLoading = true;
|
||||
quantitys = 1;
|
||||
_totalPrice = 0.0;
|
||||
quantitys = quantity;
|
||||
_totalPrice = quantity * (double.parse(price));
|
||||
notifyListeners();
|
||||
|
||||
var result = await _homeRepo.getProductDetails(data, context, id);
|
||||
@@ -435,11 +437,13 @@ class ProductProvider extends ChangeNotifier {
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text("Something went wrong"),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
Fluttertoast.showToast(
|
||||
msg: "Insufficient stock!",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
backgroundColor: Colors.red,
|
||||
textColor: Colors.white,
|
||||
fontSize: 14.0,
|
||||
);
|
||||
} finally {
|
||||
isLoadingCart = false;
|
||||
|
||||
Reference in New Issue
Block a user