after fixed apyament
This commit is contained in:
@@ -1004,7 +1004,7 @@
|
||||
"languageVersion": "3.4"
|
||||
}
|
||||
],
|
||||
"generated": "2025-03-20T12:51:19.355653Z",
|
||||
"generated": "2025-03-21T12:45:09.442791Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "3.4.4",
|
||||
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -32,7 +32,8 @@ class APIURL {
|
||||
static const String offerCoupon = "${BASE_URL}coupons";
|
||||
static const String applyCoupon = "${BASE_URL}coupons/validate";
|
||||
static const String forgetPassword = "${BASE_URL}auth/forgot-password/vendor";
|
||||
static const String verifyForgetPassword = "${BASE_URL}auth/forgot-password-verify-otp/vendor";
|
||||
static const String verifyForgetPassword =
|
||||
"${BASE_URL}auth/forgot-password-verify-otp/vendor";
|
||||
static const String reset_password = "${BASE_URL}auth/reset-password/vendor";
|
||||
|
||||
static const String getProduct = "${BASE_URL}products";
|
||||
@@ -44,10 +45,8 @@ class APIURL {
|
||||
static const String deleteProduct = "${BASE_URL}products/";
|
||||
static const String updateProduct = "${BASE_URL}products/";
|
||||
|
||||
|
||||
static const String getAssignedOtp ="${BASE_URL}delivery/customer-otp";
|
||||
static const String getAssignedOtp = "${BASE_URL}delivery/customer-otp";
|
||||
|
||||
static const String updateStatus = "${BASE_URL}orders/items/";
|
||||
|
||||
|
||||
static const String checkAddress = "${BASE_URL}distance/by-address/";
|
||||
}
|
||||
|
||||
209
lib/src/data/check_product.dart
Normal file
209
lib/src/data/check_product.dart
Normal file
@@ -0,0 +1,209 @@
|
||||
// import 'dart:convert';
|
||||
|
||||
// CheckProduct checkProductFromJson(String str) =>
|
||||
// CheckProduct.fromJson(json.decode(str));
|
||||
|
||||
// String checkProductToJson(CheckProduct data) => json.encode(data.toJson());
|
||||
|
||||
// class CheckProduct {
|
||||
// double? maxDistance;
|
||||
// int? maxDeliveryCharges;
|
||||
// List<Distance>? distances;
|
||||
// // List<NonDeliverableProduct>? nonDeliverableProducts;
|
||||
// bool? isDeliverable;
|
||||
|
||||
// CheckProduct({
|
||||
// this.maxDistance,
|
||||
// this.maxDeliveryCharges,
|
||||
// this.distances,
|
||||
// // this.nonDeliverableProducts,
|
||||
// this.isDeliverable,
|
||||
// });
|
||||
|
||||
// factory CheckProduct.fromJson(Map<String, dynamic> json) => CheckProduct(
|
||||
// maxDistance: json["maxDistance"].toDouble(),
|
||||
// maxDeliveryCharges: json["maxDeliveryCharges"],
|
||||
// distances: List<Distance>.from(
|
||||
// json["distances"].map((x) => Distance.fromJson(x))),
|
||||
// // nonDeliverableProducts: List<NonDeliverableProduct>.from(
|
||||
// // json["nonDeliverableProducts"]
|
||||
// // .map((x) => NonDeliverableProduct.fromJson(x))),
|
||||
// isDeliverable: json["isDeliverable"],
|
||||
// );
|
||||
|
||||
// Map<String, dynamic> toJson() => {
|
||||
// "maxDistance": maxDistance,
|
||||
// "maxDeliveryCharges": maxDeliveryCharges,
|
||||
// "distances": List<dynamic>.from(distances!.map((x) => x.toJson())),
|
||||
// // "nonDeliverableProducts":
|
||||
// // List<dynamic>.from(nonDeliverableProducts!.map((x) => x.toJson())),
|
||||
// "isDeliverable": isDeliverable,
|
||||
// };
|
||||
// }
|
||||
|
||||
// class Distance {
|
||||
// int? rank;
|
||||
// String? productId;
|
||||
// String? categoryId;
|
||||
// double? distance;
|
||||
// String? productName;
|
||||
// String? productDescription;
|
||||
// String? productImage;
|
||||
// String? maxDeliveryCharges;
|
||||
|
||||
// Distance({
|
||||
// this.rank,
|
||||
// this.productId,
|
||||
// this.categoryId,
|
||||
// this.distance,
|
||||
// this.productName,
|
||||
// this.productDescription,
|
||||
// this.productImage,
|
||||
// this.maxDeliveryCharges,
|
||||
// });
|
||||
|
||||
// factory Distance.fromJson(Map<String, dynamic> json) => Distance(
|
||||
// rank: json["rank"],
|
||||
// productId: json["productId"],
|
||||
// categoryId: json["categoryId"],
|
||||
// distance: json["distance"].toDouble(),
|
||||
// productName: json["productName"],
|
||||
// productDescription: json["productDescription"],
|
||||
// productImage: json["productImage"],
|
||||
// maxDeliveryCharges: json["maxDeliveryCharges"],
|
||||
// );
|
||||
|
||||
// Map<String, dynamic> toJson() => {
|
||||
// "rank": rank,
|
||||
// "productId": productId,
|
||||
// "categoryId": categoryId,
|
||||
// "distance": distance,
|
||||
// "productName": productName,
|
||||
// "productDescription": productDescription,
|
||||
// "productImage": productImage,
|
||||
// "maxDeliveryCharges": maxDeliveryCharges,
|
||||
// };
|
||||
// }
|
||||
|
||||
// class NonDeliverableProduct {
|
||||
// String? productId;
|
||||
// String? productName;
|
||||
// String? productDescription;
|
||||
// String? productImage;
|
||||
// double? distance;
|
||||
|
||||
// NonDeliverableProduct({
|
||||
// this.productId,
|
||||
// this.productName,
|
||||
// this.productDescription,
|
||||
// this.productImage,
|
||||
// this.distance,
|
||||
// });
|
||||
|
||||
// factory NonDeliverableProduct.fromJson(Map<String, dynamic> json) =>
|
||||
// NonDeliverableProduct(
|
||||
// productId: json["productId"],
|
||||
// productName: json["productName"],
|
||||
// productDescription: json["productDescription"],
|
||||
// productImage: json["productImage"],
|
||||
// distance: json["distance"].toDouble(),
|
||||
// );
|
||||
|
||||
// Map<String, dynamic> toJson() => {
|
||||
// "productId": productId,
|
||||
// "productName": productName,
|
||||
// "productDescription": productDescription,
|
||||
// "productImage": productImage,
|
||||
// "distance": distance,
|
||||
// };
|
||||
// }
|
||||
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final checkProduct = checkProductFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CheckProduct checkProductFromJson(String str) =>
|
||||
CheckProduct.fromJson(json.decode(str));
|
||||
|
||||
String checkProductToJson(CheckProduct data) => json.encode(data.toJson());
|
||||
|
||||
class CheckProduct {
|
||||
double? maxDistance;
|
||||
int? maxDeliveryCharges;
|
||||
List<Distance>? distances;
|
||||
List<dynamic>? nonDeliverableProducts;
|
||||
bool? isDeliverable;
|
||||
|
||||
CheckProduct({
|
||||
this.maxDistance,
|
||||
this.maxDeliveryCharges,
|
||||
this.distances,
|
||||
this.nonDeliverableProducts,
|
||||
this.isDeliverable,
|
||||
});
|
||||
|
||||
factory CheckProduct.fromJson(Map<String, dynamic> json) => CheckProduct(
|
||||
maxDistance: json["maxDistance"].toDouble(),
|
||||
maxDeliveryCharges: json["maxDeliveryCharges"],
|
||||
distances: List<Distance>.from(
|
||||
json["distances"].map((x) => Distance.fromJson(x))),
|
||||
nonDeliverableProducts:
|
||||
List<dynamic>.from(json["nonDeliverableProducts"].map((x) => x)),
|
||||
isDeliverable: json["isDeliverable"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"maxDistance": maxDistance,
|
||||
"maxDeliveryCharges": maxDeliveryCharges,
|
||||
"distances": List<dynamic>.from(distances!.map((x) => x.toJson())),
|
||||
"nonDeliverableProducts":
|
||||
List<dynamic>.from(nonDeliverableProducts!.map((x) => x)),
|
||||
"isDeliverable": isDeliverable,
|
||||
};
|
||||
}
|
||||
|
||||
class Distance {
|
||||
int? rank;
|
||||
String? productId;
|
||||
String? categoryId;
|
||||
double? distance;
|
||||
String? productName;
|
||||
String? productDescription;
|
||||
String? productImage;
|
||||
int? maxDeliveryCharges;
|
||||
|
||||
Distance({
|
||||
this.rank,
|
||||
this.productId,
|
||||
this.categoryId,
|
||||
this.distance,
|
||||
this.productName,
|
||||
this.productDescription,
|
||||
this.productImage,
|
||||
this.maxDeliveryCharges,
|
||||
});
|
||||
|
||||
factory Distance.fromJson(Map<String, dynamic> json) => Distance(
|
||||
rank: json["rank"],
|
||||
productId: json["productId"],
|
||||
categoryId: json["categoryId"],
|
||||
distance: json["distance"].toDouble(),
|
||||
productName: json["productName"],
|
||||
productDescription: json["productDescription"],
|
||||
productImage: json["productImage"],
|
||||
maxDeliveryCharges: json["maxDeliveryCharges"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"rank": rank,
|
||||
"productId": productId,
|
||||
"categoryId": categoryId,
|
||||
"distance": distance,
|
||||
"productName": productName,
|
||||
"productDescription": productDescription,
|
||||
"productImage": productImage,
|
||||
"maxDeliveryCharges": maxDeliveryCharges,
|
||||
};
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
|
||||
String get pinCode => _pinCode;
|
||||
bool get isLoading => _isLoading;
|
||||
bool get isDeliverable => _isDeliverable;
|
||||
|
||||
TextEditingController checkPinCode = TextEditingController();
|
||||
|
||||
Future<void> getCurrentLocation(BuildContext context) async {
|
||||
@@ -101,6 +101,45 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
bool get isDeliverable => _isDeliverable;
|
||||
int deliveryCharge = 0;
|
||||
int get getdeliverycharge => deliveryCharge;
|
||||
|
||||
Future<void> checkAddress(BuildContext context, addressId) async {
|
||||
ischeckpin = true;
|
||||
|
||||
notifyListeners();
|
||||
var data = {};
|
||||
try {
|
||||
var result = await _homeRepo.checkAddress(data, addressId);
|
||||
|
||||
return result.fold(
|
||||
(error) {
|
||||
_isDeliverable = false;
|
||||
|
||||
notifyListeners();
|
||||
},
|
||||
(response) {
|
||||
print(
|
||||
"sjhjkdkfhgjdfkjgdfgjdfjjkhsdfghhfjkd ${response.isDeliverable}");
|
||||
|
||||
if (response.isDeliverable!) {
|
||||
_isDeliverable = true;
|
||||
deliveryCharge = response.maxDeliveryCharges!;
|
||||
}
|
||||
ischeckpin = false;
|
||||
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
_isDeliverable = false;
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// checkAddress
|
||||
Map<String, bool> isRemoveItem = {};
|
||||
|
||||
Future<void> deleteItem(BuildContext context, id) async {
|
||||
@@ -286,8 +325,7 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
"addressId": addressId,
|
||||
"cartId": cartId,
|
||||
};
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
data = {
|
||||
"amount": originalAmount,
|
||||
"addressId": addressId,
|
||||
@@ -339,7 +377,7 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
Future<void> paymentCODOrder(
|
||||
BuildContext context,
|
||||
double subtotal,
|
||||
double deliverCharge,
|
||||
int deliverCharge,
|
||||
String couponId,
|
||||
String addressId,
|
||||
) async {
|
||||
@@ -425,7 +463,8 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
(response) {
|
||||
addresslist = response.data!;
|
||||
if (response.data!.isNotEmpty) {
|
||||
_selectedAddress = addresslist.first.id ?? "";
|
||||
//checkAddress(context, addresslist.first.id ?? "");
|
||||
// _selectedAddress = addresslist.first.id ?? "";
|
||||
_selecteUserName = addresslist.first.name ?? "";
|
||||
_selecteUserPhone = addresslist.first.phoneNumber ?? "";
|
||||
_selecteEmail = addresslist.first.user!.email ?? "";
|
||||
@@ -443,15 +482,19 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
String _selectedAddress = "";
|
||||
String _selecteUserName = "";
|
||||
String _selecteUserPhone = "";
|
||||
String _selecteEmail = "";
|
||||
|
||||
String _selectedAddress = "";
|
||||
String get selectedAddress => _selectedAddress;
|
||||
String get selecteUserName => _selecteUserName;
|
||||
String get selecteUserPhone => _selecteUserPhone;
|
||||
String get selecteEmail => _selecteEmail;
|
||||
selectedAddressId() {
|
||||
_selectedAddress = "";
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void bydefaultSetAddress(phoneNumber, name, email) {
|
||||
_selecteUserName = name;
|
||||
_selecteUserPhone = phoneNumber;
|
||||
@@ -460,6 +503,7 @@ class AddtocartProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void selectAddress(String address, phoneNumber, name, email) {
|
||||
print("lksdjfhgkfdghhkkfdghkjfjdgkh");
|
||||
_selectedAddress = address;
|
||||
_selecteUserName = name;
|
||||
_selecteUserPhone = phoneNumber;
|
||||
|
||||
@@ -4,9 +4,8 @@ import 'package:grocery_app/src/logic/repo/product_repo.dart';
|
||||
|
||||
class AddressProvider extends ChangeNotifier {
|
||||
bool ischeckpin = false;
|
||||
|
||||
Future<bool> checkPin(BuildContext context, pin) async {
|
||||
final _homeRepo = getIt<ProductRepo>();
|
||||
Future<bool> checkPin(BuildContext context, pin) async {
|
||||
ischeckpin = true;
|
||||
notifyListeners();
|
||||
var data = {};
|
||||
@@ -16,7 +15,7 @@ class AddressProvider extends ChangeNotifier {
|
||||
return result.fold(
|
||||
(error) {
|
||||
ischeckpin = false;
|
||||
ischeckpin = false;
|
||||
notifyListeners();
|
||||
return false;
|
||||
},
|
||||
(response) {
|
||||
@@ -32,14 +31,9 @@ class AddressProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<bool> addAddress(BuildContext context, name, pincode, phone,
|
||||
alternatePhoneNumber, address, landmark, addresstype) async
|
||||
{
|
||||
ischeckpin = false;
|
||||
|
||||
final _homeRepo = getIt<ProductRepo>();
|
||||
alternatePhoneNumber, address, landmark, addresstype) async {
|
||||
ischeckpin = true;
|
||||
|
||||
notifyListeners();
|
||||
var data = {
|
||||
@@ -59,6 +53,8 @@ class AddressProvider extends ChangeNotifier {
|
||||
return result.fold(
|
||||
(error) {
|
||||
ischeckpin = false;
|
||||
notifyListeners();
|
||||
print("poodfgccccidfuiog ${error.message}");
|
||||
|
||||
return false;
|
||||
},
|
||||
@@ -69,12 +65,10 @@ class AddressProvider extends ChangeNotifier {
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print("poodfgidfuiog $e");
|
||||
ischeckpin = false;
|
||||
notifyListeners();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ class OrderProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (e)
|
||||
{
|
||||
print("sfddsfdfff $e");
|
||||
|
||||
isloading = false;
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:dio/dio.dart';
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:grocery_app/src/core/utils/custom_dio_exception.dart';
|
||||
import 'package:grocery_app/src/core/utils/response_type_def.dart';
|
||||
import 'package:grocery_app/src/data/check_product.dart';
|
||||
import 'package:grocery_app/src/data/myOrder.dart';
|
||||
import 'package:grocery_app/src/data/order_OTP.dart';
|
||||
import 'package:grocery_app/src/data/order_paymnet.dart';
|
||||
@@ -25,6 +26,10 @@ class OrderRepo {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FutureResult<DeliveryOtpmodel> getAssignedOtp(data) async {
|
||||
try {
|
||||
var response = await _orderService.getAssignedOtp(data);
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:grocery_app/src/data/all_cart_items.dart';
|
||||
import 'package:grocery_app/src/data/banners.dart';
|
||||
import 'package:grocery_app/src/data/best_dealProduct.dart';
|
||||
import 'package:grocery_app/src/data/check_pin_response.dart';
|
||||
import 'package:grocery_app/src/data/check_product.dart';
|
||||
import 'package:grocery_app/src/data/cod_order_response.dart';
|
||||
import 'package:grocery_app/src/data/coupon_model.dart';
|
||||
import 'package:grocery_app/src/data/coupon_response.dart';
|
||||
@@ -310,6 +311,24 @@ class ProductRepo {
|
||||
}
|
||||
}
|
||||
|
||||
FutureResult<CheckProduct> checkAddress(data, id) async {
|
||||
try {
|
||||
var response = await _productService.checkAddress(data, id);
|
||||
|
||||
print("kjlkjcjgklkjdhgfgkjfkdjghkjf $response");
|
||||
|
||||
CheckProduct productCategory = checkProductFromJson(response.toString());
|
||||
|
||||
print("kjxfgklhdfkgjkjdfg $productCategory");
|
||||
|
||||
return right(productCategory);
|
||||
} on DioException catch (e) {
|
||||
print("lkjxhdfgkfglkhkjfgh $e");
|
||||
var error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
|
||||
FutureResult<String> deleteItem(data, id) async {
|
||||
try {
|
||||
var response = await _productService.deleteItem(data, id);
|
||||
|
||||
@@ -114,6 +114,12 @@ Future getCategoryByLevel(data) async {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future checkAddress(data, id) async {
|
||||
var response =
|
||||
await api.get(APIURL.checkAddress + id, data: jsonEncode(data));
|
||||
return response;
|
||||
}
|
||||
|
||||
Future deleteItem(data, id) async {
|
||||
var response =
|
||||
await api.delete(APIURL.deleteItem + id, data: jsonEncode(data));
|
||||
|
||||
@@ -14,6 +14,13 @@ class OrderService extends ApiService
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Future getAssignedOtp(data) async {
|
||||
var response = await api.get(APIURL.getAssignedOtp,
|
||||
data: jsonEncode(data), queryParameters: data);
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:grocery_app/utils/extensions/uicontext.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CardCheckoutScreen extends StatefulWidget {
|
||||
// double amount;
|
||||
int deliveryCharge;
|
||||
// String currency;
|
||||
double originalAmount;
|
||||
// String name;
|
||||
@@ -19,13 +19,12 @@ class CardCheckoutScreen extends StatefulWidget {
|
||||
String cartId;
|
||||
String addressId;
|
||||
// String remarks;
|
||||
double deliverCharge;
|
||||
|
||||
String? couponId;
|
||||
|
||||
CardCheckoutScreen(
|
||||
{super.key,
|
||||
// required this.amount,
|
||||
required this.deliveryCharge,
|
||||
// required this.currency,
|
||||
required this.originalAmount,
|
||||
// required this.name,
|
||||
@@ -35,7 +34,7 @@ class CardCheckoutScreen extends StatefulWidget {
|
||||
required this.cartId,
|
||||
required this.addressId,
|
||||
// required this.remarks,
|
||||
required this.deliverCharge,
|
||||
|
||||
this.couponId});
|
||||
|
||||
@override
|
||||
@@ -90,7 +89,7 @@ class _CardCheckoutScreenState extends State<CardCheckoutScreen> {
|
||||
print("dsjfkhkdfhgdkfghdfg");
|
||||
paymentProvider.orderPaymnet(
|
||||
context,
|
||||
widget.originalAmount,
|
||||
widget.originalAmount + widget.deliveryCharge,
|
||||
widget.cartId,
|
||||
widget.addressId,
|
||||
widget.couponId!);
|
||||
@@ -98,7 +97,7 @@ class _CardCheckoutScreenState extends State<CardCheckoutScreen> {
|
||||
paymentProvider.paymentCODOrder(
|
||||
context,
|
||||
widget.originalAmount,
|
||||
widget.deliverCharge,
|
||||
widget.deliveryCharge,
|
||||
widget.couponId!,
|
||||
widget.addressId,
|
||||
);
|
||||
@@ -133,18 +132,47 @@ class _CardCheckoutScreenState extends State<CardCheckoutScreen> {
|
||||
child: SingleChildScrollView(child: Consumer<AddtocartProvider>(
|
||||
builder: (context, paymentProvider, child) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
height: 250,
|
||||
padding: EdgeInsets.all(0),
|
||||
// height: 250,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text("Delivery Charge "),
|
||||
Spacer(),
|
||||
Text("₹${widget.deliveryCharge}",
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold))
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text("Product Amount "),
|
||||
Spacer(),
|
||||
Text("₹${widget.originalAmount}",
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold))
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Text("Total Amount "),
|
||||
Spacer(),
|
||||
Text("₹${widget.originalAmount + widget.deliveryCharge}",
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold))
|
||||
],
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
Text(
|
||||
"Select Payment Method",
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
SizedBox(height: 0),
|
||||
|
||||
// Online Payment Option
|
||||
ListTile(
|
||||
leading: Icon(Icons.payment, color: Colors.blue),
|
||||
title: Text("Online Payment"),
|
||||
|
||||
@@ -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) {
|
||||
// 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,
|
||||
);
|
||||
}
|
||||
// }
|
||||
// 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,12 +1194,12 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
|
||||
return ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
if (paymentProvider.selectedAddress.isNotEmpty) {
|
||||
if (paymentProvider.isDeliverable) {
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return CardCheckoutScreen(
|
||||
// amount: double.parse(
|
||||
// paymentProvider.allitem.subtotal.toString()),
|
||||
deliveryCharge: paymentProvider.getdeliverycharge,
|
||||
// currency: "INR",
|
||||
originalAmount: paymentProvider.grandPrice,
|
||||
|
||||
@@ -1206,11 +1210,22 @@ class _AddressBottomSheetState extends State<AddressBottomSheet> {
|
||||
cartId: paymentProvider.allitem.id!,
|
||||
addressId: paymentProvider.selectedAddress,
|
||||
// remarks: paymentProvider.selecteUserName,
|
||||
deliverCharge: 0,
|
||||
|
||||
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,
|
||||
|
||||
@@ -85,9 +85,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
|
||||
],
|
||||
actions: [],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@@ -458,7 +456,6 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
return discountPercentage.round();
|
||||
}
|
||||
|
||||
|
||||
Widget filterCategory() {
|
||||
final activeIndexProvider = Provider.of<ProductProvider>(context);
|
||||
|
||||
@@ -494,8 +491,6 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
itemBuilder: (context, index) {
|
||||
var category = categories[index];
|
||||
|
||||
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: InkWell(
|
||||
@@ -528,8 +523,8 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
child: SizedBox(
|
||||
// height: 80,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (category.name == "ALL") ...{
|
||||
if (provider.categoriesss.isNotEmpty)
|
||||
@@ -564,33 +559,17 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
horizontal: 10,
|
||||
child: Center(
|
||||
child: Container(
|
||||
child: AppNetworkImage(
|
||||
height: 50,
|
||||
width: 60,
|
||||
imageUrl: provider
|
||||
.selectedCategory?.image ??
|
||||
'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png',
|
||||
backGroundColor: APPCOLOR.bgGrey,
|
||||
radius: 10,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20,
|
||||
child: Text(
|
||||
provider.selectedCategory?.name ??
|
||||
"All",
|
||||
maxLines: 1,
|
||||
style: context.customMedium(
|
||||
APPCOLOR.balck1A1A1A,
|
||||
12,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_drop_down,
|
||||
size: 20,
|
||||
color: APPCOLOR.balck1A1A1A,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -600,7 +579,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
Center(
|
||||
child: Container(
|
||||
child: AppNetworkImage(
|
||||
height: 30,
|
||||
height: 50,
|
||||
width: 50,
|
||||
imageUrl: category.image ??
|
||||
'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png',
|
||||
@@ -630,16 +609,16 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
],
|
||||
),
|
||||
},
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Container(
|
||||
width: 2,
|
||||
// height: 60,
|
||||
color: activeIndexProvider.activeIndex == index
|
||||
? APPCOLOR.lightGreen
|
||||
: Colors.transparent,
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Container(
|
||||
// width: 2,
|
||||
// height: 0,
|
||||
// color: activeIndexProvider.activeIndex == index
|
||||
// ? APPCOLOR.lightGreen
|
||||
// : Colors.transparent,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -120,9 +120,6 @@ class _AddLocationAddressState extends State<AddLocationAddress> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void _onMapTapped(LatLng tappedPoint) {
|
||||
setState(() {
|
||||
_selectedLocation = tappedPoint;
|
||||
@@ -335,8 +332,7 @@ class _AddLocationAddressState extends State<AddLocationAddress> {
|
||||
SizedBox(height: 10),
|
||||
|
||||
Consumer<AddressProvider>(
|
||||
builder: (context, addressProvider, child)
|
||||
{
|
||||
builder: (context, addressProvider, child) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
@@ -354,7 +350,8 @@ class _AddLocationAddressState extends State<AddLocationAddress> {
|
||||
_RoadController.text,
|
||||
_addressTypeController.text);
|
||||
if (state) {
|
||||
context .read<AddtocartProvider>()
|
||||
context
|
||||
.read<AddtocartProvider>()
|
||||
.getAddress(context);
|
||||
Fluttertoast.showToast(
|
||||
msg: "Address Added!",
|
||||
|
||||
@@ -9,9 +9,9 @@ import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class OrderDetailsScreen extends StatefulWidget {
|
||||
final Datum order;
|
||||
Datum order;
|
||||
|
||||
const OrderDetailsScreen({Key? key, required this.order}) : super(key: key);
|
||||
OrderDetailsScreen({Key? key, required this.order}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OrderDetailsScreenState createState() => _OrderDetailsScreenState();
|
||||
@@ -30,11 +30,36 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
return formattedDateTime;
|
||||
}
|
||||
|
||||
Future<void> _refresh() async {
|
||||
Provider.of<OrderProvider>(context, listen: false).getMyOrder(context);
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
setState(() {
|
||||
_fetchOrderDetails();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _fetchOrderDetails() async {
|
||||
// Get the updated order from Provider
|
||||
|
||||
final homeProvider = Provider.of<OrderProvider>(context, listen: false);
|
||||
|
||||
widget.order = homeProvider.orderList.firstWhere(
|
||||
(o) => o.id == widget.order.id,
|
||||
orElse: () => widget.order,
|
||||
);
|
||||
|
||||
print("kdjhkjfh ${widget.order}");
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Order Details')),
|
||||
body: Padding(
|
||||
body: RefreshIndicator(
|
||||
onRefresh: _refresh,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -54,7 +79,8 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
style: TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 5),
|
||||
Text(convertUtcToIst(widget.order.createdAt.toString())),
|
||||
Text(
|
||||
convertUtcToIst(widget.order.createdAt.toString())),
|
||||
SizedBox(height: 5),
|
||||
// Text(
|
||||
// "Status: ${_getStatusText(widget.order.orderStatus)}",
|
||||
@@ -71,7 +97,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
/// Order Information
|
||||
@@ -200,6 +226,8 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
itemBuilder: (context, index) {
|
||||
// final item = items[index];
|
||||
var orderitem = widget.order.orderItems![index];
|
||||
|
||||
print("ckgjhkfghlfg ${orderitem.orderItemStatus}");
|
||||
return Card(
|
||||
margin: EdgeInsets.symmetric(vertical: 2),
|
||||
child: Column(
|
||||
@@ -231,7 +259,8 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
),
|
||||
),
|
||||
Gap(5),
|
||||
if (orderitem.orderItemStatus != "PENDING")
|
||||
if (orderitem.orderItemStatus != "PENDING" &&
|
||||
orderitem.orderItemStatus != "CANCELLED")
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: " ",
|
||||
@@ -255,6 +284,26 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (orderitem.orderItemStatus == "DELIVERED")
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: " ",
|
||||
style: context.buttonTestStyle.copyWith(
|
||||
color: context.appColor.blackColor,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Give Feedback",
|
||||
style: context.buttonTestStyle.copyWith(
|
||||
color: Colors.blue,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -25,7 +25,8 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
String convertUtcToIst(String utcTime) {
|
||||
String convertUtcToIst(String utcTime)
|
||||
{
|
||||
DateTime utcDateTime = DateTime.parse(utcTime).toUtc();
|
||||
|
||||
DateTime istDateTime =
|
||||
@@ -37,6 +38,13 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
return formattedDateTime;
|
||||
}
|
||||
|
||||
Future<void> _refresh() async {
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
setState(() {
|
||||
Provider.of<OrderProvider>(context, listen: false).getMyOrder(context);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -66,7 +74,10 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Consumer<OrderProvider>(builder: (context, orderProvider, child) {
|
||||
body: RefreshIndicator(
|
||||
onRefresh: _refresh,
|
||||
child:
|
||||
Consumer<OrderProvider>(builder: (context, orderProvider, child) {
|
||||
if (orderProvider.isloading) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}
|
||||
@@ -91,11 +102,13 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
context.pushNamed(MyRoutes.ORDERDETAILS, extra: order);
|
||||
context.pushNamed(MyRoutes.ORDERDETAILS,
|
||||
extra: order);
|
||||
//context.push(MyRoutes.ORDERDETAILS);
|
||||
},
|
||||
child: Card(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -109,7 +122,8 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.bgGrey,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
borderRadius:
|
||||
BorderRadius.circular(15),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
@@ -120,9 +134,10 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
.height *
|
||||
0.08,
|
||||
width: 48,
|
||||
imageUrl: order
|
||||
.orderItems!.first.productImage,
|
||||
backGroundColor: Colors.transparent,
|
||||
imageUrl: order.orderItems!.first
|
||||
.productImage,
|
||||
backGroundColor:
|
||||
Colors.transparent,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -130,15 +145,20 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(order.orderNumber,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold)),
|
||||
Text(order.paymentStatus ?? "",
|
||||
style: TextStyle(color: Colors.grey)),
|
||||
Text(order.totalItems.toString() + " items",
|
||||
style: TextStyle(color: Colors.grey)),
|
||||
style:
|
||||
TextStyle(color: Colors.grey)),
|
||||
Text(
|
||||
order.totalItems.toString() +
|
||||
" items",
|
||||
style:
|
||||
TextStyle(color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
@@ -156,15 +176,17 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Text(convertUtcToIst(order.updatedAt.toString()),
|
||||
Text(
|
||||
convertUtcToIst(order.updatedAt.toString()),
|
||||
style: TextStyle(color: Colors.grey)),
|
||||
SizedBox(height: 5),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("\$" + order.finalTotal,
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold)),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold)),
|
||||
Row(
|
||||
children: [
|
||||
// ElevatedButton(
|
||||
@@ -192,8 +214,8 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
print("lkdhgkjdfgj");
|
||||
_makePhoneCall(
|
||||
order.stores!.first.vendor!.phone);
|
||||
_makePhoneCall(order
|
||||
.stores!.first.vendor!.phone);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green,
|
||||
@@ -204,7 +226,8 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.call, color: Colors.white),
|
||||
Icon(Icons.call,
|
||||
color: Colors.white),
|
||||
SizedBox(width: 5),
|
||||
Text('Call',
|
||||
style: TextStyle(
|
||||
@@ -227,7 +250,7 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> _makePhoneCall(String number) async {
|
||||
|
||||
Reference in New Issue
Block a user