productdetails

This commit is contained in:
2025-01-31 19:02:20 +05:30
parent 028155a1d7
commit 42aaa7cdad
32 changed files with 2803 additions and 1987 deletions

View File

@@ -9,7 +9,7 @@ import 'package:grocery_app/src/common_widget/textfield_widget.dart';
import 'package:grocery_app/src/logic/provider/addTocart_provider.dart';
import 'package:grocery_app/src/logic/provider/home_provider.dart';
import 'package:grocery_app/src/ui/bestdeal/bestdeal_screen.dart';
import 'package:grocery_app/src/ui/cart/cart_item.dart';
import 'package:grocery_app/src/ui/widgets/custom_icon_button.dart';
import 'package:grocery_app/src/ui/widgets/elevated_button.dart';
import 'package:grocery_app/utils/constants/assets_constant.dart';
@@ -32,6 +32,7 @@ class _MycartState extends State<Mycart> {
void initState() {
Provider.of<AddtocartProvider>(context, listen: false)
.getItemCards(context);
Provider.of<AddtocartProvider>(context, listen: false)
.getCurrentLocation(context);
@@ -213,15 +214,16 @@ class _MycartState extends State<Mycart> {
Widget cartItems() {
return Consumer<AddtocartProvider>(builder: (context, provider, child) {
print("djkhsfjh ${provider.allitem.items}");
if (provider.isLoaddcartItem) {
return Padding(
padding: const EdgeInsets.only(left: 120),
child: CircularProgressIndicator(),
return Center(
child: CircularProgressIndicator(
color: Colors.green,
),
);
} else if (provider.allitem == null) {
return Center(child: Text('🛒 Your Front Shop Cart is empty'));
} else if (provider.allitem.items == null) {
} else if (provider.allitem.items == null ||
provider.allitem.items!.isEmpty) {
return Center(child: Text('🛒 Your Front Shop Cart is empty'));
} else {
return ListView.separated(
@@ -235,7 +237,6 @@ class _MycartState extends State<Mycart> {
itemBuilder: (context, index) {
var items = provider.allitem.items![index];
print("kdfgdjfgkj ${items}");
return Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Row(
@@ -303,38 +304,76 @@ class _MycartState extends State<Mycart> {
),
),
const Spacer(),
Row(
Column(
children: [
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () {
// provider.decreaseQuantity(items);
Row(
children: [
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () {
// provider.decreaseQuantity(items);
},
icon: SvgPicture.asset(
APPASSETS.removeIcon,
fit: BoxFit.none,
),
backgroundColor: APPCOLOR.appGreen,
),
5.horizontalSpace,
Text(
items.quantity.toString(),
style:
context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
5.horizontalSpace,
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () {
// provider..increaseQuantity(items);
},
icon: SvgPicture.asset(
APPASSETS.addIcon,
fit: BoxFit.none,
),
backgroundColor: APPCOLOR.appGreen,
),
],
),
Gap(20),
InkWell(
onTap: () {
provider.deleteItem(context, items.id);
},
icon: SvgPicture.asset(
APPASSETS.removeIcon,
fit: BoxFit.none,
child: Container(
height: 25,
width: 70,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
shape: BoxShape.rectangle,
border: Border.all(
color: Colors
.blue, // Replace with your desired border color
width: 2, // Border width
),
),
child: provider.isRemoveItem[items.id] ?? false
? Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 5,
width: 5,
child: CircularProgressIndicator(
color: Colors.green, strokeWidth: 1),
),
),
)
: Center(child: Text("Delete")),
),
backgroundColor: APPCOLOR.appGreen,
),
5.horizontalSpace,
Text(
items.quantity.toString(),
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
5.horizontalSpace,
CustomIconButton(
width: 14.w,
height: 14.h,
onPressed: () {
// provider..increaseQuantity(items);
},
icon: SvgPicture.asset(
APPASSETS.addIcon,
fit: BoxFit.none,
),
backgroundColor: APPCOLOR.appGreen,
),
)
],
)
],
@@ -356,7 +395,9 @@ class _MycartState extends State<Mycart> {
if (provider.isLoaddcartItem) {
return Padding(
padding: const EdgeInsets.only(left: 120),
child: CircularProgressIndicator(),
child: CircularProgressIndicator(
color: Colors.white,
),
);
} else if (provider.allitem == null) {
return Center(child: Text('🛒 Your Front Shop Cart is empty'));
@@ -384,9 +425,7 @@ class _MycartState extends State<Mycart> {
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
SummaryRow(
label: 'Item Total',
value: '\$22'),
SummaryRow(label: 'Item Total', value: '\$22'),
SummaryRow(label: 'Discount', value: '\$2'),
SummaryRow(label: 'Delivery Free', value: 'Free', isGreen: true),
Divider(),