From 3b717303520bd753a29d9796acefce312c71a74f Mon Sep 17 00:00:00 2001 From: Anchit Makkar Date: Mon, 8 Jan 2024 20:37:31 +0530 Subject: [PATCH] First Version --- assets/language/ar.json | 2 +- ios/Runner/AppDelegate.swift | 11 +- ios/Runner/Info.plist | 19 +- .../sign_in_model/signin_model.dart | 2 + .../sign_up_model/sign_up_seller_model.dart | 145 ------- .../transaction_detail_model.dart | 279 -------------- .../transaction_model/transaction_model.dart | 360 ------------------ lib/main.dart | 6 +- .../bloc/add_edit_address_bloc.dart | 2 +- .../view/add_edit_address_screen.dart | 4 +- .../data_model/address_model.dart | 4 +- .../bloc/categories_event.dart | 2 +- .../bloc/categories_state.dart | 2 +- .../widget/sub_categories_grid_view.dart | 6 +- .../widget/sub_categories_list.dart | 6 +- .../widget/sub_categories_view.dart | 3 +- .../view/checkout_address_view.dart | 6 +- .../view/checkout_shipping_view.dart | 12 +- .../checkout_save_address_model.dart | 6 +- .../checkout/view/checkout_screen.dart | 22 +- lib/screens/drawer/drawer_list_view.dart | 233 ++++++------ .../home_page/widget/home_page_view.dart | 2 +- .../home_page/widget/new_product_view.dart | 30 +- .../widgets/order_detail_tile.dart | 2 +- .../product_screen/view/product_screen.dart | 4 +- .../recent_product/recent_product_view.dart | 5 +- .../view/widget/categories_view.dart | 1 + lib/screens/sign_in/sign_in_screen.dart | 6 +- lib/screens/sign_up/bloc/sign_up_state.dart | 18 - lib/screens/sign_up/utils/index.dart | 1 - .../view/widget/wishlist_Item_list.dart | 18 +- lib/services/api_client.dart | 2 +- lib/services/mutation_query.dart | 1 + lib/utils/server_configuration.dart | 7 +- 34 files changed, 228 insertions(+), 1001 deletions(-) delete mode 100644 lib/data_model/sign_up_model/sign_up_seller_model.dart delete mode 100644 lib/data_model/transaction_model/transaction_detail_model.dart delete mode 100644 lib/data_model/transaction_model/transaction_model.dart diff --git a/assets/language/ar.json b/assets/language/ar.json index 33e1bc3..1daec1b 100644 --- a/assets/language/ar.json +++ b/assets/language/ar.json @@ -432,7 +432,7 @@ "customerRating": "تقييم العملاء", "closeApp": "سيتم إغلاق طلبك خلال ثانيتين", "noProducts": "لا توجد منتجات", - "pending": "قيد الانتظار", + "pending": "معلق", "closed": "مغلق", "paymentDetails": "بيانات الدفع", "adjustedRefund": "استرداد المعدل", diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4..00980a4 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,12 +1,21 @@ import UIKit import Flutter +import GoogleMaps +import Firebase @UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, MessagingDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + GMSServices.provideAPIKey("AIzaSyAHMKgHxLvPvRwmOaB8NHWcFwn6laFvwbM") + if #available(iOS 10.0, *) { + UNUserNotificationCenter.current().delegate = self + } + application.registerForRemoteNotifications() + Messaging.messaging().delegate = self + GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index d2f8db7..35a934f 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -4,8 +4,6 @@ CADisableMinimumFrameDurationOnPhone - NSCameraUsageDescription - For uploading profile image CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -28,8 +26,21 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + NSCameraUsageDescription + For uploading profile image + NSMicrophoneUsageDescription + For recognise voice phrases to search products + NSPhotoLibraryUsageDescription + For customer profile picture + NSSpeechRecognitionUsageDescription + We need access to the microphone for searching product. UIApplicationSupportsIndirectInputEvents + UIBackgroundModes + + fetch + remote-notification + UILaunchStoryboardName LaunchScreen.storyboard UIMainStoryboardFile @@ -47,9 +58,5 @@ UIViewControllerBasedStatusBarAppearance - NSSpeechRecognitionUsageDescription - We need access to the microphone for searching product. - NSMicrophoneUsageDescription - For recognise voice phrases to search products diff --git a/lib/data_model/sign_in_model/signin_model.dart b/lib/data_model/sign_in_model/signin_model.dart index fc19854..cc00522 100644 --- a/lib/data_model/sign_in_model/signin_model.dart +++ b/lib/data_model/sign_in_model/signin_model.dart @@ -52,6 +52,7 @@ class Data { this.group, this.createdAt, this.updatedAt, + this.imageUrl }); String? id; @@ -63,6 +64,7 @@ class Data { String? dateOfBirth; var phone; Group? group; + String? imageUrl; String? createdAt; String? updatedAt; diff --git a/lib/data_model/sign_up_model/sign_up_seller_model.dart b/lib/data_model/sign_up_model/sign_up_seller_model.dart deleted file mode 100644 index d3c91e0..0000000 --- a/lib/data_model/sign_up_model/sign_up_seller_model.dart +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Webkul Software. - * @package Mobikul Application Code. - * @Category Mobikul - * @author Webkul - * @Copyright (c) Webkul Software Private Limited (https://webkul.com) - * @license https://store.webkul.com/license.html - * @link https://store.webkul.com/license.html - */ - -import 'package:bagisto_app_demo/data_model/graphql_base_model.dart'; -import 'package:bagisto_app_demo/screens/home_page/data_model/new_product_data.dart'; -import 'package:json_annotation/json_annotation.dart'; - - -part 'sign_up_seller_model.g.dart'; -@JsonSerializable() -class CreateSeller extends GraphQlBaseModel{ - String ? success; - String ? accessToken; - String ? id; - String ? url; - bool ? isApproved; - String ? shopTitle; - String ?description; - String? banner; - String ?bannerUrl; - String?logo; - String ?logoUrl; - String ? taxVat; - String ? metaTitle; - String ? metaDescription; - String ? metaKeywords; - String ? address1; - String ? address2; - String ? phone; - String ? state; - String ? city; - String ? country; - String ? postcode; - String ? returnPolicy; - String ? shippingPolicy; - String ? privacyPolicy; - String ? twitter; - String ? facebook; - String ? youtube; - String ? instagram; - String ? skype; - String ? linkedIn; - String ? pinterest; - String ? customerId; - DateTime ? createdAt; - DateTime ? updatedAt; - String ? commissionEnable; - String ? commissionPercentage; - String ? minOrderAmount; - String ? googleAnalyticsId; - String ? profileBackground; - Customer ? customer; - - CreateSeller({ - this.success, - this.accessToken, - this.id, - this.url, - this.isApproved, - this.shopTitle, - this.description, - this.banner, - this.bannerUrl, - this.logo, - this.logoUrl, - this.taxVat, - this.metaTitle, - this.metaDescription, - this.metaKeywords, - this.address1, - this.address2, - this.phone, - this.state, - this.city, - this.country, - this.postcode, - this.returnPolicy, - this.shippingPolicy, - this.privacyPolicy, - this.twitter, - this.facebook, - this.youtube, - this.instagram, - this.skype, - this.linkedIn, - this.pinterest, - this.customerId, - this.createdAt, - this.updatedAt, - this.commissionEnable, - this.commissionPercentage, - this.minOrderAmount, - this.googleAnalyticsId, - this.profileBackground, - this.customer, - }); - factory CreateSeller.fromJson(Map json) => - _$CreateSellerFromJson(json); - - @override - Map toJson() => - _$CreateSellerToJson(this); -} -@JsonSerializable() -class Customer { - String ?name; - String ?id; - String? firstName; - String ?lastName; - String ?email; - String ? imageUrl; - String ? dateOfBirth; - String ? gender; - String ? phone; - String ? notes; - bool ? isVerified; - Seller? seller; - - Customer({ - this.name, - this.id, - this.firstName, - this.lastName, - this.email, - this.imageUrl, - this.dateOfBirth, - this.gender, - this.phone, - this.notes, - this.isVerified, - this.seller - }); - factory Customer.fromJson(Map json) => - _$CustomerFromJson(json); - - Map toJson() => - _$CustomerToJson(this); -} diff --git a/lib/data_model/transaction_model/transaction_detail_model.dart b/lib/data_model/transaction_model/transaction_detail_model.dart deleted file mode 100644 index 9a2bf88..0000000 --- a/lib/data_model/transaction_model/transaction_detail_model.dart +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Webkul Software. - * @package Mobikul Application Code. - * @Category Mobikul - * @author Webkul - * @Copyright (c) Webkul Software Private Limited (https://webkul.com) - * @license https://store.webkul.com/license.html - * @link https://store.webkul.com/license.html - */ - -import 'package:bagisto_app_demo/data_model/transaction_model/transaction_model.dart'; -import 'package:json_annotation/json_annotation.dart'; - -import '../../screens/home_page/data_model/new_product_data.dart'; -import '../graphql_base_model.dart'; -part 'transaction_detail_model.g.dart'; - -@JsonSerializable() -class TransactionDetailModel extends GraphQlBaseModel { - String? id; - String? type; - String? transactionId; - String? method; - String? comment; - double? baseTotal; - String? marketplaceSellerId; - String? marketplaceOrderId; - String? createdAt; - String? updatedAt; - MarketplaceOrder? marketplaceOrder; - - TransactionDetailModel( - {this.id, - this.type, - this.transactionId, - this.method, - this.comment, - this.baseTotal, - this.marketplaceSellerId, - this.marketplaceOrderId, - this.createdAt, - this.updatedAt, - this.marketplaceOrder}); - - factory TransactionDetailModel.fromJson(Map json) => - _$TransactionDetailModelFromJson(json); - - @override - Map toJson() => - _$TransactionDetailModelToJson(this); -} - -@JsonSerializable() -class MarketplaceOrder { - String? id; - String? status; - bool? isWithdrawalRequested; - String? sellerPayoutStatus; - int? commissionPercentage; - double? commission; - double? baseCommission; - double? commissionInvoiced; - double? baseCommissionInvoiced; - double? sellerTotal; - double? baseSellerTotal; - double? sellerTotalInvoiced; - double? baseSellerTotalInvoiced; - int? totalItemCount; - int? totalQtyOrdered; - double? grandTotal; - double? baseGrandTotal; - double? grandTotalInvoiced; - double? baseGrandTotalInvoiced; - int? grandTotalRefunded; - int? baseGrandTotalRefunded; - double? subTotal; - double? baseSubTotal; - double? subTotalInvoiced; - double? baseSubTotalInvoiced; - int? subTotalRefunded; - int? baseSubTotalRefunded; - int? discountPercent; - int? discountAmount; - int? baseDiscountAmount; - int? discountAmountInvoiced; - int? baseDiscountAmountInvoiced; - int? discountRefunded; - int? baseDiscountRefunded; - int? taxAmount; - int? baseTaxAmount; - int? taxAmountInvoiced; - int? baseTaxAmountInvoiced; - int? taxAmountRefunded; - int? baseTaxAmountRefunded; - int? shippingAmount; - int? baseShippingAmount; - int? shippingInvoiced; - int? baseShippingInvoiced; - int? shippingRefunded; - int? baseShippingRefunded; - String? marketplaceSellerId; - String? orderId; - String? createdAt; - String? updatedAt; - Seller? seller; - AdditionalInfo? additionalInfo; - List? marketplaceOrderItems; - - MarketplaceOrder( - {this.id, - this.status, - this.isWithdrawalRequested, - this.sellerPayoutStatus, - this.commissionPercentage, - this.commission, - this.baseCommission, - this.commissionInvoiced, - this.baseCommissionInvoiced, - this.sellerTotal, - this.baseSellerTotal, - this.sellerTotalInvoiced, - this.baseSellerTotalInvoiced, - this.totalItemCount, - this.totalQtyOrdered, - this.grandTotal, - this.baseGrandTotal, - this.grandTotalInvoiced, - this.baseGrandTotalInvoiced, - this.grandTotalRefunded, - this.baseGrandTotalRefunded, - this.subTotal, - this.baseSubTotal, - this.subTotalInvoiced, - this.baseSubTotalInvoiced, - this.subTotalRefunded, - this.baseSubTotalRefunded, - this.discountPercent, - this.discountAmount, - this.baseDiscountAmount, - this.discountAmountInvoiced, - this.baseDiscountAmountInvoiced, - this.discountRefunded, - this.baseDiscountRefunded, - this.taxAmount, - this.baseTaxAmount, - this.taxAmountInvoiced, - this.baseTaxAmountInvoiced, - this.taxAmountRefunded, - this.baseTaxAmountRefunded, - this.shippingAmount, - this.baseShippingAmount, - this.shippingInvoiced, - this.baseShippingInvoiced, - this.shippingRefunded, - this.baseShippingRefunded, - this.marketplaceSellerId, - this.orderId, - this.createdAt, - this.updatedAt, - this.seller, - this.marketplaceOrderItems, this.additionalInfo}); - - factory MarketplaceOrder.fromJson(Map json) => - _$MarketplaceOrderFromJson(json); - - Map toJson() => - _$MarketplaceOrderToJson(this); -} - -@JsonSerializable() -class AdditionalInfo { - FormattedPrice? formattedPrice; - - AdditionalInfo({this.formattedPrice}); - - factory AdditionalInfo.fromJson(Map json) => - _$AdditionalInfoFromJson(json); - - Map toJson() => - _$AdditionalInfoToJson(this); - -} - -@JsonSerializable() -class FormattedPrice { - String? commission; - String? total; - String? dueTotal; - String? price; - String? baseRemainingTotal; - String? baseCommission; - String? commissionInvoiced; - String? baseCommissionInvoiced; - String? sellerTotal; - String? baseSellerTotal; - String? sellerTotalInvoiced; - String? baseSellerTotalInvoiced; - String? grandTotal; - String? baseGrandTotal; - String? grandTotalInvoiced; - String? baseGrandTotalInvoiced; - String? grandTotalRefunded; - String? baseGrandTotalRefunded; - String? subTotal; - String? totalPaid; - String? baseSubTotal; - String? subTotalInvoiced; - String? baseSubTotalInvoiced; - String? subTotalRefunded; - String? baseSubTotalRefunded; - String? discountAmount; - String? baseDiscountAmount; - String? discountAmountInvoiced; - String? baseDiscountAmountInvoiced; - String? discountRefunded; - String? baseDiscountRefunded; - String? taxAmount; - String? baseTaxAmount; - String? taxAmountInvoiced; - String? baseTaxAmountInvoiced; - String? taxAmountRefunded; - String? baseTaxAmountRefunded; - String? shippingAmount; - String? baseShippingAmount; - String? shippingInvoiced; - String? baseShippingInvoiced; - String? shippingRefunded; - String? baseShippingRefunded; - - FormattedPrice({this.commission, - this.baseCommission, - this.commissionInvoiced, - this.baseCommissionInvoiced, - this.sellerTotal, - this.baseSellerTotal, - this.sellerTotalInvoiced, - this.baseSellerTotalInvoiced, - this.grandTotal, - this.baseGrandTotal, - this.grandTotalInvoiced, - this.baseGrandTotalInvoiced, - this.grandTotalRefunded, - this.baseGrandTotalRefunded, - this.subTotal, - this.baseSubTotal, - this.subTotalInvoiced, - this.baseSubTotalInvoiced, - this.subTotalRefunded, - this.baseSubTotalRefunded, - this.discountAmount, - this.baseDiscountAmount, - this.discountAmountInvoiced, - this.baseDiscountAmountInvoiced, - this.discountRefunded, - this.baseDiscountRefunded, - this.taxAmount, - this.baseTaxAmount, - this.taxAmountInvoiced, - this.baseTaxAmountInvoiced, - this.taxAmountRefunded, - this.baseTaxAmountRefunded, - this.shippingAmount, - this.baseShippingAmount, - this.shippingInvoiced, - this.baseShippingInvoiced, - this.shippingRefunded, this.baseRemainingTotal, - this.baseShippingRefunded, this.price, this.total,this.dueTotal, this.totalPaid}); - - factory FormattedPrice.fromJson(Map json) => - _$FormattedPriceFromJson(json); - - Map toJson() => - _$FormattedPriceToJson(this); -} - - - - - diff --git a/lib/data_model/transaction_model/transaction_model.dart b/lib/data_model/transaction_model/transaction_model.dart deleted file mode 100644 index e6caaef..0000000 --- a/lib/data_model/transaction_model/transaction_model.dart +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Webkul Software. - * @package Mobikul Application Code. - * @Category Mobikul - * @author Webkul - * @Copyright (c) Webkul Software Private Limited (https://webkul.com) - * @license https://store.webkul.com/license.html - * @link https://store.webkul.com/license.html - */ - -import 'package:json_annotation/json_annotation.dart'; - -import '../../screens/home_page/data_model/new_product_data.dart'; -import '../graphql_base_model.dart'; - -part 'transaction_model.g.dart'; - -@JsonSerializable() -class TransactionModel extends GraphQlBaseModel{ - PaginatorInfo? paginatorInfo; - List? data; - - TransactionModel({this.paginatorInfo, this.data}); - - factory TransactionModel.fromJson(Map json) => - _$TransactionModelFromJson(json); - - @override - Map toJson() => - _$TransactionModelToJson(this); - -} - -@JsonSerializable() -class PaginatorInfo { - int? count; - int? currentPage; - int? lastPage; - int? total; - - PaginatorInfo({this.count, this.currentPage, this.lastPage, this.total}); - factory PaginatorInfo.fromJson(Map json) => - _$PaginatorInfoFromJson(json); - - Map toJson() => - _$PaginatorInfoToJson(this); - -} - -@JsonSerializable() -class TransactionData { - String? id; - String? type; - String? transactionId; - String? method; - String? comment; - double? baseTotal; - String? marketplaceSellerId; - String? marketplaceOrderId; - String? createdAt; - String? updatedAt; - MarketplaceOrder? marketplaceOrder; - - TransactionData( - {this.id, - this.type, - this.transactionId, - this.method, - this.comment, - this.baseTotal, - this.marketplaceSellerId, - this.marketplaceOrderId, - this.createdAt, - this.updatedAt, - this.marketplaceOrder}); - - factory TransactionData.fromJson(Map json) => - _$TransactionDataFromJson(json); - - Map toJson() => - _$TransactionDataToJson(this); -} - -@JsonSerializable() -class MarketplaceOrder { - String? id; - String? status; - bool? isWithdrawalRequested; - String? sellerPayoutStatus; - int? commissionPercentage; - double? commission; - double? baseCommission; - double? commissionInvoiced; - double? baseCommissionInvoiced; - double? sellerTotal; - double? baseSellerTotal; - double? sellerTotalInvoiced; - double? baseSellerTotalInvoiced; - int? totalItemCount; - int? totalQtyOrdered; - double? grandTotal; - double? baseGrandTotal; - double? grandTotalInvoiced; - double? baseGrandTotalInvoiced; - int? grandTotalRefunded; - int? baseGrandTotalRefunded; - double? subTotal; - double? baseSubTotal; - double? subTotalInvoiced; - double? baseSubTotalInvoiced; - int? subTotalRefunded; - int? baseSubTotalRefunded; - int? discountPercent; - int? discountAmount; - int? baseDiscountAmount; - int? discountAmountInvoiced; - int? baseDiscountAmountInvoiced; - int? discountRefunded; - int? baseDiscountRefunded; - int? taxAmount; - int? baseTaxAmount; - int? taxAmountInvoiced; - int? baseTaxAmountInvoiced; - int? taxAmountRefunded; - int? baseTaxAmountRefunded; - int? shippingAmount; - int? baseShippingAmount; - int? shippingInvoiced; - int? baseShippingInvoiced; - int? shippingRefunded; - int? baseShippingRefunded; - String? marketplaceSellerId; - String? orderId; - String? createdAt; - String? updatedAt; - Seller? seller; - AdditionalInfo? additionalInfo; - List? marketplaceOrderItems; - - MarketplaceOrder( - {this.id, - this.status, - this.isWithdrawalRequested, - this.sellerPayoutStatus, - this.commissionPercentage, - this.commission, - this.baseCommission, - this.commissionInvoiced, - this.baseCommissionInvoiced, - this.sellerTotal, - this.baseSellerTotal, - this.sellerTotalInvoiced, - this.baseSellerTotalInvoiced, - this.totalItemCount, - this.totalQtyOrdered, - this.grandTotal, - this.baseGrandTotal, - this.grandTotalInvoiced, - this.baseGrandTotalInvoiced, - this.grandTotalRefunded, - this.baseGrandTotalRefunded, - this.subTotal, - this.baseSubTotal, - this.subTotalInvoiced, - this.baseSubTotalInvoiced, - this.subTotalRefunded, - this.baseSubTotalRefunded, - this.discountPercent, - this.discountAmount, - this.baseDiscountAmount, - this.discountAmountInvoiced, - this.baseDiscountAmountInvoiced, - this.discountRefunded, - this.baseDiscountRefunded, - this.taxAmount, - this.baseTaxAmount, - this.taxAmountInvoiced, - this.baseTaxAmountInvoiced, - this.taxAmountRefunded, - this.baseTaxAmountRefunded, - this.shippingAmount, - this.baseShippingAmount, - this.shippingInvoiced, - this.baseShippingInvoiced, - this.shippingRefunded, - this.baseShippingRefunded, - this.marketplaceSellerId, - this.orderId, - this.createdAt, - this.updatedAt, - this.seller, - this.marketplaceOrderItems, this.additionalInfo}); - - factory MarketplaceOrder.fromJson(Map json) => - _$MarketplaceOrderFromJson(json); - - Map toJson() => _$MarketplaceOrderToJson(this); -} - -@JsonSerializable() -class AdditionalInfo { - FormattedPrice? formattedPrice; - - AdditionalInfo({this.formattedPrice}); - - factory AdditionalInfo.fromJson(Map json) => - _$AdditionalInfoFromJson(json); - - Map toJson() => _$AdditionalInfoToJson(this); -} - -@JsonSerializable() -class FormattedPrice { - String? sellerTotal; - String? baseSellerTotal; - String? baseSellerTotalInvoiced; - - FormattedPrice( - {this.sellerTotal, this.baseSellerTotal, this.baseSellerTotalInvoiced}); - - factory FormattedPrice.fromJson(Map json) => - _$FormattedPriceFromJson(json); - - Map toJson() => _$FormattedPriceToJson(this); -} - -@JsonSerializable() -class MarketplaceOrderItem { - String? id; - double? commission; - double? baseCommission; - double? commissionInvoiced; - double? baseCommissionInvoiced; - double? sellerTotal; - double? baseSellerTotal; - double? sellerTotalInvoiced; - double? baseSellerTotalInvoiced; - String? orderItemId; - String? marketplaceProductId; - String? marketplaceOrderId; - String? parentId; - OrderItem? orderItem; - - MarketplaceOrderItem( - {this.id, - this.commission, - this.baseCommission, - this.commissionInvoiced, - this.baseCommissionInvoiced, - this.sellerTotal, - this.baseSellerTotal, - this.sellerTotalInvoiced, - this.baseSellerTotalInvoiced, - this.orderItemId, - this.marketplaceProductId, - this.marketplaceOrderId, - this.parentId, - this.orderItem}); - - factory MarketplaceOrderItem.fromJson(Map json) => - _$MarketplaceOrderItemFromJson(json); - - Map toJson() => - _$MarketplaceOrderItemToJson(this); -} - -@JsonSerializable() -class OrderItem { - String? id; - String? sku; - String? type; - String? name; - String? couponCode; - double? weight; - double? totalWeight; - int? qtyOrdered; - int? qtyShipped; - int? qtyInvoiced; - int? qtyCanceled; - int? qtyRefunded; - double? price; - double? basePrice; - double? total; - double? baseTotal; - double? totalInvoiced; - double? baseTotalInvoiced; - int? amountRefunded; - int? baseAmountRefunded; - int? discountPercent; - int? discountAmount; - int? baseDiscountAmount; - int? discountInvoiced; - int? baseDiscountInvoiced; - int? discountRefunded; - int? baseDiscountRefunded; - int? taxPercent; - int? taxAmount; - int? baseTaxAmount; - int? taxAmountInvoiced; - int? baseTaxAmountInvoiced; - int? taxAmountRefunded; - int? baseTaxAmountRefunded; - String? productId; - String? productType; - String? orderId; - String? parentId; - String? additional; - String? createdAt; - String? updatedAt; - - OrderItem( - {this.id, - this.sku, - this.type, - this.name, - this.couponCode, - this.weight, - this.totalWeight, - this.qtyOrdered, - this.qtyShipped, - this.qtyInvoiced, - this.qtyCanceled, - this.qtyRefunded, - this.price, - this.basePrice, - this.total, - this.baseTotal, - this.totalInvoiced, - this.baseTotalInvoiced, - this.amountRefunded, - this.baseAmountRefunded, - this.discountPercent, - this.discountAmount, - this.baseDiscountAmount, - this.discountInvoiced, - this.baseDiscountInvoiced, - this.discountRefunded, - this.baseDiscountRefunded, - this.taxPercent, - this.taxAmount, - this.baseTaxAmount, - this.taxAmountInvoiced, - this.baseTaxAmountInvoiced, - this.taxAmountRefunded, - this.baseTaxAmountRefunded, - this.productId, - this.productType, - this.orderId, - this.parentId, - this.additional, - this.createdAt, - this.updatedAt}); - - - factory OrderItem.fromJson(Map json) => - _$OrderItemFromJson(json); - - Map toJson() => - _$OrderItemToJson(this); -} diff --git a/lib/main.dart b/lib/main.dart index e8ce275..4a2e26f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,6 +17,7 @@ import 'package:bagisto_app_demo/utils/app_global_data.dart'; import 'package:bagisto_app_demo/utils/app_navigation.dart'; import 'package:bagisto_app_demo/utils/application_localization.dart'; import 'package:bagisto_app_demo/utils/mobikul_theme.dart'; +import 'package:bagisto_app_demo/utils/push_notifications_manager.dart'; import 'package:bagisto_app_demo/utils/route_constants.dart'; import 'package:bagisto_app_demo/utils/server_configuration.dart'; import 'package:bagisto_app_demo/utils/shared_preference_helper.dart'; @@ -135,8 +136,9 @@ class _BagistoAppState extends State { @override void initState() { _locale = Locale(GlobalData.locale ?? defaultStoreCode); - getToken(); - getSubscription(); + PushNotificationsManager.instance.setUpFirebase(context); + // getToken(); + // getSubscription(); super.initState(); } diff --git a/lib/screens/add_edit_address/bloc/add_edit_address_bloc.dart b/lib/screens/add_edit_address/bloc/add_edit_address_bloc.dart index 017e1d5..eba1403 100644 --- a/lib/screens/add_edit_address/bloc/add_edit_address_bloc.dart +++ b/lib/screens/add_edit_address/bloc/add_edit_address_bloc.dart @@ -31,7 +31,7 @@ class AddEditAddressBloc try { UpdateAddressModel? updateAddressModel = await repository?.callEditAddressApi( - event.addressId ?? 9, + event.addressId ?? 0, event.companyName ?? "", event.firstName ?? "", event.lastName ?? "", diff --git a/lib/screens/add_edit_address/view/add_edit_address_screen.dart b/lib/screens/add_edit_address/view/add_edit_address_screen.dart index f60a5fa..c7d0db9 100644 --- a/lib/screens/add_edit_address/view/add_edit_address_screen.dart +++ b/lib/screens/add_edit_address/view/add_edit_address_screen.dart @@ -163,6 +163,8 @@ class _AddNewAddressState extends State city: cityController.text, phone: phoneController.text, postcode: zipCodeController.text, + billingAddressId: widget.addressModel?.billingAddressId, + shippingAddressId: widget.addressModel?.shippingAddressId, isDefault: isDefault)); Future.delayed(const Duration(seconds: 2), () { Navigator.pop( @@ -574,7 +576,7 @@ class _AddNewAddressState extends State widget.isEdit ? addEditAddressBloc?.add(FetchEditAddressEvent( - addressId: int.parse(widget.addressModel?.id ?? ""), + addressId: int.parse(widget.addressModel?.id ?? "0"), address: street1Controller.text, city: cityController.text, country: (widget.isEdit && selectedCountry?.code == null) diff --git a/lib/screens/address_list/data_model/address_model.dart b/lib/screens/address_list/data_model/address_model.dart index 8eb60cc..11f567e 100644 --- a/lib/screens/address_list/data_model/address_model.dart +++ b/lib/screens/address_list/data_model/address_model.dart @@ -49,6 +49,8 @@ class AddressData { String? updatedAt; String? address2; String? addressType; + int? billingAddressId; + int? shippingAddressId; AddressData( {this.id, @@ -66,7 +68,7 @@ class AddressData { this.phone, this.isDefault, this.createdAt, - this.updatedAt, this.address2, this.addressType}); + this.updatedAt, this.address2, this.addressType, this.shippingAddressId, this.billingAddressId}); factory AddressData.fromJson(Map json) => _$AddressDataFromJson(json); diff --git a/lib/screens/categories_screen/bloc/categories_event.dart b/lib/screens/categories_screen/bloc/categories_event.dart index f94e3d8..e7ebe53 100644 --- a/lib/screens/categories_screen/bloc/categories_event.dart +++ b/lib/screens/categories_screen/bloc/categories_event.dart @@ -50,7 +50,7 @@ class FetchDeleteAddItemCategoryEvent extends CategoryBaseEvent{ class FetchDeleteItemEvent extends CategoryBaseEvent{ NewProducts? datum; - int productId; + String? productId; FetchDeleteItemEvent(this.productId,this.datum); @override List get props => []; diff --git a/lib/screens/categories_screen/bloc/categories_state.dart b/lib/screens/categories_screen/bloc/categories_state.dart index e92c709..38f3157 100644 --- a/lib/screens/categories_screen/bloc/categories_state.dart +++ b/lib/screens/categories_screen/bloc/categories_state.dart @@ -108,7 +108,7 @@ class RemoveWishlistState extends CategoriesBaseState{ String? successMsg=""; String? error=""; GraphQlBaseModel? response; - int? productDeletedId; + String? productDeletedId; RemoveWishlistState.success({this.response, this.productDeletedId,this.successMsg}):status=CategoriesStatus.success; RemoveWishlistState.fail({this.error}):status=CategoriesStatus.fail; diff --git a/lib/screens/categories_screen/widget/sub_categories_grid_view.dart b/lib/screens/categories_screen/widget/sub_categories_grid_view.dart index 701c1bb..875c38d 100644 --- a/lib/screens/categories_screen/widget/sub_categories_grid_view.dart +++ b/lib/screens/categories_screen/widget/sub_categories_grid_view.dart @@ -60,7 +60,7 @@ class SubCategoriesGridView extends StatelessWidget { borderRadius: BorderRadius.circular(AppSizes.spacingNormal), ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack(children: [ @@ -149,7 +149,7 @@ class SubCategoriesGridView extends StatelessWidget { if (isLogin ?? false) { if (data?.isInWishlist ?? false) { subCategoryBloc?.add(FetchDeleteItemEvent( - int.parse(data?.id ?? ""), data)); + data?.id ?? "", data)); } else { subCategoryBloc?.add( FetchDeleteAddItemCategoryEvent( @@ -174,7 +174,7 @@ class SubCategoriesGridView extends StatelessWidget { subCategoryBloc?.add(OnClickSubCategoriesLoaderEvent( isReqToShowLoader: true)); subCategoryBloc?.add(AddToCompareSubCategoryEvent( - data?.productFlats?.firstOrNull?.id ?? "", "")); + data?.id ?? "", "")); } else { ShowMessage.warningNotification( StringConstants.pleaseLogin.localized(), context); diff --git a/lib/screens/categories_screen/widget/sub_categories_list.dart b/lib/screens/categories_screen/widget/sub_categories_list.dart index 65744be..c550e8a 100644 --- a/lib/screens/categories_screen/widget/sub_categories_list.dart +++ b/lib/screens/categories_screen/widget/sub_categories_list.dart @@ -112,7 +112,7 @@ class SubCategoriesList extends StatelessWidget { top: AppSizes.spacingSmall, child: Container( decoration: const BoxDecoration( - color: Colors.black, + color: Colors.green, borderRadius: BorderRadius.all( Radius.circular( AppSizes.spacingLarge))), @@ -231,7 +231,7 @@ class SubCategoriesList extends StatelessWidget { if (isLogin ?? false) { if (data?.isInWishlist ?? false) { subCategoryBloc?.add(FetchDeleteItemEvent( - int.parse(data?.id ?? ""), data)); + data?.id ?? "", data)); } else { subCategoryBloc?.add( FetchDeleteAddItemCategoryEvent( @@ -258,7 +258,7 @@ class SubCategoriesList extends StatelessWidget { OnClickSubCategoriesLoaderEvent( isReqToShowLoader: true)); subCategoryBloc?.add(AddToCompareSubCategoryEvent( - data?.productFlats?.firstOrNull?.id ?? "", + data?.id ?? "", "")); } else { ShowMessage.warningNotification(StringConstants.pleaseLogin.localized(), context, title: ""); diff --git a/lib/screens/categories_screen/widget/sub_categories_view.dart b/lib/screens/categories_screen/widget/sub_categories_view.dart index 947f49e..a14fd99 100644 --- a/lib/screens/categories_screen/widget/sub_categories_view.dart +++ b/lib/screens/categories_screen/widget/sub_categories_view.dart @@ -91,8 +91,7 @@ class _SubCategoriesViewState extends State { physics: const NeverScrollableScrollPhysics(), itemCount: widget.categoriesData?.data?.length ?? 0, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - mainAxisExtent: - GlobalData.selectedLanguage == "ar" ? (MediaQuery.of(context).size.height / 3) + 160 : (MediaQuery.of(context).size.height / 3) + 165 , + mainAxisExtent: (MediaQuery.of(context).size.height / 3) + 165, crossAxisCount: 2,), itemBuilder: (BuildContext context, int index) { if (index == widget.categoriesData?.data?.length) { diff --git a/lib/screens/checkout/checkout_addres/view/checkout_address_view.dart b/lib/screens/checkout/checkout_addres/view/checkout_address_view.dart index 992ed42..d63af6e 100644 --- a/lib/screens/checkout/checkout_addres/view/checkout_address_view.dart +++ b/lib/screens/checkout/checkout_addres/view/checkout_address_view.dart @@ -107,10 +107,8 @@ class _CheckoutAddressViewState extends State { if (state is CheckOutAddressState) { if (state.status == CheckOutStatus.success) { _addressModel = state.addressModel; - billingAddress ??= _addressModel?.addressData - ?.firstWhereOrNull((element) => element.isDefault ?? false); - shippingAddress ??= _addressModel?.addressData - ?.firstWhereOrNull((element) => element.isDefault ?? false); + billingAddress ??= _addressModel?.addressData?.firstWhereOrNull((element) => element.isDefault ?? false); + shippingAddress ??= _addressModel?.addressData?.firstWhereOrNull((element) => element.isDefault ?? false); if (billingAddress == null && (_addressModel?.addressData?.isNotEmpty ?? false)) { billingAddress = _addressModel?.addressData?.first; diff --git a/lib/screens/checkout/checkout_shipping/view/checkout_shipping_view.dart b/lib/screens/checkout/checkout_shipping/view/checkout_shipping_view.dart index 2ddc336..4a27068 100644 --- a/lib/screens/checkout/checkout_shipping/view/checkout_shipping_view.dart +++ b/lib/screens/checkout/checkout_shipping/view/checkout_shipping_view.dart @@ -51,6 +51,8 @@ class CheckoutShippingPageView extends StatefulWidget { int billingId; int shippingId; ValueChanged? callBack; + bool isDownloadable; + Function? callbackNavigate; CheckoutShippingPageView( {Key? key, this.billingCompanyName, @@ -75,7 +77,8 @@ class CheckoutShippingPageView extends StatefulWidget { this.shippingCity, this.shippingPostCode, this.shippingPhone, - this.callBack, required this.shippingId, required this.billingId}) + this.callBack, required this.shippingId, required this.billingId, this.isDownloadable = false, + this.callbackNavigate}) : super(key: key); @override @@ -126,11 +129,16 @@ class _CheckoutShippingPageViewState extends State { return BlocConsumer( listener: (BuildContext context, CheckOutShippingBaseState state) { if(state is CheckOutFetchShippingState){ - if((state.checkOutSaveAddressModel?.shippingMethods ?? []).isEmpty){ + if((state.checkOutSaveAddressModel?.shippingMethods ?? []).isEmpty && widget.isDownloadable==false){ ShowMessage.showNotification(StringConstants.failed.localized(), StringConstants.noShippingMsg.localized(), Colors.red, const Icon(Icons.cancel_outlined)); } } + if(widget.isDownloadable){ + if (widget.callbackNavigate != null) { + widget.callbackNavigate!(); + } + } }, builder: (BuildContext context, CheckOutShippingBaseState state) { return buildUI(context, state); diff --git a/lib/screens/checkout/data_model/checkout_save_address_model.dart b/lib/screens/checkout/data_model/checkout_save_address_model.dart index dfeeddc..50f60f3 100644 --- a/lib/screens/checkout/data_model/checkout_save_address_model.dart +++ b/lib/screens/checkout/data_model/checkout_save_address_model.dart @@ -46,10 +46,10 @@ class SaveCheckoutAddresses extends GraphQlBaseErrorModel{ String? success; String? cartTotal; int? cartCount; - List? shippingMethods; - Payment? paymentMethods; + dynamic shippingMethods; + dynamic paymentMethods; String? jumpToSection; - CartModel? cart; + dynamic cart; SaveCheckoutAddresses( {this.success, diff --git a/lib/screens/checkout/view/checkout_screen.dart b/lib/screens/checkout/view/checkout_screen.dart index d36d18c..3431ae8 100644 --- a/lib/screens/checkout/view/checkout_screen.dart +++ b/lib/screens/checkout/view/checkout_screen.dart @@ -240,8 +240,7 @@ class _CheckoutScreenState extends State { if(shippingAddressId != 0) { this.shippingAddressId = shippingAddressId; } - - }, + } ), ) : BlocProvider( @@ -328,6 +327,12 @@ class _CheckoutScreenState extends State { ) { shippingId = id; }, + isDownloadable : widget.isDownloadable ?? false, + callbackNavigate: (){ + setState(() { + currentIndex = currentIndex+1; + }); + } ), ); case 3: @@ -454,12 +459,13 @@ class _CheckoutScreenState extends State { } } else { setState(() { - if ((widget.isDownloadable ?? false) && - currentIndex == 1) { - currentIndex = currentIndex + 2; - } else { - currentIndex = currentIndex + 1; - } + // if ((widget.isDownloadable ?? false) && + // currentIndex == 1) { + // currentIndex = currentIndex + 2; + // } else { + // currentIndex = currentIndex + 1; + // } + currentIndex = currentIndex + 1; }); } } diff --git a/lib/screens/drawer/drawer_list_view.dart b/lib/screens/drawer/drawer_list_view.dart index f31dc50..86f02f3 100644 --- a/lib/screens/drawer/drawer_list_view.dart +++ b/lib/screens/drawer/drawer_list_view.dart @@ -48,6 +48,7 @@ class DrawerListView extends StatefulWidget { } class _DrawerListViewState extends State { + @override Widget build(BuildContext context) { List drawerList = []; @@ -63,8 +64,8 @@ class _DrawerListViewState extends State { }, child: Container( margin: const EdgeInsets.all(AppSizes.spacingLarge), - padding: - const EdgeInsets.symmetric(vertical: AppSizes.spacingNormal / 2), + padding: const EdgeInsets.symmetric( + vertical: AppSizes.spacingNormal / 2), decoration: BoxDecoration( border: Border.all(color: Colors.grey.shade400), borderRadius: BorderRadius.circular(AppSizes.spacingLarge)), @@ -80,18 +81,19 @@ class _DrawerListViewState extends State { fit: BoxFit.cover, image: AssetImage(AssetConstants.userPlaceHolder)), )) - : Padding( + : + Padding( padding: const EdgeInsets.all(AppSizes.spacingNormal), child: CircleAvatar( foregroundImage: NetworkImage(widget.image ?? ""), - backgroundImage: - const AssetImage(AssetConstants.userPlaceHolder), - ), + backgroundImage: const AssetImage(AssetConstants.userPlaceHolder), + ) ), Expanded( child: Column( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( !widget.isLoggedIn @@ -104,42 +106,46 @@ class _DrawerListViewState extends State { const Shadow( offset: Offset(0.5, 0.5), blurRadius: 3.0, - color: Color.fromARGB(40, 0, 0, 0), + color: Color.fromARGB( + 40, 0, 0, 0), ), const Shadow( offset: Offset(0.5, 0.5), blurRadius: 5, - color: Color.fromARGB(40, 0, 0, 255), + color: Color.fromARGB( + 40, 0, 0, 255), ), ], ), ), - if (widget.isLoggedIn) - Text(widget.customerDetails?.data?.email ?? "", - style: - Theme.of(context).textTheme.bodyLarge?.copyWith( - shadows: [ - const Shadow( - offset: Offset(0.5, 0.5), - blurRadius: 3.0, - color: Color.fromARGB(40, 0, 0, 0), - ), - const Shadow( - offset: Offset(0.5, 0.5), - blurRadius: 5, - color: Color.fromARGB(40, 0, 0, 255), - ), - ], - color: Colors.grey, - )), + if(widget.isLoggedIn) Text( + widget.customerDetails?.data?.email ?? "", + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(shadows: [ + const Shadow( + offset: Offset(0.5, 0.5), + blurRadius: 3.0, + color: + Color.fromARGB(40, 0, 0, 0), + ), + const Shadow( + offset: Offset(0.5, 0.5), + blurRadius: 5, + color: Color.fromARGB( + 40, 0, 0, 255), + ), + ], + color: Colors.grey, + )), ], ), ), - if (!widget.isLoggedIn) - const Padding( - padding: EdgeInsets.only(right: AppSizes.spacingNormal), - child: Icon(Icons.keyboard_double_arrow_right), - ) + if(!widget.isLoggedIn) const Padding( + padding: EdgeInsets.only(right: AppSizes.spacingNormal), + child: Icon(Icons.keyboard_double_arrow_right), + ) ], ), ), @@ -150,88 +156,85 @@ class _DrawerListViewState extends State { drawerList.add(DrawerCategoryItem(element)); }); - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - checkInternetConnection().then((value) { - if (value) { - Navigator.pop(context); - Navigator.of(context).pushNamed(dashboardScreen); - } else { - ShowMessage.showNotification( - StringConstants.failed.localized(), - StringConstants.internetIssue.localized(), - Colors.red, - const Icon(Icons.cancel_outlined)); - } - }); - }, - icon: Icons.dashboard, - subTitle: StringConstants.dashboard, - )); + onTap: () { + checkInternetConnection().then((value) { + if (value) { + Navigator.pop(context); + Navigator.of(context).pushNamed(dashboardScreen); + } else { + ShowMessage.showNotification(StringConstants.failed.localized(),StringConstants.internetIssue.localized(), + Colors.red, const Icon(Icons.cancel_outlined)); + } + }); + }, + icon: Icons.dashboard, + subTitle: StringConstants.dashboard, + )); } - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - checkInternetConnection().then((value) { - if (value) { - Navigator.pushNamed(context, downloadableProductScreen); - } else { - ShowMessage.showNotification( - StringConstants.failed.localized(), - StringConstants.internetIssue.localized(), - Colors.red, - const Icon(Icons.cancel_outlined)); - } - }); - }, - icon: Icons.download_outlined, - subTitle: StringConstants.downloadableProductsList, - )); + onTap: () { + checkInternetConnection().then((value) { + if (value) { + Navigator.pushNamed(context, downloadableProductScreen); + } else { + ShowMessage.showNotification(StringConstants.failed.localized(), + StringConstants.internetIssue.localized(), + Colors.red, const Icon(Icons.cancel_outlined)); + } + }); + }, + icon: Icons.download_outlined, + subTitle: StringConstants.downloadableProductsList, + )); } - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - Navigator.pop(context); - Navigator.of(context).pushNamed(addressListScreen); - }, - icon: Icons.gps_fixed_outlined, - subTitle: StringConstants.addressTitle, - )); + onTap: () { + Navigator.pop(context); + Navigator.of(context).pushNamed(addressListScreen); + }, + icon: Icons.gps_fixed_outlined, + subTitle: StringConstants.addressTitle, + )); } - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - Navigator.of(context).pushNamed(reviewList); - }, - icon: Icons.reviews, - subTitle: StringConstants.reviewsTitle, - )); + onTap: () { + Navigator.of(context).pushNamed(reviewList); + }, + icon: Icons.reviews, + subTitle: StringConstants.reviewsTitle, + )); } - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - Navigator.of(context).pushNamed(wishlistScreen).then((value) { - Navigator.pop(context); - }); - }, - icon: Icons.favorite_outline_rounded, - subTitle: StringConstants.wishListTitle, - )); + onTap: () { + Navigator.of(context) + .pushNamed(wishlistScreen) + .then((value) { + Navigator.pop(context); + }); + }, + icon: Icons.favorite_outline_rounded, + subTitle: StringConstants.wishListTitle, + )); } - if (widget.isLoggedIn) { + if(widget.isLoggedIn) { drawerList.add(DrawerAddItemList( - onTap: () { - Navigator.of(context).pushNamed(orderListScreen); - }, - icon: Icons.reorder, - subTitle: StringConstants.orderTitle, - )); + onTap: () { + Navigator.of(context).pushNamed(orderListScreen); + }, + icon: Icons.reorder, + subTitle: StringConstants.orderTitle, + )); } if (widget.cmsData != null) { @@ -279,27 +282,22 @@ class _DrawerListViewState extends State { }).toList(), elevation: 0, onChanged: (val) async { - Currencies? currency = widget.currencyLanguageList?.currencies - ?.firstWhereOrNull((element) => element.name == val); + Currencies? currency = widget.currencyLanguageList?.currencies?.firstWhereOrNull((element) => element.name == val); if (currency?.name == widget.customerCurrency) { - SharedPreferenceHelper.setCurrencyCode( - currency?.code ?? "USD"); + SharedPreferenceHelper.setCurrencyCode(currency?.code ?? "USD"); Navigator.pop(context, currency?.code); } else { - SharedPreferenceHelper.setCurrencyCode( - currency?.code ?? "USD"); - GlobalData.currency = - await SharedPreferenceHelper.getCurrencyCode(); - SharedPreferenceHelper.setCurrencyLabel( - currency?.name ?? "US Dollar"); + SharedPreferenceHelper.setCurrencyCode(currency?.code ?? "USD"); + GlobalData.currency = await SharedPreferenceHelper.getCurrencyCode(); + SharedPreferenceHelper.setCurrencyLabel(currency?.name ?? "US Dollar"); AppDatabase.getDatabase().then( - (value) => value.recentProductDao.deleteRecentProducts()); + (value) => value.recentProductDao + .deleteRecentProducts()); - if (context.mounted) { + if(context.mounted){ RestartWidget.restartApp(context); - Navigator.pushNamedAndRemoveUntil( - context, splash, (route) => false); + Navigator.pushNamedAndRemoveUntil(context, splash, (route) => false); } } }, @@ -317,20 +315,19 @@ class _DrawerListViewState extends State { ); }).toList(), elevation: 0, - onChanged: (val) async { - Locales? local = GlobalData.languageData - ?.firstWhereOrNull((element) => element.name == val); + onChanged: (val) async{ + Locales? local = GlobalData.languageData?.firstWhereOrNull((element) => element.name == val); - GlobalData.selectedLanguage = local?.code ?? ""; + GlobalData.selectedLanguage = local?.code?? ""; SharedPreferenceHelper.setCustomerLanguage(local?.code ?? ""); GlobalData.locale = await SharedPreferenceHelper.getCustomerLanguage(); SharedPreferenceHelper.setLanguageName(local?.name ?? ""); AppDatabase.getDatabase().then( - (value) => value.recentProductDao.deleteRecentProducts()); + (value) => value.recentProductDao.deleteRecentProducts()); - if (context.mounted) { + if(context.mounted){ RestartWidget.restartApp(context); Navigator.pushNamedAndRemoveUntil( diff --git a/lib/screens/home_page/widget/home_page_view.dart b/lib/screens/home_page/widget/home_page_view.dart index d26cd12..1bef9b9 100644 --- a/lib/screens/home_page/widget/home_page_view.dart +++ b/lib/screens/home_page/widget/home_page_view.dart @@ -205,7 +205,7 @@ class _HomePagViewState extends State { case "product_carousel": if ((widget.allProducts ?? []).isNotEmpty && - productIndex < (widget.allProducts ?? []).length) { + productIndex < (widget.allProducts ?? []).length && (widget.allProducts?[productIndex]?.data ?? []).isNotEmpty) { homeWidgets.add(SizedBox( height: (MediaQuery.of(context).size.width / 1.5) + 220, child: NewProductView( diff --git a/lib/screens/home_page/widget/new_product_view.dart b/lib/screens/home_page/widget/new_product_view.dart index d245e9a..ab818c9 100644 --- a/lib/screens/home_page/widget/new_product_view.dart +++ b/lib/screens/home_page/widget/new_product_view.dart @@ -1,3 +1,4 @@ +import 'package:bagisto_app_demo/screens/account/view/account_screen.dart'; import 'package:bagisto_app_demo/utils/application_localization.dart'; import 'package:bagisto_app_demo/widgets/price_widget.dart'; import 'package:bagisto_app_demo/widgets/wishlist_compare_widget.dart'; @@ -234,17 +235,24 @@ class _NewProductViewState extends State { checkInternetConnection() .then((value) { if (value) { - homepageBloc?.add( - OnClickLoaderEvent( - isReqToShowLoader: true)); - homepageBloc?.add( - AddToCompareHomepageEvent( - widget.model?[index] - .id ?? - widget.model?[index].productId ?? "", - "", - ), - ); + if (widget.isLogin ?? false){ + homepageBloc?.add( + OnClickLoaderEvent( + isReqToShowLoader: true)); + homepageBloc?.add( + AddToCompareHomepageEvent( + widget.model?[index] + .id ?? + widget.model?[index].productId ?? "", + "", + ), + ); + } + else { + ShowMessage.warningNotification( + StringConstants.pleaseLogin.localized(), + context); + } } else { ShowMessage.errorNotification( StringConstants.internetIssue diff --git a/lib/screens/order_detail/widgets/order_detail_tile.dart b/lib/screens/order_detail/widgets/order_detail_tile.dart index 74e3e73..8dc869f 100644 --- a/lib/screens/order_detail/widgets/order_detail_tile.dart +++ b/lib/screens/order_detail/widgets/order_detail_tile.dart @@ -73,7 +73,7 @@ class OrderDetailTile extends StatelessWidget with OrderStatusBGColorHelper { StringConstants.orderWithHash.localized() + (orderDetailModel?.incrementId ?? ""), style: Theme.of(context).textTheme.headlineSmall), - orderDetailModel?.status == StringConstants.pending + orderDetailModel?.status?.toLowerCase() == StringConstants.pending.localized().toLowerCase() ? ElevatedButton( style: ButtonStyle( minimumSize: MaterialStateProperty.all( diff --git a/lib/screens/product_screen/view/product_screen.dart b/lib/screens/product_screen/view/product_screen.dart index a71e97a..558ba71 100644 --- a/lib/screens/product_screen/view/product_screen.dart +++ b/lib/screens/product_screen/view/product_screen.dart @@ -85,7 +85,9 @@ class _ProductScreenState extends State { centerTitle: false, automaticallyImplyLeading: false, leading: IconButton(onPressed: () { - setRecentViewed(); + if(productData != null){ + setRecentViewed(); + } Navigator.pop(context); }, icon:const Icon(Icons.arrow_back_ios)), diff --git a/lib/screens/recent_product/recent_product_view.dart b/lib/screens/recent_product/recent_product_view.dart index 572d4ee..2f9d32a 100644 --- a/lib/screens/recent_product/recent_product_view.dart +++ b/lib/screens/recent_product/recent_product_view.dart @@ -72,9 +72,8 @@ class _RecentViewState extends State { @override Widget build(BuildContext context) { return ((_recentProductList ?? []).isNotEmpty) - ? ConstrainedBox( - constraints: BoxConstraints( - maxHeight: (MediaQuery.of(context).size.width / 1.5) + 220), + ? SizedBox( + height: (MediaQuery.of(context).size.width / 1.5) + 220, child: NewProductView( title: StringConstants.recentProducts.localized(), isLogin: widget.isLogin, diff --git a/lib/screens/search_screen/view/widget/categories_view.dart b/lib/screens/search_screen/view/widget/categories_view.dart index f6eea43..54a1d30 100644 --- a/lib/screens/search_screen/view/widget/categories_view.dart +++ b/lib/screens/search_screen/view/widget/categories_view.dart @@ -41,6 +41,7 @@ class CategoriesView extends StatelessWidget { arguments: CategoriesArguments( metaDescription: data?[index].description, categorySlug: data?[index].slug ?? "", + id: data?[index].categoryId.toString(), title: data?[index].name, image: data?[index].imageUrl)); }, diff --git a/lib/screens/sign_in/sign_in_screen.dart b/lib/screens/sign_in/sign_in_screen.dart index 03ef8ee..ba21c26 100644 --- a/lib/screens/sign_in/sign_in_screen.dart +++ b/lib/screens/sign_in/sign_in_screen.dart @@ -32,9 +32,8 @@ class _SignInScreenState extends State with EmailValidator { SignInModel? _signInModel; final _signInFormKey = GlobalKey(); final bool _autoValidate = false; - final passwordController = TextEditingController( - text: "demo123"); - final emailController = TextEditingController(text:"demo12@webkul.com"); + final passwordController = TextEditingController(); + final emailController = TextEditingController(); String passwordValue = ""; String emailValue = ""; bool showPassword = false; @@ -99,6 +98,7 @@ class _SignInScreenState extends State with EmailValidator { _signInModel?.token ?? ""); await SharedPreferenceHelper.setCustomerId( int.parse(_signInModel?.data?.id ?? "")); + await SharedPreferenceHelper.setCustomerImage(_signInModel?.data?.imageUrl ?? ""); checkFingerprint(); Navigator.of(context).pushNamedAndRemoveUntil( home, (Route route) => false); diff --git a/lib/screens/sign_up/bloc/sign_up_state.dart b/lib/screens/sign_up/bloc/sign_up_state.dart index 2e1d397..ad32f89 100644 --- a/lib/screens/sign_up/bloc/sign_up_state.dart +++ b/lib/screens/sign_up/bloc/sign_up_state.dart @@ -11,7 +11,6 @@ import 'package:bagisto_app_demo/data_model/sign_in_model/signin_model.dart'; -import 'package:bagisto_app_demo/data_model/sign_up_model/sign_up_seller_model.dart'; abstract class SignUpBaseState{} @@ -36,23 +35,6 @@ class FetchSignUpState extends SignUpBaseState { FetchSignUpState.fail({this.error}) : status = SignUpStatus.fail; List get props => [if (signUpModel !=null) signUpModel! else ""]; } -class FetchSellerSignUpState extends SignUpBaseState { - - SignUpStatus? status; - String? error; - String? successMsg; - CreateSeller? signSellerUpModel; - - - FetchSellerSignUpState.success({this.signSellerUpModel,this.successMsg}) : status = SignUpStatus.success; - - FetchSellerSignUpState.fail({this.error}) : status = SignUpStatus.fail; - List get props => [if (signSellerUpModel !=null) signSellerUpModel! else ""]; -} - - - - class FetchSignInState extends SignUpBaseState { diff --git a/lib/screens/sign_up/utils/index.dart b/lib/screens/sign_up/utils/index.dart index 8ce6d93..23b755d 100644 --- a/lib/screens/sign_up/utils/index.dart +++ b/lib/screens/sign_up/utils/index.dart @@ -2,6 +2,5 @@ export 'package:bagisto_app_demo/data_model/sign_in_model/signin_model.dart'; export 'package:bagisto_app_demo/screens/sign_up/bloc/sign_up_event.dart'; export 'package:bagisto_app_demo/screens/sign_up/bloc/sign_up_repository.dart'; export 'package:bagisto_app_demo/screens/sign_up/bloc/sign_up_state.dart'; -export 'package:bagisto_app_demo/data_model/sign_up_model/sign_up_seller_model.dart'; export 'package:bagisto_app_demo/screens/sign_up/bloc/sign_up_bloc.dart'; export 'package:bagisto_app_demo/utils/index.dart'; diff --git a/lib/screens/wishList/view/widget/wishlist_Item_list.dart b/lib/screens/wishList/view/widget/wishlist_Item_list.dart index 593971f..38669b2 100644 --- a/lib/screens/wishList/view/widget/wishlist_Item_list.dart +++ b/lib/screens/wishList/view/widget/wishlist_Item_list.dart @@ -35,8 +35,9 @@ class WishlistItemList extends StatelessWidget { shrinkWrap: true, physics: const ScrollPhysics(), itemCount: model?.data?.length ?? 0, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - childAspectRatio: 0.5, crossAxisCount: 2), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + mainAxisExtent: (MediaQuery.of(context).size.height / 3) + 160, + crossAxisCount: 2), itemBuilder: (BuildContext context, int index) { return GestureDetector( onTap: () { @@ -51,7 +52,7 @@ class WishlistItemList extends StatelessWidget { elevation: 2, margin: const EdgeInsets.all(4), child: Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack(children: [ @@ -100,18 +101,7 @@ class WishlistItemList extends StatelessWidget { const SizedBox( height: 4, ), - PriceWidgetHtml(priceHtml: model?.data?[index].product?.priceHtml?.priceHtml ?? ""), - - // Padding( - // padding: const EdgeInsets.only( - // top: AppSizes.spacingSmall, left: 10, right: 10), - // child: Text( - // model?.data?[index].product?.priceHtml - // ?.formattedFinalPrice ?? - // "0", - // ), - // ), Padding( padding: const EdgeInsets.all(8), child: CommonWidgets().appButton( diff --git a/lib/services/api_client.dart b/lib/services/api_client.dart index 3e55ebf..a8faa37 100644 --- a/lib/services/api_client.dart +++ b/lib/services/api_client.dart @@ -122,7 +122,7 @@ class ApiClient { mutation.themeCustomizationData(), ), cacheRereadPolicy: CacheRereadPolicy.mergeOptimistic, - fetchPolicy: FetchPolicy.cacheAndNetwork)); + fetchPolicy: FetchPolicy.networkOnly)); return handleResponse( response, diff --git a/lib/services/mutation_query.dart b/lib/services/mutation_query.dart index 52d7166..5116f89 100644 --- a/lib/services/mutation_query.dart +++ b/lib/services/mutation_query.dart @@ -2068,6 +2068,7 @@ class MutationsData { gender dateOfBirth email + imageUrl phone password token diff --git a/lib/utils/server_configuration.dart b/lib/utils/server_configuration.dart index 540c087..7f014e9 100644 --- a/lib/utils/server_configuration.dart +++ b/lib/utils/server_configuration.dart @@ -3,12 +3,9 @@ // Application Specific Constants const int defaultSplashDelay = 3; -// local instance bagisto 2.0 -// const String baseUrl = "http://192.168.15.151/bagisto/public/graphql"; - // local instance bagisto 2.0 updated -const String baseUrl = "http://192.168.15.204/Bagisto2.0/Mobikul/headless_2.0/public/graphql"; +const String baseUrl = ""; const String defaultWebsiteId = "1"; @@ -19,7 +16,7 @@ const String defaultChannelId = "1"; const String defaultStoreCode = "en"; ///default store code -const String defaultChannelName = "com.webkul.bagisto_mobikul/channel"; +const String defaultChannelName = ""; ///default channel id const String defaultCurrencyCode = "";