This commit is contained in:
2025-05-05 00:24:42 +05:30
parent 49c84195d1
commit ce9bb33bdd
18 changed files with 764 additions and 725 deletions

View File

@@ -119,16 +119,6 @@ class MyApplication extends StatelessWidget {
),
);
// MaterialApp.router(
// title: 'Customer App',
// routerConfig: MyRoutes.router,
// debugShowCheckedModeBanner: false,
// theme: ThemeData(
// colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
// useMaterial3: true,
// ),
// // home: const SplashScreen(),
// );
}
}

View File

@@ -1,3 +1,76 @@
// // To parse this JSON data, do
// //
// // final couponResponse = couponResponseFromJson(jsonString);
// import 'dart:convert';
// CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str));
// String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
// class CouponResponse {
// bool? isValid;
// String? originalPrice;
// int? discountAmount;
// int? finalPrice;
// String? message;
// CouponDetails? couponDetails;
// CouponResponse({
// this.isValid,
// this.originalPrice,
// this.discountAmount,
// this.finalPrice,
// this.message,
// this.couponDetails,
// });
// factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
// isValid: json["isValid"],
// originalPrice: json["originalPrice"],
// discountAmount: json["discountAmount"],
// finalPrice: json["finalPrice"],
// message: json["message"],
// couponDetails: CouponDetails.fromJson(json["couponDetails"]),
// );
// Map<String, dynamic> toJson() => {
// "isValid": isValid,
// "originalPrice": originalPrice,
// "discountAmount": discountAmount,
// "finalPrice": finalPrice,
// "message": message,
// "couponDetails": couponDetails!.toJson(),
// };
// }
// class CouponDetails {
// String? code;
// String? type;
// String? discountValue;
// CouponDetails({
// this.code,
// this.type,
// this.discountValue,
// });
// factory CouponDetails.fromJson(Map<String, dynamic> json) => CouponDetails(
// code: json["code"],
// type: json["type"],
// discountValue: json["discountValue"],
// );
// Map<String, dynamic> toJson() => {
// "code": code,
// "type": type,
// "discountValue": discountValue,
// };
// }
// To parse this JSON data, do
//
// final couponResponse = couponResponseFromJson(jsonString);
@@ -10,7 +83,8 @@ String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
class CouponResponse {
bool? isValid;
String? originalPrice;
int? originalPrice;
int? eligibleSubtotal;
int? discountAmount;
int? finalPrice;
String? message;
@@ -19,6 +93,7 @@ class CouponResponse {
CouponResponse({
this.isValid,
this.originalPrice,
this.eligibleSubtotal,
this.discountAmount,
this.finalPrice,
this.message,
@@ -28,6 +103,7 @@ class CouponResponse {
factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
isValid: json["isValid"],
originalPrice: json["originalPrice"],
eligibleSubtotal: json["eligibleSubtotal"],
discountAmount: json["discountAmount"],
finalPrice: json["finalPrice"],
message: json["message"],
@@ -37,6 +113,7 @@ class CouponResponse {
Map<String, dynamic> toJson() => {
"isValid": isValid,
"originalPrice": originalPrice,
"eligibleSubtotal": eligibleSubtotal,
"discountAmount": discountAmount,
"finalPrice": finalPrice,
"message": message,
@@ -46,8 +123,8 @@ class CouponResponse {
class CouponDetails {
String? code;
String? type;
String? discountValue;
String ?type;
String ?discountValue;
CouponDetails({
this.code,
@@ -67,3 +144,4 @@ class CouponDetails {
"discountValue": discountValue,
};
}

View File

@@ -253,8 +253,10 @@ class AddtocartProvider extends ChangeNotifier {
notifyListeners();
var data = {"couponCode": couponscode, "cartId": cartId};
print("ijdfhjhgjfgihj $data");
try {
var result = await _homeRepo.applyCoupon(data);
return result.fold(
(error) {
@@ -271,7 +273,8 @@ class AddtocartProvider extends ChangeNotifier {
notifyListeners();
return false;
},
(response) {
(response)
{
if (response != null) {
couponResponse = response;
_couponId = id;

View File

@@ -239,6 +239,8 @@ class ProductRepo {
CouponResponse couponresponse =
couponResponseFromJson(response.toString());
print("jdjkgdfjkhdfg $couponresponse");
return right(couponresponse);
} on DioException catch (e) {
var error = CustomDioExceptions.handleError(e);
@@ -442,8 +444,7 @@ class ProductRepo {
}
}
FutureResult<String> refreshToken(data, BuildContext context) async
{
FutureResult<String> refreshToken(data, BuildContext context) async {
try {
var response = await _productService.refresh_token(data);
LoginResponse loginResponse = loginResponseFromJson(response.toString());
@@ -464,12 +465,11 @@ class ProductRepo {
}
}
FutureResult<String> updateDeviceToken(data, BuildContext context) async
{
FutureResult<String> updateDeviceToken(data, BuildContext context) async {
try {
var response = await _productService.updateDeviceToken(data);
final String model = response.toString();
return right(model);
final String model = response.toString();
return right(model);
} on DioException catch (e) {
var error = CustomDioExceptions.handleError(e);
return left(error);

View File

@@ -30,9 +30,7 @@ class _MycartState extends State<Mycart> {
@override
void initState() {
Future.microtask(() {
final addToCartProvider =
Provider.of<AddtocartProvider>(context, listen: false);
final addToCartProvider = Provider.of<AddtocartProvider>(context, listen: false);
addToCartProvider.getItemCards(context);
addToCartProvider.offerCoupon(context);
addToCartProvider.getCurrentLocation(context);

View File

@@ -35,7 +35,7 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
@override
void initState() {
getUserDetails();
// TODO: implement initState
super.initState();
}
@@ -116,22 +116,17 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
Expanded(
child: InkWell(
onTap: () async {
var status = await imageProvider.updateProfile(
context,
firstController.text,
lastController.text);
var status = await imageProvider.updateProfile(
context, firstController.text, lastController.text);
if (status) {
Navigator.pop(context);
}
}
,
if (status) {
Navigator.pop(context);
}
},
child: Container(
height: 50,
decoration: BoxDecoration(
color: imageProvider.isImageLoading
? APPCOLOR.lightGreen
: Colors.grey.withOpacity(0.7),
color: APPCOLOR.lightGreen,
borderRadius: BorderRadius.circular(10)),
child: Center(
child: Text(

View File

@@ -143,7 +143,8 @@ class _HomeScreenState extends State<HomeScreen> {
children: [
Expanded(
child: Consumer<ProductProvider>(
builder: (context, provider, child) {
builder: (context, provider, child)
{
return CompositedTransformTarget(
link: _layerLink,
child: Container(
@@ -155,6 +156,11 @@ class _HomeScreenState extends State<HomeScreen> {
child: TextFormField(
controller: _searchController,
onChanged: (value) {
if (value.isEmpty) {
provider.getHomeProduct(context, "",
_searchController.text, '', '', '');
}
provider.searchProducts(value, context);
if (value.isNotEmpty) {
@@ -734,7 +740,7 @@ class _HomeScreenState extends State<HomeScreen> {
crossAxisSpacing: 5,
mainAxisSpacing: 5,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.4),
(MediaQuery.of(context).size.height / 1.2),
),
itemBuilder: (context, index) {
var product = provider.homeproducts[index];
@@ -754,7 +760,7 @@ class _HomeScreenState extends State<HomeScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 95,
height: 95.h,
decoration: BoxDecoration(
color: APPCOLOR.bgGrey,
borderRadius: BorderRadius.circular(5),

View File

@@ -261,7 +261,8 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
),
Gap(5),
if (orderitem.orderItemStatus != "PENDING" &&
orderitem.orderItemStatus != "CANCELLED")
orderitem.orderItemStatus != "CANCELLED" &&
orderitem.orderItemStatus != "DELIVERED")
RichText(
text: TextSpan(
text: " ",
@@ -321,7 +322,6 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
width: 50,
height: 50,
child: AppNetworkImage(
imageUrl: orderitem.productImage ?? "",
backGroundColor: Colors.transparent,
),

View File

@@ -142,9 +142,7 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
Text(order.orderNumber,
style: TextStyle(
fontWeight: FontWeight.bold)),
Text(order.paymentStatus ?? "",
style:
TextStyle(color: Colors.grey)),
Text(
order.totalItems.toString() +
" items",
@@ -154,16 +152,7 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
),
Spacer(),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal: 5, vertical: 5),
// decoration: BoxDecoration(
// color: Colors.green.shade100,
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(order.orderStatus,
// style: TextStyle(color: Colors.green)),
// ),
],
),
SizedBox(height: 10),
@@ -180,27 +169,6 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
fontWeight: FontWeight.bold)),
Row(
children: [
// ElevatedButton(
// onPressed: () {},
// style: ElevatedButton.styleFrom(
// backgroundColor: Colors.white,
// side: BorderSide(color: Colors.green),
// shape: RoundedRectangleBorder(
// borderRadius:
// BorderRadius.circular(10),
// ),
// ),
// child: Row(
// children: [
// // Icon(Icons.message,
// // color: Colors.green),
// // SizedBox(width: 5),
// // Text('Message',
// // style: TextStyle(
// // color: Colors.green)),
// ],
// ),
// ),
SizedBox(width: 10),
ElevatedButton(
onPressed: () {

View File

@@ -31,11 +31,12 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
);
}
skipbyarrowFunction() {
skipbyarrowFunction()
{
SharedPrefUtils.setFreshInstall(isFresh: false).then(
(value) => context.clearAndPush(routePath: MyRoutes.SIGNUP, args: 0),
);
}
}
onChangedFunction(int index) {
setState(() {

View File

@@ -39,13 +39,13 @@ class PaymentSuccessScreen extends StatelessWidget {
),
),
actions: [
InkWell(
onTap: () {},
child: Icon(
MdiIcons.magnify,
size: 35,
),
)
// InkWell(
// onTap: () {},
// child: Icon(
// MdiIcons.magnify,
// size: 35,
// ),
// )
],
),
body: Center(