after fixed apyament

This commit is contained in:
2025-03-21 18:15:33 +05:30
parent 6a10900f68
commit 681a3932bd
18 changed files with 744 additions and 362 deletions

View File

@@ -819,27 +819,28 @@ class _MycartState extends State<Mycart> {
label: 'Grand Total',
value: '${provider.grandPrice}',
isBold: true),
ListTile(
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}',
style: TextStyle(color: Colors.red),
),
trailing: Text('Change', style: TextStyle(color: Colors.green)),
onTap: () {
_showBottomSheet(context);
},
),
// ListTile(
// 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}',
// style: TextStyle(color: Colors.red),
// ),
// trailing: Text('Change', style: TextStyle(color: Colors.green)),
// onTap: ()
// {
// _showBottomSheet(context);
// },
// ),
SizedBox(height: 10),
Padding(
padding: EdgeInsets.only(left: 20, right: 20),
@@ -858,19 +859,22 @@ class _MycartState extends State<Mycart> {
width: 1, height: 30, color: APPCOLOR.whiteFBFEFB),
InkWell(
onTap: () {
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,
);
}
// if (provider.isDeliverable)
// {
provider.selectedAddressId();
_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(
children: [
@@ -1190,27 +1194,38 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
return ElevatedButton.icon(
onPressed: () {
if (paymentProvider.selectedAddress.isNotEmpty) {
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (context) {
return CardCheckoutScreen(
// amount: double.parse(
// paymentProvider.allitem.subtotal.toString()),
// currency: "INR",
originalAmount: paymentProvider.grandPrice,
if (paymentProvider.isDeliverable) {
Navigator.pop(context);
Navigator.of(context).push(MaterialPageRoute(
builder: (context) {
return CardCheckoutScreen(
deliveryCharge: paymentProvider.getdeliverycharge,
// currency: "INR",
originalAmount: paymentProvider.grandPrice,
// name: paymentProvider.selecteUserName,
// phone: paymentProvider.selecteUserPhone,
// email: paymentProvider.selecteEmail,
// userId: paymentProvider.allitem.userId!,
cartId: paymentProvider.allitem.id!,
addressId: paymentProvider.selectedAddress,
// remarks: paymentProvider.selecteUserName,
deliverCharge: 0,
couponId: paymentProvider.couponId,
);
},
));
// name: paymentProvider.selecteUserName,
// phone: paymentProvider.selecteUserPhone,
// email: paymentProvider.selecteEmail,
// userId: paymentProvider.allitem.userId!,
cartId: paymentProvider.allitem.id!,
addressId: paymentProvider.selectedAddress,
// remarks: paymentProvider.selecteUserName,
couponId: paymentProvider.couponId,
);
},
));
} else {
Fluttertoast.showToast(
msg:
"Delivery is not available for this address, Please change another address",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 14.0,
);
}
} else {
Fluttertoast.showToast(
msg: "Please add a delivery address",
@@ -1227,7 +1242,9 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
style: TextStyle(color: Colors.white, fontSize: 16),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
backgroundColor: paymentProvider.isDeliverable
? Colors.green
: Colors.grey,
minimumSize: Size(double.infinity, 50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
@@ -1251,6 +1268,9 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
physics: NeverScrollableScrollPhysics(),
itemCount: addressProvider.addresslist.length,
itemBuilder: (context, index) {
if (addressProvider.selectedAddress.isEmpty) {
print("ldjkfhsgkhdfkgkfjgdfjk ");
}
var address = addressProvider.addresslist[index];
return Card(
@@ -1263,6 +1283,8 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
groupValue: addressProvider.selectedAddress,
activeColor: Colors.green,
onChanged: (value) {
addressProvider.checkAddress(context, value);
addressProvider.selectAddress(
value.toString(),
address.phoneNumber,