cartui fixed

This commit is contained in:
2025-02-13 17:26:07 +05:30
parent 50cf2c588b
commit 9874c094a9
10 changed files with 397 additions and 315 deletions

View File

@@ -992,7 +992,7 @@
"languageVersion": "3.4"
}
],
"generated": "2025-02-13T05:46:18.147720Z",
"generated": "2025-02-13T11:54:46.039722Z",
"generator": "pub",
"generatorVersion": "3.4.4",
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter",

File diff suppressed because one or more lines are too long

View File

@@ -56,14 +56,14 @@ class AddtocartProvider extends ChangeNotifier {
// Now check if this pin code is deliverable
await checkPin(context, _pinCode);
} else {
_pinCode = "unable to current pi code";
_pinCode = "";
print("Error: No placemarks found.");
}
} catch (e) {
_pinCode = "unable to current pi code";
_pinCode = "";
print("Error: ${e.toString()}");
}
_pinCode = "unable to current pi code";
_pinCode = "";
_isLoading = false;
notifyListeners();
}

View File

@@ -294,7 +294,7 @@ class _BestDealScreenState extends State<BestDealScreen> {
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
"${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -302,7 +302,7 @@ class _BestDealScreenState extends State<BestDealScreen> {
context.customSemiBold(Colors.black, 12),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
"${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,

View File

@@ -57,7 +57,7 @@ class _MycartState extends State<Mycart> {
centerTitle: true,
title: Center(
child: const Text(
'Cart 🛒',
'My Cart 🛒',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
@@ -84,7 +84,6 @@ class _MycartState extends State<Mycart> {
const SizedBox(
height: 15,
),
Divider(),
cartPlace(),
],
),
@@ -95,24 +94,16 @@ class _MycartState extends State<Mycart> {
Widget relatedProduct() {
return Consumer<ProductProvider>(builder: (context, provider, child) {
if (provider.isBestdealingloading) {
return Center(child: CircularProgressIndicator());
} else if (provider.bestdeal.isEmpty) {
return Center(child: Text('No products available'));
} else {
return GridView.builder(
itemCount:
provider.bestdeal.length < 8 ? provider.bestdeal.length : 6,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 5,
mainAxisSpacing: 5,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.8),
),
return SizedBox(
height: MediaQuery.of(context).size.height * 0.28,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: provider.bestdeal.length,
itemBuilder: (context, index) {
var bestdealproduct = provider.bestdeal[index];
double cardWidth =
@@ -124,7 +115,7 @@ class _MycartState extends State<Mycart> {
extra: bestdealproduct.id);
},
child: Padding(
padding: const EdgeInsets.only(right: 10, bottom: 5, top: 5),
padding: const EdgeInsets.only(right: 5, bottom: 5, top: 5),
child: Container(
width: cardWidth,
decoration: BoxDecoration(
@@ -155,8 +146,8 @@ class _MycartState extends State<Mycart> {
alignment: Alignment.center,
children: [
AppNetworkImage(
height:
MediaQuery.of(context).size.height * 0.08,
height: MediaQuery.of(context).size.height *
0.08,
width: cardWidth * 0.7,
imageUrl: bestdealproduct
.productImages?.first?.url ??
@@ -194,7 +185,8 @@ class _MycartState extends State<Mycart> {
textAlign: TextAlign.left,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
style:
context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.005,
@@ -218,16 +210,15 @@ class _MycartState extends State<Mycart> {
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
"${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style:
context.customSemiBold(Colors.black, 12),
style: context.customSemiBold(
Colors.black, 12),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
"${bestdealproduct.basePrice ?? ""}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context
@@ -236,7 +227,8 @@ class _MycartState extends State<Mycart> {
12,
)
.copyWith(
decoration: TextDecoration.lineThrough,
decoration:
TextDecoration.lineThrough,
),
),
],
@@ -260,9 +252,9 @@ class _MycartState extends State<Mycart> {
},
child: Container(
height: MediaQuery.of(context).size.height *
0.035,
width:
MediaQuery.of(context).size.width * 0.1,
0.028,
// width:
// MediaQuery.of(context).size.width * 0.1,
decoration: BoxDecoration(
color: APPCOLOR.lightGreen,
borderRadius: BorderRadius.circular(5),
@@ -272,17 +264,19 @@ class _MycartState extends State<Mycart> {
bestdealproduct.id] ??
false
? Padding(
padding: const EdgeInsets.all(8.0),
padding:
const EdgeInsets.all(8.0),
child: Container(
height: 10,
width: 10,
child: CircularProgressIndicator(
child:
CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2),
),
)
: Text(
'Add',
' Add ',
style: context.customRegular(
Colors.white, 12),
),
@@ -299,6 +293,7 @@ class _MycartState extends State<Mycart> {
),
);
},
),
);
}
});
@@ -433,8 +428,8 @@ class _MycartState extends State<Mycart> {
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
separatorBuilder: (_, index) => Padding(
padding: EdgeInsets.only(top: 12.h, bottom: 24.h),
child: const Divider(thickness: 1),
padding: EdgeInsets.only(top: 8.h, bottom: 8.h),
// child: const Divider(thickness: 1),
),
itemCount: provider.allitem.items!.length,
itemBuilder: (context, index) {
@@ -470,7 +465,7 @@ class _MycartState extends State<Mycart> {
overflow: TextOverflow.ellipsis,
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
5.verticalSpace,
2.verticalSpace,
Text(
items.product!.unit ?? "",
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
@@ -478,14 +473,14 @@ class _MycartState extends State<Mycart> {
Row(
children: [
Text(
"\$${items.product!.discountPrice ?? ""} ",
"${items.product!.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customSemiBold(Colors.black, 12),
),
Text(
"\$${items.product!.basePrice ?? ""}",
"${items.product!.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -528,65 +523,90 @@ class _MycartState extends State<Mycart> {
const Spacer(),
Column(
children: [
Row(
Container(
height: 25,
width: 70,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(7)),
shape: BoxShape.rectangle,
border: Border.all(
color: APPCOLOR.lightGreen,
width: 1,
),
),
child: Center(
child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () async {
InkWell(
onTap: () async {
if (items.quantity! > 1) {
await provider.decreaseCartQuantity(
context,
items.id!,
int.parse(items.quantity.toString()) - 1);
int.parse(items.quantity.toString()) -
1);
}
},
icon: SvgPicture.asset(
APPASSETS.removeIcon,
fit: BoxFit.none,
child: Icon(
Icons.remove,
size: 15,
color: APPCOLOR.lightGreen,
),
backgroundColor: APPCOLOR.appGreen,
),
5.horizontalSpace,
// IconButton(
// // width: 14.w,
// // height: 14.h,
// onPressed: () async {
// if (items.quantity! > 1) {
// await provider.decreaseCartQuantity(
// context,
// items.id!,
// int.parse(items.quantity.toString()) -
// 1);
// }
// },
// icon: Icon(Icons.minimize_rounded),
// iconSize: 10,
// ),
Gap(10),
Text(
items.quantity.toString(),
style:
context.customMedium(APPCOLOR.balck1A1A1A, 14),
style: context.customMedium(
APPCOLOR.balck1A1A1A, 14),
),
5.horizontalSpace,
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () async {
Gap(10),
InkWell(
onTap: () async {
await provider.addToCart(
context, items.productId!, 1);
// await provider.getItemCards(context);
},
icon: SvgPicture.asset(
APPASSETS.addIcon,
fit: BoxFit.none,
child: Icon(
Icons.add,
size: 15,
color: APPCOLOR.lightGreen,
),
backgroundColor: APPCOLOR.appGreen,
),
// IconButton(
// onPressed: () async {
// await provider.addToCart(
// context, items.productId!, 1);
// // await provider.getItemCards(context);
// },
// icon: Icon(Icons.add),
// iconSize: 10,
// ),
],
),
),
),
Gap(20),
InkWell(
onTap: () async {
provider.deleteItem(context, items.id);
},
child: Container(
height: 25,
width: 70,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
shape: BoxShape.rectangle,
border: Border.all(
color: Colors.blue,
width: 2,
),
),
child: provider.isRemoveItem[items.id] ?? false
? Center(
child: Padding(
@@ -600,7 +620,6 @@ class _MycartState extends State<Mycart> {
),
)
: Center(child: Text("Delete")),
),
)
],
)
@@ -734,9 +753,11 @@ class _MycartState extends State<Mycart> {
children: [
ListTile(
leading: Icon(Icons.local_offer, color: Colors.green),
title: Text('APPLY COUPON',
style: TextStyle(fontWeight: FontWeight.bold)),
trailing: Icon(Icons.arrow_forward_ios),
title: Text('APPLY COUPON', style: TextStyle(fontSize: 15)),
trailing: Icon(
Icons.arrow_forward_ios,
size: 15,
),
onTap: () {
if (provider.couponDataModel.data!.isNotEmpty) {
context.push(MyRoutes.COUPONSSCREEN,
@@ -753,33 +774,59 @@ class _MycartState extends State<Mycart> {
}
},
),
Divider(
thickness: 0.2,
),
SummaryRow(
label: 'Item Total Price', value: '\$${provider.totalPrice}'),
SummaryRow(label: 'Discount', value: "${provider.discount}"),
label: 'Item Total Price', value: '${provider.totalPrice}'),
SummaryRow(label: 'Discount Price', value: "${provider.discount}"),
SummaryRow(label: 'Delivery Free', value: 'Free', isGreen: true),
Divider(),
Divider(
thickness: 0.2,
),
SummaryRow(
label: 'Grand Total',
value: '\$${provider.grandPrice}',
value: '${provider.grandPrice}',
isBold: true),
ListTile(
leading: Icon(Icons.home, color: Colors.green),
leading: Container(
decoration: BoxDecoration(
color: Colors.lightGreen.withOpacity(0.2),
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Icon(Icons.home_outlined,
size: 15, color: Colors.green),
)),
title: provider.isDeliverable
? Text('Delivering to : ${provider.pinCode}')
: Text(
'Out Of Stock : ${provider.pinCode}',
'Out Of Stock ${provider.pinCode}',
style: TextStyle(color: Colors.red),
),
trailing: Text('Change', style: TextStyle(color: Colors.blue)),
trailing: Text('Change', style: TextStyle(color: Colors.green)),
onTap: () {
_showBottomSheet(context);
},
),
SizedBox(height: 10),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: APPCOLOR.lightGreen),
onPressed: () {
Padding(
padding: EdgeInsets.only(left: 20, right: 20),
child: Container(
height: 40,
decoration: BoxDecoration(
color: APPCOLOR.lightGreen,
borderRadius: BorderRadius.circular(5),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text("${provider.grandPrice}",
style: TextStyle(fontSize: 16, color: Colors.white)),
Container(
width: 1, height: 30, color: APPCOLOR.whiteFBFEFB),
InkWell(
onTap: () {
if (provider.isDeliverable) {
_showAddressBottomSheet(context);
} else {
@@ -795,10 +842,45 @@ class _MycartState extends State<Mycart> {
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [Text('Place Order', style: TextStyle(fontSize: 16))],
children: [
Text('Place Order ',
style:
TextStyle(fontSize: 16, color: Colors.white)),
Icon(
Icons.arrow_forward,
color: Colors.white,
size: 20,
)
],
),
)
],
),
),
),
// ElevatedButton(
// style: ElevatedButton.styleFrom(
// backgroundColor: APPCOLOR.lightGreen),
// onPressed: () {
// if (provider.isDeliverable) {
// _showAddressBottomSheet(context);
// } else {
// Fluttertoast.showToast(
// msg:
// "Delivery is not available for this pincode. Please try another pincode!",
// toastLength: Toast.LENGTH_SHORT,
// gravity: ToastGravity.BOTTOM,
// backgroundColor: Colors.red,
// textColor: Colors.white,
// fontSize: 14.0,
// );
// }
// },
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [Text('Place Order', style: TextStyle(fontSize: 16))],
// ),
// ),
],
);
}
@@ -1172,11 +1254,11 @@ class SummaryRow extends StatelessWidget {
children: [
Text(label,
style: TextStyle(
fontSize: 16,
fontSize: 14,
fontWeight: isBold ? FontWeight.bold : FontWeight.normal)),
Text(value,
style: TextStyle(
fontSize: 16,
fontSize: 14,
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
color: isGreen ? Colors.green : Colors.black)),
],

View File

@@ -220,13 +220,13 @@ class _FavouriteScreenState extends State<FavouriteScreen>
Row(
children: [
Text(
"\$${product.discountPrice}",
"${product.discountPrice}",
style: context.customSemiBold(
Colors.black, 14),
),
SizedBox(width: 5),
Text(
"\$${product.basePrice ?? ""}",
"${product.basePrice ?? ""}",
style: context
.customMedium(
Colors.grey.withOpacity(0.8), 12)

View File

@@ -279,7 +279,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
CrossAxisAlignment.start,
children: [
Text(
"\$${product.discountPrice ?? " "}",
"${product.discountPrice ?? " "}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -288,7 +288,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
),
const SizedBox(width: 5),
Text(
"\$${product.basePrice ?? " "}",
"${product.basePrice ?? " "}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,

View File

@@ -387,7 +387,7 @@ class _HomeScreenState extends State<HomeScreen> {
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
"${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -395,7 +395,7 @@ class _HomeScreenState extends State<HomeScreen> {
Colors.black, 11),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
"${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,

View File

@@ -179,7 +179,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
),
title: Text(orderitem.productName ?? ""),
subtitle: Text("Qty: ${orderitem.quantity.toString()}"),
trailing: Text("\$${orderitem.totalOrderItemPrice ?? ""}",
trailing: Text("${orderitem.totalOrderItemPrice ?? ""}",
style: TextStyle(fontWeight: FontWeight.bold)),
),
);

View File

@@ -240,7 +240,7 @@ class _ProductDetailsState extends State<ProductDetails> {
Row(
children: [
Text(
"\$${provider.productDetails.data!.discountPrice}",
"${provider.productDetails.data!.discountPrice}",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
@@ -248,7 +248,7 @@ class _ProductDetailsState extends State<ProductDetails> {
),
SizedBox(width: 10),
Text(
"\$${provider.productDetails.data!.basePrice}",
"${provider.productDetails.data!.basePrice}",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
@@ -1058,7 +1058,7 @@ class _ProductDetailsState extends State<ProductDetails> {
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
"${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -1066,7 +1066,7 @@ class _ProductDetailsState extends State<ProductDetails> {
Colors.black, 12),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
"${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -1254,7 +1254,7 @@ class _ProductDetailsState extends State<ProductDetails> {
width: 2, height: 50, color: APPCOLOR.whiteFBFEFB),
SizedBox(width: 10),
Text(
"\$${cartProvider.totalPrice}",
"${cartProvider.totalPrice}",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,