diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 43024b7..c49ad18 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,3 +1,6 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") // START: FlutterFire Configuration @@ -8,8 +11,14 @@ plugins { id("dev.flutter.flutter-gradle-plugin") } +val keystoreProperties = Properties() +val keystorePropertiesFile = rootProject.file("key.properties") +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) +} + android { - namespace = "com.emart.customer" + namespace = "felix.fondex.uz" compileSdk = 36 ndkVersion = flutter.ndkVersion @@ -25,7 +34,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.emart.customer" + applicationId = "felix.fondex.uz" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = 26 @@ -34,11 +43,20 @@ android { versionName = flutter.versionName } + signingConfigs { + create("release") { + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + storeFile = keystoreProperties["storeFile"]?.let { file(it) } + storePassword = keystoreProperties["storePassword"] as String + } + } + buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.getByName("release") isMinifyEnabled = false isShrinkResources = false } diff --git a/android/app/google-services.json b/android/app/google-services.json index 4d10887..869b8c5 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:893074789710:android:05002c15a64cf1e0c4ba1f", "android_client_info": { - "package_name": "com.emart.customer" + "package_name": "felix.fondex.uz" } }, "oauth_client": [ @@ -35,7 +35,7 @@ "client_id": "893074789710-pv12m4nhe82a4ueg9sb2pgt42r0e5da3.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.emart.customer" + "bundle_id": "felix.fondex.uz" } } ] diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 305ac58..8e567a0 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ - + @@ -53,7 +53,7 @@ + android:scheme="felix.fondex.uz" /> @@ -102,7 +102,7 @@ + android:scheme="felix.fondex.uz" /> diff --git a/android/app/src/main/kotlin/com/emart/customer/MainActivity.kt b/android/app/src/main/kotlin/com/emart/customer/MainActivity.kt index 21c78d3..af32cc7 100644 --- a/android/app/src/main/kotlin/com/emart/customer/MainActivity.kt +++ b/android/app/src/main/kotlin/com/emart/customer/MainActivity.kt @@ -1,4 +1,4 @@ -package com.emart.customer +package felix.fondex.uz import io.flutter.embedding.android.FlutterFragmentActivity diff --git a/assets/translations/en_En.json b/assets/translations/en_En.json new file mode 100644 index 0000000..0bb5a6f --- /dev/null +++ b/assets/translations/en_En.json @@ -0,0 +1,50 @@ +{ + "loginToExplore" : "Log in to explore your all in one vendor app favourites and shop effortlessly.", + "emailAddress": "Email Address*", + "password": "Password*", + "enterPassword": "Enter password", + "forgotPassword": "Forgot Password", + "login": "Log in", + "orContinueWith": "or continue with", + + + "withGoogle": "with Google", + "withApple": "with Apple", + "dontHaveAccount": "Didn't have an account?", + "signUp": "Sign up", + "skip": "Skip", + "signUpToExplore": "Sign up to explore all our services and start shopping, riding, and more.", + "firstName": "First Name*", + "lastName": "Last Name*", + "enterMobileNumber": "Enter Mobile number", + "confirmPassword": "Confirm Password*", + "enterConfirmPassword": "Enter confirm password", + "referralCode": "Referral Code", + "enterReferralCode": "Enter referral code", + "alreadyHaveAccount":"Already have an account?", + "enterYourregisteredEmail": "Enter your registered email to receive a reset link.", + "sendLink": "Send Link", + "rememberPassword": "Remember Password?", + "enterOtpSent": "Enter the OTP sent to your mobile", + "resendOTP": "Resend OTP", + "verify": "Verify", + "useYourMobileNumber": "Use your mobile number to Log in easily and securely.", + "sendCode":"Send Code", + "forgotPassword": "Forgot Password", + "login": "Log in", + "emailAddress": "Email Address*", + "password": "Password*", + "enterPassword": "Enter password", + "forgotPassword": "Forgot Password", + "login": "Log in", + "emailAddress": "Email Address*", + "password": "Password*", + "enterPassword": "Enter password", + "forgotPassword": "Forgot Password", + "login": "Log in", + "emailAddress": "Email Address*", + "password": "Password*", + "enterPassword": "Enter password", + "forgotPassword": "Forgot Password", + "login": "Log in" +} \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 844309b..a4e69a6 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -504,7 +504,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uz; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -521,7 +521,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uz.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -539,7 +539,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uz.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -555,7 +555,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uzRunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -691,7 +691,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uz; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -716,7 +716,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.emart.customer; + PRODUCT_BUNDLE_IDENTIFIER = felix.fondex.uz; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist index 59544f2..9ddcbab 100644 --- a/ios/Runner/GoogleService-Info.plist +++ b/ios/Runner/GoogleService-Info.plist @@ -13,7 +13,7 @@ PLIST_VERSION 1 BUNDLE_ID - com.emart.customer + felix.fondex.uz PROJECT_ID fondexuzb STORAGE_BUCKET diff --git a/lib/constant/const_texts.dart b/lib/constant/const_texts.dart new file mode 100644 index 0000000..13a93fb --- /dev/null +++ b/lib/constant/const_texts.dart @@ -0,0 +1,39 @@ +class ConstTexts { + static String loginToExplore = "logintoExplore"; + static String emailAddress = "emailAddress"; + static String password = "password"; + static String enterPassword = "enterPassword"; + static String forgotPassword = "forgotPassword"; + static String login = "login"; + static String orContinueWith = "orContinueWith"; + static String mobileNumber = "mobileNumber"; + static String withGoogle = "withGoogle"; + static String withApple = "withApple"; + static String dontHaveAccount = "dontHaveAccount"; + static String signUp = "signUp"; + static String skip = "skip"; + static String signUpToExplore = "signUpToExplore"; + static String firstName = "firstName"; + static String lastName = "lastName"; + static String enterMobileNumber = "enterMobileNumber"; + static String confirmPassword = "confirmPassword"; + static String enterConfirmPassword = "enterConfirmPassword"; + static String referralCode = "referralCode"; + static String enterReferralCode = "enterReferralCode"; + static String alreadyHaveAccount = "alreadyHaveAccount"; + static String enterYourregisteredEmail = "enterYourregisteredEmail"; + static String sendLink = "sendLink"; + static String rememberPassword = "rememberPassword"; + static String enterOtpSent = "enterOtpSent"; + static String resendOTP = "resendOTP"; + static String verify = "verify"; + static String useYourMobileNumber = "useYourMobileNumber"; + static String sendCode = "sendCode"; + static String loginToExplore = "logintoExplore"; + static String emailAddress = "emailAddress"; + static String password = "password"; + static String loginToExplore = "logintoExplore"; + static String emailAddress = "emailAddress"; + static String password = "password"; + +} diff --git a/lib/controllers/parcel_order_confirmation_controller.dart b/lib/controllers/parcel_order_confirmation_controller.dart index 7c61e0b..a8d1506 100644 --- a/lib/controllers/parcel_order_confirmation_controller.dart +++ b/lib/controllers/parcel_order_confirmation_controller.dart @@ -96,11 +96,19 @@ class ParcelOrderConfirmationController extends GetxController { subTotal.value = double.tryParse(parcelOrder.value.subTotal ?? '0') ?? 0.0; if (selectedCouponModel.value.id != null) { - discount.value = Constant.calculateDiscount(amount: subTotal.value.toString(), offerModel: selectedCouponModel.value); + discount.value = Constant.calculateDiscount( + amount: subTotal.value.toString(), + offerModel: selectedCouponModel.value, + ); } for (var element in Constant.taxList) { - taxAmount.value = (taxAmount.value + Constant.calculateTax(amount: (subTotal.value - discount.value).toString(), taxModel: element)); + taxAmount.value = + (taxAmount.value + + Constant.calculateTax( + amount: (subTotal.value - discount.value).toString(), + taxModel: element, + )); } print("Tax: ${taxAmount.value}"); @@ -133,25 +141,40 @@ class ParcelOrderConfirmationController extends GetxController { List parcelImages = []; if (images.isNotEmpty) { for (var image in images) { - final upload = await FireStoreUtils.uploadChatImageToFireStorage(File(image.path), Get.context!); + final upload = await FireStoreUtils.uploadChatImageToFireStorage( + File(image.path), + Get.context!, + ); parcelImages.add(upload.url); } } parcelOrder.value.parcelImages = parcelImages; parcelOrder.value.discount = discount.value.toString(); - parcelOrder.value.discountType = selectedCouponModel.value.discountType.toString(); - parcelOrder.value.discountLabel = selectedCouponModel.value.code.toString(); - parcelOrder.value.adminCommission = Constant.sectionConstantModel?.adminCommision?.amount?.toString(); - parcelOrder.value.adminCommissionType = Constant.sectionConstantModel?.adminCommision?.commissionType; + parcelOrder.value.discountType = + selectedCouponModel.value.discountType.toString(); + parcelOrder.value.discountLabel = + selectedCouponModel.value.code.toString(); + parcelOrder.value.adminCommission = + Constant.sectionConstantModel?.adminCommision?.amount?.toString(); + parcelOrder.value.adminCommissionType = + Constant.sectionConstantModel?.adminCommision?.commissionType; parcelOrder.value.status = Constant.orderPlaced; parcelOrder.value.createdAt = Timestamp.now(); parcelOrder.value.author = userModel.value; parcelOrder.value.authorID = FireStoreUtils.getCurrentUid(); - parcelOrder.value.paymentMethod = paymentBy.value == "Receiver" ? "cod" : selectedPaymentMethod.value; - parcelOrder.value.paymentCollectByReceiver = paymentBy.value == "Receiver"; - parcelOrder.value.senderZoneId = Constant.getZoneId(parcelOrder.value.senderLatLong!.latitude ?? 0.0, parcelOrder.value.senderLatLong!.longitude ?? 0.0); - parcelOrder.value.receiverZoneId = Constant.getZoneId(parcelOrder.value.receiverLatLong!.latitude ?? 0.0, parcelOrder.value.receiverLatLong!.longitude ?? 0.0); + parcelOrder.value.paymentMethod = + paymentBy.value == "Receiver" ? "cod" : selectedPaymentMethod.value; + parcelOrder.value.paymentCollectByReceiver = + paymentBy.value == "Receiver"; + parcelOrder.value.senderZoneId = Constant.getZoneId( + parcelOrder.value.senderLatLong!.latitude ?? 0.0, + parcelOrder.value.senderLatLong!.longitude ?? 0.0, + ); + parcelOrder.value.receiverZoneId = Constant.getZoneId( + parcelOrder.value.receiverLatLong!.latitude ?? 0.0, + parcelOrder.value.receiverLatLong!.longitude ?? 0.0, + ); if (selectedPaymentMethod.value == PaymentGateway.wallet.name) { WalletTransactionModel transactionModel = WalletTransactionModel( @@ -168,16 +191,26 @@ class ParcelOrderConfirmationController extends GetxController { serviceType: Constant.parcelServiceType, ); - await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async { + await FireStoreUtils.setWalletTransaction(transactionModel).then(( + value, + ) async { if (value == true) { - await FireStoreUtils.updateUserWallet(amount: "-${totalAmount.value.toString()}", userId: FireStoreUtils.getCurrentUid()); + await FireStoreUtils.updateUserWallet( + amount: "-${totalAmount.value.toString()}", + userId: FireStoreUtils.getCurrentUid(), + ); } }); } - await FireStoreUtils.parcelOrderPlace(parcelOrder.value).then((value) async { + await FireStoreUtils.parcelOrderPlace(parcelOrder.value).then(( + value, + ) async { ShowToastDialog.closeLoader(); ShowToastDialog.showToast("Order placed successfully".tr); - Get.offAll(() => OrderSuccessfullyPlaced(), arguments: {'parcelOrder': parcelOrder.value}); + Get.offAll( + () => OrderSuccessfullyPlaced(), + arguments: {'parcelOrder': parcelOrder.value}, + ); await FireStoreUtils.sendParcelBookEmail(orderModel: parcelOrder.value); }); } catch (e) { @@ -203,19 +236,45 @@ class ParcelOrderConfirmationController extends GetxController { Future getPaymentSettings() async { await FireStoreUtils.getPaymentSettingsData().then((value) { - stripeModel.value = StripeModel.fromJson(jsonDecode(Preferences.getString(Preferences.stripeSettings))); - payPalModel.value = PayPalModel.fromJson(jsonDecode(Preferences.getString(Preferences.paypalSettings))); - payStackModel.value = PayStackModel.fromJson(jsonDecode(Preferences.getString(Preferences.payStack))); - mercadoPagoModel.value = MercadoPagoModel.fromJson(jsonDecode(Preferences.getString(Preferences.mercadoPago))); - flutterWaveModel.value = FlutterWaveModel.fromJson(jsonDecode(Preferences.getString(Preferences.flutterWave))); - paytmModel.value = PaytmModel.fromJson(jsonDecode(Preferences.getString(Preferences.paytmSettings))); - payFastModel.value = PayFastModel.fromJson(jsonDecode(Preferences.getString(Preferences.payFastSettings))); - razorPayModel.value = RazorPayModel.fromJson(jsonDecode(Preferences.getString(Preferences.razorpaySettings))); - midTransModel.value = MidTrans.fromJson(jsonDecode(Preferences.getString(Preferences.midTransSettings))); - orangeMoneyModel.value = OrangeMoney.fromJson(jsonDecode(Preferences.getString(Preferences.orangeMoneySettings))); - xenditModel.value = Xendit.fromJson(jsonDecode(Preferences.getString(Preferences.xenditSettings))); - walletSettingModel.value = WalletSettingModel.fromJson(jsonDecode(Preferences.getString(Preferences.walletSettings))); - cashOnDeliverySettingModel.value = CodSettingModel.fromJson(jsonDecode(Preferences.getString(Preferences.codSettings))); + stripeModel.value = StripeModel.fromJson( + jsonDecode(Preferences.getString(Preferences.stripeSettings)), + ); + payPalModel.value = PayPalModel.fromJson( + jsonDecode(Preferences.getString(Preferences.paypalSettings)), + ); + payStackModel.value = PayStackModel.fromJson( + jsonDecode(Preferences.getString(Preferences.payStack)), + ); + mercadoPagoModel.value = MercadoPagoModel.fromJson( + jsonDecode(Preferences.getString(Preferences.mercadoPago)), + ); + flutterWaveModel.value = FlutterWaveModel.fromJson( + jsonDecode(Preferences.getString(Preferences.flutterWave)), + ); + paytmModel.value = PaytmModel.fromJson( + jsonDecode(Preferences.getString(Preferences.paytmSettings)), + ); + payFastModel.value = PayFastModel.fromJson( + jsonDecode(Preferences.getString(Preferences.payFastSettings)), + ); + razorPayModel.value = RazorPayModel.fromJson( + jsonDecode(Preferences.getString(Preferences.razorpaySettings)), + ); + midTransModel.value = MidTrans.fromJson( + jsonDecode(Preferences.getString(Preferences.midTransSettings)), + ); + orangeMoneyModel.value = OrangeMoney.fromJson( + jsonDecode(Preferences.getString(Preferences.orangeMoneySettings)), + ); + xenditModel.value = Xendit.fromJson( + jsonDecode(Preferences.getString(Preferences.xenditSettings)), + ); + walletSettingModel.value = WalletSettingModel.fromJson( + jsonDecode(Preferences.getString(Preferences.walletSettings)), + ); + cashOnDeliverySettingModel.value = CodSettingModel.fromJson( + jsonDecode(Preferences.getString(Preferences.codSettings)), + ); if (walletSettingModel.value.isEnabled == true) { selectedPaymentMethod.value = PaymentGateway.wallet.name; @@ -257,20 +316,32 @@ class ParcelOrderConfirmationController extends GetxController { Future stripeMakePayment({required String amount}) async { log(double.parse(amount).toStringAsFixed(0)); try { - Map? paymentIntentData = await createStripeIntent(amount: amount); + Map? paymentIntentData = await createStripeIntent( + amount: amount, + ); log("stripe Responce====>$paymentIntentData"); if (paymentIntentData!.containsKey("error")) { Get.back(); - ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "Something went wrong, please contact admin.".tr, + ); } else { await Stripe.instance.initPaymentSheet( paymentSheetParameters: SetupPaymentSheetParameters( paymentIntentClientSecret: paymentIntentData['client_secret'], allowsDelayedPaymentMethods: false, - googlePay: const PaymentSheetGooglePay(merchantCountryCode: 'US', testEnv: true, currencyCode: "USD"), + googlePay: const PaymentSheetGooglePay( + merchantCountryCode: 'US', + testEnv: true, + currencyCode: "USD", + ), customFlow: true, style: ThemeMode.system, - appearance: PaymentSheetAppearance(colors: PaymentSheetAppearanceColors(primary: AppThemeData.primary300)), + appearance: PaymentSheetAppearance( + colors: PaymentSheetAppearanceColors( + primary: AppThemeData.primary300, + ), + ), merchantDisplayName: 'GoRide', ), ); @@ -316,7 +387,10 @@ class ParcelOrderConfirmationController extends GetxController { var response = await http.post( Uri.parse('https://api.stripe.com/v1/payment_intents'), body: body, - headers: {'Authorization': 'Bearer $stripeSecret', 'Content-Type': 'application/x-www-form-urlencoded'}, + headers: { + 'Authorization': 'Bearer $stripeSecret', + 'Content-Type': 'application/x-www-form-urlencoded', + }, ); return jsonDecode(response.body); @@ -326,8 +400,14 @@ class ParcelOrderConfirmationController extends GetxController { } //mercadoo - Future mercadoPagoMakePayment({required BuildContext context, required String amount}) async { - final headers = {'Authorization': 'Bearer ${mercadoPagoModel.value.accessToken}', 'Content-Type': 'application/json'}; + Future mercadoPagoMakePayment({ + required BuildContext context, + required String amount, + }) async { + final headers = { + 'Authorization': 'Bearer ${mercadoPagoModel.value.accessToken}', + 'Content-Type': 'application/json', + }; final body = jsonEncode({ "items": [ @@ -340,12 +420,20 @@ class ParcelOrderConfirmationController extends GetxController { }, ], "payer": {"email": Constant.userModel?.email}, - "back_urls": {"failure": "${Constant.globalUrl}payment/failure", "pending": "${Constant.globalUrl}payment/pending", "success": "${Constant.globalUrl}payment/success"}, + "back_urls": { + "failure": "${Constant.globalUrl}payment/failure", + "pending": "${Constant.globalUrl}payment/pending", + "success": "${Constant.globalUrl}payment/success", + }, "auto_return": "approved", // Automatically return after payment is approved }); - final response = await http.post(Uri.parse("https://api.mercadopago.com/checkout/preferences"), headers: headers, body: body); + final response = await http.post( + Uri.parse("https://api.mercadopago.com/checkout/preferences"), + headers: headers, + body: body, + ); if (response.statusCode == 200 || response.statusCode == 201) { final data = jsonDecode(response.body); @@ -375,8 +463,8 @@ class ParcelOrderConfirmationController extends GetxController { sandboxMode: payPalModel.value.isLive == true ? false : true, clientId: payPalModel.value.paypalClient ?? '', secretKey: payPalModel.value.paypalSecret ?? '', - returnURL: "com.emart.customer://paypalpay", - cancelURL: "com.emart.customer://paypalcancel", + returnURL: "felix.fondex.uz://paypalpay", + cancelURL: "felix.fondex.uz://paypalcancel", transactions: [ { @@ -418,8 +506,8 @@ class ParcelOrderConfirmationController extends GetxController { // secretKey: payPalModel.value.paypalSecret ?? '', // returnURL: "https://success.emart.com/return", // cancelURL: "https://cancel.emart.com/cancel", - // // returnURL: "com.emart.customer://paypalpay", - // // cancelURL: "com.emart.customer://paypalpay", + // // returnURL: "felix.fondex.uz://paypalpay", + // // cancelURL: "felix.fondex.uz://paypalpay", // transactions: [ // { // "amount": { @@ -477,17 +565,25 @@ class ParcelOrderConfirmationController extends GetxController { } }); } else { - ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "Something went wrong, please contact admin.".tr, + ); } }); } ///flutter wave Payment Method - Future flutterWaveInitiatePayment({required BuildContext context, required String amount}) async { + Future flutterWaveInitiatePayment({ + required BuildContext context, + required String amount, + }) async { setRef(); // make sure you generate reference final url = Uri.parse('https://api.flutterwave.com/v3/payments'); - final headers = {'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', 'Content-Type': 'application/json'}; + final headers = { + 'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', + 'Content-Type': 'application/json', + }; final body = jsonEncode({ "tx_ref": _ref, @@ -495,8 +591,15 @@ class ParcelOrderConfirmationController extends GetxController { "currency": "NGN", "redirect_url": "${Constant.globalUrl}payment/success", "payment_options": "ussd, card, barter, payattitude", - "customer": {"email": Constant.userModel?.email.toString(), "phonenumber": Constant.userModel?.phoneNumber, "name": Constant.userModel?.fullName()}, - "customizations": {"title": "Payment for Services", "description": "Payment for XYZ services"}, + "customer": { + "email": Constant.userModel?.email.toString(), + "phonenumber": Constant.userModel?.phoneNumber, + "name": Constant.userModel?.fullName(), + }, + "customizations": { + "title": "Payment for Services", + "description": "Payment for XYZ services", + }, }); final response = await http.post(url, headers: headers, body: body); @@ -504,7 +607,9 @@ class ParcelOrderConfirmationController extends GetxController { if (response.statusCode == 200) { final data = jsonDecode(response.body); - Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then((value) async { + Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then(( + value, + ) async { bool isVerified = await verifyFlutterWavePayment(_ref!); if (isVerified) { @@ -522,13 +627,19 @@ class ParcelOrderConfirmationController extends GetxController { Future verifyFlutterWavePayment(String txRef) async { try { - final url = Uri.parse("https://api.flutterwave.com/v3/transactions/verify_by_reference?tx_ref=$txRef"); - final headers = {'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', 'Content-Type': 'application/json'}; + final url = Uri.parse( + "https://api.flutterwave.com/v3/transactions/verify_by_reference?tx_ref=$txRef", + ); + final headers = { + 'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', + 'Content-Type': 'application/json', + }; final response = await http.get(url, headers: headers); if (response.statusCode == 200) { final data = jsonDecode(response.body); - if (data['status'] == 'success' && data['data']['status'] == 'successful') { + if (data['status'] == 'success' && + data['data']['status'] == 'successful') { return true; // ✅ Payment confirmed } } @@ -554,8 +665,14 @@ class ParcelOrderConfirmationController extends GetxController { // payFast void payFastPayment({required BuildContext context, required String amount}) { - PayStackURLGen.getPayHTML(payFastSettingData: payFastModel.value, amount: amount.toString(), userModel: Constant.userModel!).then((String? value) async { - bool isDone = await Get.to(PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value)); + PayStackURLGen.getPayHTML( + payFastSettingData: payFastModel.value, + amount: amount.toString(), + userModel: Constant.userModel!, + ).then((String? value) async { + bool isDone = await Get.to( + PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value), + ); if (isDone) { Get.back(); ShowToastDialog.showToast("Payment successfully".tr); @@ -576,26 +693,50 @@ class ParcelOrderConfirmationController extends GetxController { final response = await http.post( Uri.parse(getChecksum), headers: {}, - body: {"mid": paytmModel.value.paytmMID.toString(), "order_id": orderId, "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString()}, + body: { + "mid": paytmModel.value.paytmMID.toString(), + "order_id": orderId, + "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(), + }, ); final data = jsonDecode(response.body); - await verifyCheckSum(checkSum: data["code"], amount: amount, orderId: orderId).then((value) { + await verifyCheckSum( + checkSum: data["code"], + amount: amount, + orderId: orderId, + ).then((value) { initiatePayment(amount: amount, orderId: orderId).then((value) { String callback = ""; if (paytmModel.value.isSandboxEnabled == true) { - callback = "${callback}https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; + callback = + "${callback}https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; } else { - callback = "${callback}https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; + callback = + "${callback}https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; } GetPaymentTxtTokenModel result = value; - startTransaction(context, txnTokenBy: result.body.txnToken ?? '', orderId: orderId, amount: amount, callBackURL: callback, isStaging: paytmModel.value.isSandboxEnabled); + startTransaction( + context, + txnTokenBy: result.body.txnToken ?? '', + orderId: orderId, + amount: amount, + callBackURL: callback, + isStaging: paytmModel.value.isSandboxEnabled, + ); }); }); } - Future startTransaction(context, {required String txnTokenBy, required orderId, required double amount, required callBackURL, required isStaging}) async { + Future startTransaction( + context, { + required String txnTokenBy, + required orderId, + required double amount, + required callBackURL, + required isStaging, + }) async { // try { // var response = AllInOneSdk.startTransaction( // paytmModel.value.paytmMID.toString(), @@ -631,28 +772,44 @@ class ParcelOrderConfirmationController extends GetxController { // } } - Future verifyCheckSum({required String checkSum, required double amount, required orderId}) async { + Future verifyCheckSum({ + required String checkSum, + required double amount, + required orderId, + }) async { String getChecksum = "${Constant.globalUrl}payments/validatechecksum"; final response = await http.post( Uri.parse(getChecksum), headers: {}, - body: {"mid": paytmModel.value.paytmMID.toString(), "order_id": orderId, "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(), "checksum_value": checkSum}, + body: { + "mid": paytmModel.value.paytmMID.toString(), + "order_id": orderId, + "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(), + "checksum_value": checkSum, + }, ); final data = jsonDecode(response.body); return data['status']; } - Future initiatePayment({required double amount, required String orderId}) async { + Future initiatePayment({ + required double amount, + required String orderId, + }) async { String initiateURL = "${Constant.globalUrl}payments/initiatepaytmpayment"; String callback = - (paytmModel.value.isSandboxEnabled ?? false) ? "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId" : "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; + (paytmModel.value.isSandboxEnabled ?? false) + ? "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId" + : "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"; print("INITIATE PAYMENT CALL:"); print("MID: ${paytmModel.value.paytmMID}"); print("OrderId: $orderId"); print("Amount: $amount"); - print("Env: ${(paytmModel.value.isSandboxEnabled ?? false) ? "STAGING" : "LIVE"}"); + print( + "Env: ${(paytmModel.value.isSandboxEnabled ?? false) ? "STAGING" : "LIVE"}", + ); final response = await http.post( Uri.parse(initiateURL), @@ -671,9 +828,12 @@ class ParcelOrderConfirmationController extends GetxController { log("Paytm Initiate Response: ${response.body}"); final data = jsonDecode(response.body); - if (data["body"]["txnToken"] == null || data["body"]["txnToken"].toString().isEmpty) { + if (data["body"]["txnToken"] == null || + data["body"]["txnToken"].toString().isEmpty) { Get.back(); - ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "Something went wrong, please contact admin.".tr, + ); } return GetPaymentTxtTokenModel.fromJson(data); @@ -723,7 +883,10 @@ class ParcelOrderConfirmationController extends GetxController { 'description': 'wallet Topup', 'retry': {'enabled': true, 'max_count': 1}, 'send_sms_hash': true, - 'prefill': {'contact': Constant.userModel?.phoneNumber, 'email': Constant.userModel?.email}, + 'prefill': { + 'contact': Constant.userModel?.phoneNumber, + 'email': Constant.userModel?.email, + }, 'external': { 'wallets': ['paytm'], }, @@ -758,7 +921,10 @@ class ParcelOrderConfirmationController extends GetxController { } //Midtrans payment - Future midtransMakePayment({required String amount, required BuildContext context}) async { + Future midtransMakePayment({ + required String amount, + required BuildContext context, + }) async { await createPaymentLink(amount: amount).then((url) { ShowToastDialog.closeLoader(); if (url != '') { @@ -776,15 +942,30 @@ class ParcelOrderConfirmationController extends GetxController { Future createPaymentLink({required var amount}) async { var ordersId = const Uuid().v1(); - final url = Uri.parse(midTransModel.value.isSandbox! ? 'https://api.sandbox.midtrans.com/v1/payment-links' : 'https://api.midtrans.com/v1/payment-links'); + final url = Uri.parse( + midTransModel.value.isSandbox! + ? 'https://api.sandbox.midtrans.com/v1/payment-links' + : 'https://api.midtrans.com/v1/payment-links', + ); final response = await http.post( url, - headers: {'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': generateBasicAuthHeader(midTransModel.value.serverKey!)}, + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': generateBasicAuthHeader( + midTransModel.value.serverKey!, + ), + }, body: jsonEncode({ - 'transaction_details': {'order_id': ordersId, 'gross_amount': double.parse(amount.toString()).toInt()}, + 'transaction_details': { + 'order_id': ordersId, + 'gross_amount': double.parse(amount.toString()).toInt(), + }, 'usage_limit': 2, - "callbacks": {"finish": "https://www.google.com?merchant_order_id=$ordersId"}, + "callbacks": { + "finish": "https://www.google.com?merchant_order_id=$ordersId", + }, }), ); @@ -792,7 +973,9 @@ class ParcelOrderConfirmationController extends GetxController { final responseData = jsonDecode(response.body); return responseData['payment_url']; } else { - ShowToastDialog.showToast("something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "something went wrong, please contact admin.".tr, + ); return ''; } } @@ -809,7 +992,10 @@ class ParcelOrderConfirmationController extends GetxController { static String orderId = ''; static String amount = ''; - Future orangeMakePayment({required String amount, required BuildContext context}) async { + Future orangeMakePayment({ + required String amount, + required BuildContext context, + }) async { reset(); var id = const Uuid().v4(); debugPrint('🟩 Starting OrangePay Payment...'); @@ -817,14 +1003,28 @@ class ParcelOrderConfirmationController extends GetxController { ShowToastDialog.showLoader("Initializing payment...".tr); - var paymentURL = await fetchToken(context: context, orderId: id, amount: amount, currency: 'USD'); + var paymentURL = await fetchToken( + context: context, + orderId: id, + amount: amount, + currency: 'USD', + ); ShowToastDialog.closeLoader(); if (paymentURL.toString().isNotEmpty) { debugPrint('✅ Payment URL fetched successfully: $paymentURL'); - Get.to(() => OrangeMoneyScreen(initialURl: paymentURL, accessToken: accessToken, amount: amount, orangePay: orangeMoneyModel.value, orderId: orderId, payToken: payToken))?.then((value) async { + Get.to( + () => OrangeMoneyScreen( + initialURl: paymentURL, + accessToken: accessToken, + amount: amount, + orangePay: orangeMoneyModel.value, + orderId: orderId, + payToken: payToken, + ), + )?.then((value) async { if (value == true) { ShowToastDialog.showToast("Payment Successful!!".tr); debugPrint('🎉 Payment Successful for Order ID: $orderId'); @@ -844,16 +1044,27 @@ class ParcelOrderConfirmationController extends GetxController { } } - Future fetchToken({required String orderId, required String currency, required BuildContext context, required String amount}) async { + Future fetchToken({ + required String orderId, + required String currency, + required BuildContext context, + required String amount, + }) async { const String apiUrl = 'https://api.orange.com/oauth/v3/token'; - final Map requestBody = {'grant_type': 'client_credentials'}; + final Map requestBody = { + 'grant_type': 'client_credentials', + }; debugPrint('🔐 Fetching access token from Orange API...'); debugPrint('📡 POST $apiUrl'); final response = await http.post( Uri.parse(apiUrl), - headers: {'Authorization': "Basic ${orangeMoneyModel.value.auth!}", 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json'}, + headers: { + 'Authorization': "Basic ${orangeMoneyModel.value.auth!}", + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': 'application/json', + }, body: requestBody, ); @@ -865,19 +1076,34 @@ class ParcelOrderConfirmationController extends GetxController { accessToken = responseData['access_token']; debugPrint('✅ Access Token Received: $accessToken'); - return await webpayment(context: context, amountData: amount, currency: currency, orderIdData: orderId); + return await webpayment( + context: context, + amountData: amount, + currency: currency, + orderIdData: orderId, + ); } else { debugPrint('❌ Failed to fetch access token.'); - ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "Something went wrong, please contact admin.".tr, + ); return ''; } } - Future webpayment({required String orderIdData, required BuildContext context, required String currency, required String amountData}) async { + Future webpayment({ + required String orderIdData, + required BuildContext context, + required String currency, + required String amountData, + }) async { orderId = orderIdData; amount = amountData; - String apiUrl = orangeMoneyModel.value.isSandbox == true ? 'https://api.orange.com/orange-money-webpay/dev/v1/webpayment' : 'https://api.orange.com/orange-money-webpay/cm/v1/webpayment'; + String apiUrl = + orangeMoneyModel.value.isSandbox == true + ? 'https://api.orange.com/orange-money-webpay/dev/v1/webpayment' + : 'https://api.orange.com/orange-money-webpay/cm/v1/webpayment'; // ✅ Ensure amount formatted correctly String formattedAmount = double.parse(amountData).toStringAsFixed(2); @@ -900,7 +1126,11 @@ class ParcelOrderConfirmationController extends GetxController { final response = await http.post( Uri.parse(apiUrl), - headers: {'Authorization': 'Bearer $accessToken', 'Content-Type': 'application/json', 'Accept': 'application/json'}, + headers: { + 'Authorization': 'Bearer $accessToken', + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, body: json.encode(requestBody), ); @@ -920,7 +1150,9 @@ class ParcelOrderConfirmationController extends GetxController { } } else { debugPrint('❌ Payment request failed.'); - ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); + ShowToastDialog.showToast( + "Something went wrong, please contact admin.".tr, + ); return ''; } } @@ -938,7 +1170,13 @@ class ParcelOrderConfirmationController extends GetxController { await createXenditInvoice(amount: amount).then((model) { ShowToastDialog.closeLoader(); if (model.id != null) { - Get.to(() => XenditScreen(initialURl: model.invoiceUrl ?? '', transId: model.id ?? '', apiKey: xenditModel.value.apiKey!.toString()))!.then((value) { + Get.to( + () => XenditScreen( + initialURl: model.invoiceUrl ?? '', + transId: model.id ?? '', + apiKey: xenditModel.value.apiKey!.toString(), + ), + )!.then((value) { if (value == true) { ShowToastDialog.showToast("Payment Successful!!".tr); placeOrder(); @@ -955,7 +1193,9 @@ class ParcelOrderConfirmationController extends GetxController { const url = 'https://api.xendit.co/v2/invoices'; var headers = { 'Content-Type': 'application/json', - 'Authorization': generateBasicAuthHeader(xenditModel.value.apiKey!.toString()), + 'Authorization': generateBasicAuthHeader( + xenditModel.value.apiKey!.toString(), + ), // 'Cookie': '__cf_bm=yERkrx3xDITyFGiou0bbKY1bi7xEwovHNwxV1vCNbVc-1724155511-1.0.1.1-jekyYQmPCwY6vIJ524K0V6_CEw6O.dAwOmQnHtwmaXO_MfTrdnmZMka0KZvjukQgXu5B.K_6FJm47SGOPeWviQ', }; @@ -968,7 +1208,11 @@ class ParcelOrderConfirmationController extends GetxController { }); try { - final response = await http.post(Uri.parse(url), headers: headers, body: body); + final response = await http.post( + Uri.parse(url), + headers: headers, + body: body, + ); if (response.statusCode == 200 || response.statusCode == 201) { XenditModel model = XenditModel.fromJson(jsonDecode(response.body)); diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index f77a606..4df3f6e 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -1,7 +1,8 @@ // File generated by FlutterFire CLI. // ignore_for_file: type=lint import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; -import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// @@ -18,7 +19,7 @@ class DefaultFirebaseOptions { if (kIsWeb) { throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for web - ' - 'you can reconfigure this by running the FlutterFire CLI again.', + 'you can reconfigure this by running the FlutterFire CLI again.', ); } switch (defaultTargetPlatform) { @@ -29,17 +30,17 @@ class DefaultFirebaseOptions { case TargetPlatform.macOS: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for macos - ' - 'you can reconfigure this by running the FlutterFire CLI again.', + 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.windows: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for windows - ' - 'you can reconfigure this by running the FlutterFire CLI again.', + 'you can reconfigure this by running the FlutterFire CLI again.', ); case TargetPlatform.linux: throw UnsupportedError( 'DefaultFirebaseOptions have not been configured for linux - ' - 'you can reconfigure this by running the FlutterFire CLI again.', + 'you can reconfigure this by running the FlutterFire CLI again.', ); default: throw UnsupportedError( @@ -64,8 +65,8 @@ class DefaultFirebaseOptions { projectId: 'fondexuzb', databaseURL: 'https://fondexuzb-default-rtdb.firebaseio.com', storageBucket: 'fondexuzb.firebasestorage.app', - iosClientId: '893074789710-pv12m4nhe82a4ueg9sb2pgt42r0e5da3.apps.googleusercontent.com', - iosBundleId: 'com.emart.customer', + iosClientId: + '893074789710-pv12m4nhe82a4ueg9sb2pgt42r0e5da3.apps.googleusercontent.com', + iosBundleId: 'felix.fondex.uz', ); - -} \ No newline at end of file +} diff --git a/lib/screen_ui/auth_screens/forgot_password_screen.dart b/lib/screen_ui/auth_screens/forgot_password_screen.dart index aaa3e0d..894fed1 100644 --- a/lib/screen_ui/auth_screens/forgot_password_screen.dart +++ b/lib/screen_ui/auth_screens/forgot_password_screen.dart @@ -1,3 +1,5 @@ +import 'package:customer/constant/const_texts.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -36,7 +38,7 @@ class ForgotPasswordScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - "Skip".tr, + ConstTexts.skip.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -72,8 +74,7 @@ class ForgotPasswordScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Enter your registered email to receive a reset link." - .tr, + ConstTexts.enterYourregisteredEmail.tr(), style: AppThemeData.boldTextStyle( fontSize: 24, color: @@ -84,14 +85,14 @@ class ForgotPasswordScreen extends StatelessWidget { ), const SizedBox(height: 24), TextFieldWidget( - title: "Email Address*".tr, - hintText: "jerome014@gmail.com", + title: ConstTexts.emailAddress.tr(), + hintText: "abdusalom@gmail.com", controller: controller.emailEditingController.value, ), const SizedBox(height: 30), RoundedButtonFill( borderRadius: 10.r, - title: "Send Link".tr, + title: ConstTexts.sendLink.tr(), onPress: controller.forgotPassword, color: isDark @@ -111,7 +112,7 @@ class ForgotPasswordScreen extends StatelessWidget { child: Center( child: Text.rich( TextSpan( - text: "Remember Password?".tr, + text: ConstTexts.rememberPassword.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -120,7 +121,7 @@ class ForgotPasswordScreen extends StatelessWidget { ), children: [ TextSpan( - text: "Log in".tr, + text: ConstTexts.login.tr(), style: AppThemeData.mediumTextStyle( color: AppThemeData.ecommerce300, decoration: TextDecoration.underline, diff --git a/lib/screen_ui/auth_screens/login_screen.dart b/lib/screen_ui/auth_screens/login_screen.dart index cd5c7fe..24e3116 100644 --- a/lib/screen_ui/auth_screens/login_screen.dart +++ b/lib/screen_ui/auth_screens/login_screen.dart @@ -1,7 +1,9 @@ import 'dart:io'; +import 'package:customer/constant/const_texts.dart'; import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart'; import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -36,7 +38,7 @@ class LoginScreen extends StatelessWidget { child: Row( children: [ Text( - "Skip".tr, + ConstTexts.skip.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -70,8 +72,8 @@ class LoginScreen extends StatelessWidget { children: [ const SizedBox(height: 20), Text( - "Log in to explore your all in one vendor app favourites and shop effortlessly." - .tr, + ConstTexts.loginToExplore.tr() + , style: AppThemeData.boldTextStyle( fontSize: 24, color: @@ -82,15 +84,15 @@ class LoginScreen extends StatelessWidget { ), const SizedBox(height: 24), TextFieldWidget( - title: "Email Address*".tr, - hintText: "jerome014@gmail.com", + title: ConstTexts.emailAddress.tr(), + hintText: "abdusalom@gmail.com", controller: controller.emailController.value, focusNode: controller.emailFocusNode, ), const SizedBox(height: 15), TextFieldWidget( - title: "Password*".tr, - hintText: "Enter password".tr, + title: ConstTexts.password.tr(), + hintText: ConstTexts.enterPassword.tr(), controller: controller.passwordController.value, obscureText: controller.passwordVisible.value, focusNode: controller.passwordFocusNode, @@ -132,7 +134,7 @@ class LoginScreen extends StatelessWidget { () => const ForgotPasswordScreen(), ), child: Text( - "Forgot Password".tr, + ConstTexts.forgotPassword.tr(), style: AppThemeData.semiBoldTextStyle( color: AppThemeData.info400, ), @@ -142,7 +144,7 @@ class LoginScreen extends StatelessWidget { const SizedBox(height: 20), RoundedButtonFill( borderRadius: 10.r, - title: "Log in".tr, + title: ConstTexts.login.tr(), onPress: controller.loginWithEmail, color: isDark @@ -167,7 +169,7 @@ class LoginScreen extends StatelessWidget { ), const SizedBox(width: 15), Text( - "or continue with".tr, + ConstTexts.orContinueWith.tr(), style: AppThemeData.regularTextStyle( color: isDark @@ -191,7 +193,7 @@ class LoginScreen extends StatelessWidget { const SizedBox(height: 25), RoundedButtonFill( borderRadius: 10.r, - title: "Mobile number".tr, + title: ConstTexts.mobileNumber.tr(), onPress: () => Get.to(() => const MobileLoginScreen()), isRight: false, @@ -217,7 +219,7 @@ class LoginScreen extends StatelessWidget { Expanded( child: RoundedButtonFill( borderRadius: 10.r, - title: "with Google".tr, + title: ConstTexts.withGoogle.tr(), textColor: isDark ? AppThemeData.grey100 @@ -241,7 +243,7 @@ class LoginScreen extends StatelessWidget { ? Expanded( child: RoundedButtonFill( borderRadius: 10.r, - title: "with Apple".tr, + title: ConstTexts.withApple.tr(), isCenter: true, textColor: isDark @@ -272,7 +274,7 @@ class LoginScreen extends StatelessWidget { child: Center( child: Text.rich( TextSpan( - text: "Didn't have an account?".tr, + text: ConstTexts.dontHaveAccount.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -281,7 +283,7 @@ class LoginScreen extends StatelessWidget { ), children: [ TextSpan( - text: "Sign up".tr, + text: ConstTexts.signUp.tr(), style: AppThemeData.mediumTextStyle( color: AppThemeData.ecommerce300, decoration: TextDecoration.underline, diff --git a/lib/screen_ui/auth_screens/mobile_login_screen.dart b/lib/screen_ui/auth_screens/mobile_login_screen.dart index d7587d0..9d1164c 100644 --- a/lib/screen_ui/auth_screens/mobile_login_screen.dart +++ b/lib/screen_ui/auth_screens/mobile_login_screen.dart @@ -1,6 +1,8 @@ import 'package:country_code_picker/country_code_picker.dart'; +import 'package:customer/constant/const_texts.dart'; import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart'; import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -53,7 +55,7 @@ class MobileLoginScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - "Skip".tr, + ConstTexts.skip.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -89,8 +91,7 @@ class MobileLoginScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Use your mobile number to Log in easily and securely." - .tr, + ConstTexts.useYourMobileNumber.tr(), style: AppThemeData.boldTextStyle( fontSize: 24, color: @@ -101,8 +102,8 @@ class MobileLoginScreen extends StatelessWidget { ), const SizedBox(height: 25), TextFieldWidget( - title: "Mobile Number*".tr, - hintText: "Enter Mobile number".tr, + title: ConstTexts.mobileNumber.tr(), + hintText: ConstTexts.enterMobileNumber.tr(), controller: controller.mobileController.value, textInputType: const TextInputType.numberWithOptions( @@ -181,7 +182,7 @@ class MobileLoginScreen extends StatelessWidget { const SizedBox(height: 30), RoundedButtonFill( borderRadius: 10.r, - title: "Send Code".tr, + title: ConstTexts.sendCode.tr(), onPress: controller.sendOtp, color: isDark @@ -206,7 +207,7 @@ class MobileLoginScreen extends StatelessWidget { ), const SizedBox(width: 15), Text( - "or continue with".tr, + ConstTexts.orContinueWith.tr(), style: AppThemeData.regularTextStyle( color: isDark @@ -228,7 +229,7 @@ class MobileLoginScreen extends StatelessWidget { const SizedBox(height: 25), RoundedButtonFill( borderRadius: 10.r, - title: "Email address".tr, + title: ConstTexts.emailAddress.tr(), onPress: () => Get.to(() => const SignUpScreen()), isRight: false, isCenter: true, @@ -256,7 +257,7 @@ class MobileLoginScreen extends StatelessWidget { child: Center( child: Text.rich( TextSpan( - text: "Didn't have an account?".tr, + text: ConstTexts.dontHaveAccount.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -265,7 +266,7 @@ class MobileLoginScreen extends StatelessWidget { ), children: [ TextSpan( - text: "Sign up".tr, + text: ConstTexts.signUp.tr(), style: AppThemeData.mediumTextStyle( color: AppThemeData.ecommerce300, decoration: TextDecoration.underline, diff --git a/lib/screen_ui/auth_screens/otp_verification_screen.dart b/lib/screen_ui/auth_screens/otp_verification_screen.dart index 1fc9c7f..7a62a97 100644 --- a/lib/screen_ui/auth_screens/otp_verification_screen.dart +++ b/lib/screen_ui/auth_screens/otp_verification_screen.dart @@ -1,4 +1,6 @@ +import 'package:customer/constant/const_texts.dart'; import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -49,7 +51,7 @@ class OtpVerificationScreen extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - "Skip".tr, + ConstTexts.skip.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -85,7 +87,7 @@ class OtpVerificationScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "${"Enter the OTP sent to your mobile".tr} ${controller.countryCode} ${controller.maskPhoneNumber(controller.phoneNumber.value)}", + "${ConstTexts.enterOtpSent.tr()} ${controller.countryCode} ${controller.maskPhoneNumber(controller.phoneNumber.value)}", style: AppThemeData.boldTextStyle( fontSize: 24, color: @@ -163,7 +165,7 @@ class OtpVerificationScreen extends StatelessWidget { controller.sendOTP(); }, child: Text( - "Resend OTP".tr, + ConstTexts.resendOTP.tr(), style: AppThemeData.semiBoldTextStyle( color: AppThemeData.info400, fontSize: 16, @@ -178,7 +180,7 @@ class OtpVerificationScreen extends StatelessWidget { /// Verify Button RoundedButtonFill( borderRadius: 10.r, - title: "Verify".tr, + title: ConstTexts.verify.tr(), onPress: controller.verifyOtp, color: isDark @@ -198,7 +200,7 @@ class OtpVerificationScreen extends StatelessWidget { child: Center( child: Text.rich( TextSpan( - text: "Didn't have an account?".tr, + text: ConstTexts.dontHaveAccount.tr(), style: AppThemeData.mediumTextStyle( color: isDark @@ -207,7 +209,7 @@ class OtpVerificationScreen extends StatelessWidget { ), children: [ TextSpan( - text: "Sign up".tr, + text: ConstTexts.signUp.tr(), style: AppThemeData.mediumTextStyle( color: AppThemeData.ecommerce300, decoration: TextDecoration.underline, diff --git a/lib/screen_ui/auth_screens/sign_up_screen.dart b/lib/screen_ui/auth_screens/sign_up_screen.dart index d26b0ce..51fc91c 100644 --- a/lib/screen_ui/auth_screens/sign_up_screen.dart +++ b/lib/screen_ui/auth_screens/sign_up_screen.dart @@ -1,5 +1,7 @@ import 'package:country_code_picker/country_code_picker.dart'; +import 'package:customer/constant/const_texts.dart'; import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -34,14 +36,33 @@ class SignUpScreen extends StatelessWidget { onPressed: () { Get.to(() => LocationPermissionScreen()); }, - style: TextButton.styleFrom(padding: const EdgeInsets.symmetric(horizontal: 12), minimumSize: const Size(0, 40), tapTargetSize: MaterialTapTargetSize.shrinkWrap), + style: TextButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 12), + minimumSize: const Size(0, 40), + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text("Skip".tr, style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)), + Text( + ConstTexts.skip.tr(), + style: AppThemeData.mediumTextStyle( + color: + isDark + ? AppThemeData.greyDark500 + : AppThemeData.grey500, + ), + ), Padding( padding: const EdgeInsets.only(top: 2), - child: Icon(Icons.arrow_forward_ios, size: 16, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500), + child: Icon( + Icons.arrow_forward_ios, + size: 16, + color: + isDark + ? AppThemeData.greyDark500 + : AppThemeData.grey500, + ), ), ], ), @@ -57,62 +78,125 @@ class SignUpScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Sign up to explore all our services and start shopping, riding, and more.".tr, - style: AppThemeData.boldTextStyle(fontSize: 24, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), + ConstTexts.signUpToExplore.tr(), + style: AppThemeData.boldTextStyle( + fontSize: 24, + color: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.grey900, + ), ), const SizedBox(height: 24), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: TextFieldWidget(title: "First Name*".tr, hintText: "Jerome".tr, controller: controller.firstNameController.value)), + Expanded( + child: TextFieldWidget( + title: ConstTexts.firstName.tr(), + hintText: "Abdusalom", + controller: controller.firstNameController.value, + ), + ), const SizedBox(width: 10), - Expanded(child: TextFieldWidget(title: "Last Name*".tr, hintText: "Bell".tr, controller: controller.lastNameController.value)), + Expanded( + child: TextFieldWidget( + title: ConstTexts.lastName.tr(), + hintText: "G'ayratov", + controller: controller.lastNameController.value, + ), + ), ], ), const SizedBox(height: 15), TextFieldWidget( - title: "Email Address*".tr, - hintText: "jerome014@gmail.com", + title: ConstTexts.emailAddress.tr(), + hintText: "abdusalom@gmail.com", controller: controller.emailController.value, focusNode: controller.emailFocusNode, ), const SizedBox(height: 15), TextFieldWidget( - title: "Mobile Number*".tr, - hintText: "Enter Mobile number".tr, - enable: controller.type.value == "mobileNumber" ? false : true, + title: ConstTexts.mobileNumber.tr(), + hintText: ConstTexts.enterMobileNumber.tr(), + enable: + controller.type.value == "mobileNumber" + ? false + : true, controller: controller.mobileController.value, - textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true), + textInputType: const TextInputType.numberWithOptions( + signed: true, + decimal: true, + ), textInputAction: TextInputAction.done, - inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(10)], + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp('[0-9]')), + LengthLimitingTextInputFormatter(10), + ], prefix: Row( mainAxisSize: MainAxisSize.min, children: [ CountryCodePicker( onChanged: (value) { - controller.countryCodeController.value.text = value.dialCode ?? Constant.defaultCountryCode; + controller.countryCodeController.value.text = + value.dialCode ?? Constant.defaultCountryCode; }, - initialSelection: controller.countryCodeController.value.text.isNotEmpty ? controller.countryCodeController.value.text : Constant.defaultCountryCode, + initialSelection: + controller + .countryCodeController + .value + .text + .isNotEmpty + ? controller + .countryCodeController + .value + .text + : Constant.defaultCountryCode, showCountryOnly: false, showOnlyCountryWhenClosed: false, alignLeft: false, enabled: controller.type.value != "mobileNumber", - textStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : Colors.black), - dialogTextStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), - searchStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), - dialogBackgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface, + textStyle: TextStyle( + fontSize: 16, + color: + isDark + ? AppThemeData.greyDark900 + : Colors.black, + ), + dialogTextStyle: TextStyle( + fontSize: 16, + color: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.grey900, + ), + searchStyle: TextStyle( + fontSize: 16, + color: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.grey900, + ), + dialogBackgroundColor: + isDark + ? AppThemeData.surfaceDark + : AppThemeData.surface, padding: EdgeInsets.zero, ), // const Icon(Icons.keyboard_arrow_down_rounded, size: 24, color: AppThemeData.grey400), - Container(height: 24, width: 1, color: AppThemeData.grey400), + Container( + height: 24, + width: 1, + color: AppThemeData.grey400, + ), const SizedBox(width: 4), ], ), ), const SizedBox(height: 15), TextFieldWidget( - title: "Password*".tr, - hintText: "Enter password".tr, + title: ConstTexts.password.tr(), + hintText: ConstTexts.enterPassword.tr(), controller: controller.passwordController.value, obscureText: controller.passwordVisible.value, focusNode: controller.passwordFocusNode, @@ -120,78 +204,142 @@ class SignUpScreen extends StatelessWidget { padding: const EdgeInsets.all(12), child: InkWell( onTap: () { - controller.passwordVisible.value = !controller.passwordVisible.value; + controller.passwordVisible.value = + !controller.passwordVisible.value; }, child: controller.passwordVisible.value ? SvgPicture.asset( "assets/icons/ic_password_show.svg", - colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, + BlendMode.srcIn, + ), ) : SvgPicture.asset( "assets/icons/ic_password_close.svg", - colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, + BlendMode.srcIn, + ), ), ), ), ), const SizedBox(height: 15), TextFieldWidget( - title: "Confirm Password*".tr, - hintText: "Enter confirm password".tr, + title: ConstTexts.confirmPassword.tr(), + hintText: ConstTexts.enterConfirmPassword.tr(), controller: controller.confirmPasswordController.value, obscureText: controller.conformPasswordVisible.value, suffix: Padding( padding: const EdgeInsets.all(12), child: InkWell( onTap: () { - controller.conformPasswordVisible.value = !controller.conformPasswordVisible.value; + controller.conformPasswordVisible.value = + !controller.conformPasswordVisible.value; }, child: controller.conformPasswordVisible.value ? SvgPicture.asset( "assets/icons/ic_password_show.svg", - colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, + BlendMode.srcIn, + ), ) : SvgPicture.asset( "assets/icons/ic_password_close.svg", - colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, + BlendMode.srcIn, + ), ), ), ), ), const SizedBox(height: 15), - TextFieldWidget(title: "Referral Code".tr, hintText: "Enter referral code".tr, controller: controller.referralController.value), + TextFieldWidget( + title: ConstTexts.referralCode.tr(), + hintText: ConstTexts.enterReferralCode.tr(), + controller: controller.referralController.value, + ), const SizedBox(height: 40), RoundedButtonFill( - borderRadius: 10.r, - title: "Sign up".tr, + borderRadius: 10.r, + title: ConstTexts.signUp.tr(), onPress: () => controller.signUp(), - color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, - textColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface, + color: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.grey900, + textColor: + isDark + ? AppThemeData.surfaceDark + : AppThemeData.surface, ), const SizedBox(height: 25), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container(width: 52, height: 1, color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey300), + Container( + width: 52, + height: 1, + color: + isDark + ? AppThemeData.greyDark400 + : AppThemeData.grey300, + ), const SizedBox(width: 15), - Text("or continue with".tr, style: AppThemeData.regularTextStyle(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400)), + Text( + ConstTexts.orContinueWith.tr(), + style: AppThemeData.regularTextStyle( + color: + isDark + ? AppThemeData.greyDark400 + : AppThemeData.grey400, + ), + ), const SizedBox(width: 15), - Container(width: 52, height: 1, color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey300), + Container( + width: 52, + height: 1, + color: + isDark + ? AppThemeData.greyDark400 + : AppThemeData.grey300, + ), ], ), const SizedBox(height: 25), RoundedButtonFill( - borderRadius: 10.r, - title: "Mobile number".tr, + borderRadius: 10.r, + title: ConstTexts.mobileNumber.tr(), onPress: () => Get.to(() => const MobileLoginScreen()), isRight: false, isCenter: true, - icon: Icon(Icons.mobile_friendly_outlined, size: 20, color: isDark ? AppThemeData.greyDark900 : null), + icon: Icon( + Icons.mobile_friendly_outlined, + size: 20, + color: isDark ? AppThemeData.greyDark900 : null, + ), //Image.asset(AppAssets.icMessage, width: 20, height: 18, color: isDark ? AppThemeData.greyDark900 : null), - color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200, - textColor: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, + color: + isDark + ? AppThemeData.greyDark200 + : AppThemeData.grey200, + textColor: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.grey900, ), const SizedBox(height: 25), Padding( @@ -199,11 +347,16 @@ class SignUpScreen extends StatelessWidget { child: Center( child: Text.rich( TextSpan( - text: "Already have an account?".tr, - style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800), + text: ConstTexts.alreadyHaveAccount.tr(), + style: AppThemeData.mediumTextStyle( + color: + isDark + ? AppThemeData.greyDark800 + : AppThemeData.grey800, + ), children: [ TextSpan( - text: "Log in".tr, + text: ConstTexts.login.tr(), style: AppThemeData.mediumTextStyle( color: AppThemeData.ecommerce300, decoration: TextDecoration.underline, diff --git a/lib/screen_ui/cab_service_screens/cab_booking_screen.dart b/lib/screen_ui/cab_service_screens/cab_booking_screen.dart index 96c67b7..5a8f5b1 100644 --- a/lib/screen_ui/cab_service_screens/cab_booking_screen.dart +++ b/lib/screen_ui/cab_service_screens/cab_booking_screen.dart @@ -92,8 +92,8 @@ class CabBookingScreen extends StatelessWidget { 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: Platform.isAndroid - ? "com.emart.customer" - : "com.emart.customer.ios", + ? "felix.fondex.uz" + : "felix.fondex.uz.ios", ), flutterMap.MarkerLayer( markers: controller.osmMarker, @@ -1408,7 +1408,6 @@ class CabBookingScreen extends StatelessWidget { ), ), const SizedBox(height: 10), - Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), @@ -1636,6 +1635,7 @@ class CabBookingScreen extends StatelessWidget { ), ), const SizedBox(height: 20), + Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), @@ -1778,7 +1778,13 @@ class CabBookingScreen extends StatelessWidget { ), SizedBox(width: 10.w), Text( - controller.selectedPaymentMethod.value == "cod" ? "Наличными" : controller.selectedPaymentMethod.value.tr, + controller.selectedPaymentMethod.value == + "cod" + ? "Наличными" + : controller + .selectedPaymentMethod + .value + .tr, textAlign: TextAlign.start, style: AppThemeData.boldTextStyle( fontSize: 16, @@ -1853,13 +1859,13 @@ class CabBookingScreen extends StatelessWidget { SizedBox(height: 30), Text( "Waiting for driver....".tr, - style: AppThemeData.boldTextStyle( - fontSize: 18.sp, - color: - isDark - ? AppThemeData.greyDark900 - : AppThemeData.darkGrey, - ), + style: AppThemeData.boldTextStyle( + fontSize: 18.sp, + color: + isDark + ? AppThemeData.greyDark900 + : AppThemeData.darkGrey, + ), ), Image.asset('assets/loader.gif', width: 250), RoundedButtonFill( @@ -2946,12 +2952,16 @@ class CabBookingScreen extends StatelessWidget { borderRadius: BorderRadius.circular(8), ), ), - child: value == PaymentGateway.click || value == PaymentGateway.payme ? Image.asset(image) : Padding( - padding: EdgeInsets.all( - value.name == "payFast" ? 0 : 8.0, - ), - child: Image.asset(image), - ), + child: + value == PaymentGateway.click || + value == PaymentGateway.payme + ? Image.asset(image) + : Padding( + padding: EdgeInsets.all( + value.name == "payFast" ? 0 : 8.0, + ), + child: Image.asset(image), + ), ), const SizedBox(width: 10), value.name == "wallet" @@ -2996,7 +3006,9 @@ class CabBookingScreen extends StatelessWidget { ) : Expanded( child: Text( - value.name == "cod" ? "Наличными" : value.name.capitalizeString(), + value.name == "cod" + ? "Наличными" + : value.name.capitalizeString(), textAlign: TextAlign.start, style: AppThemeData.semiBoldTextStyle( fontSize: 16, diff --git a/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart b/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart index d364282..cb30299 100644 --- a/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart +++ b/lib/screen_ui/multi_vendor_service/dine_in_screeen/dine_in_screen.dart @@ -37,7 +37,10 @@ class DineInScreen extends StatelessWidget { builder: (controller) { return Scaffold( body: NestedScrollView( - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { + headerSliverBuilder: ( + BuildContext context, + bool innerBoxIsScrolled, + ) { return [ SliverAppBar( expandedHeight: Responsive.height(38, context), @@ -51,14 +54,24 @@ class DineInScreen extends StatelessWidget { onTap: () { Get.back(); }, - child: Icon(Icons.arrow_back, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + child: Icon( + Icons.arrow_back, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey50, + ), ), ], ), flexibleSpace: FlexibleSpaceBar( background: Stack( children: [ - Image.asset("assets/images/dine_in_bg.png", fit: BoxFit.fill, width: Responsive.width(100, context)), + Image.asset( + "assets/images/dine_in_bg.png", + fit: BoxFit.fill, + width: Responsive.width(100, context), + ), Center( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), @@ -68,12 +81,28 @@ class DineInScreen extends StatelessWidget { children: [ Text( "Dine-In Reservations".tr, - style: TextStyle(fontSize: 24, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600, color: isDark ? AppThemeData.grey900 : AppThemeData.grey900), + style: TextStyle( + fontSize: 24, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + color: + isDark + ? AppThemeData.grey900 + : AppThemeData.grey900, + ), ), Text( - "Book a table at your favorite restaurant and enjoy a delightful dining experience.".tr, + "Book a table at your favorite restaurant and enjoy a delightful dining experience." + .tr, textAlign: TextAlign.center, - style: TextStyle(fontSize: 14, fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey900 : AppThemeData.grey900), + style: TextStyle( + fontSize: 14, + fontFamily: AppThemeData.regular, + color: + isDark + ? AppThemeData.grey900 + : AppThemeData.grey900, + ), ), ], ), @@ -88,25 +117,47 @@ class DineInScreen extends StatelessWidget { body: controller.isLoading.value ? Constant.loader() - : Constant.isZoneAvailable == false || controller.allNearestRestaurant.isEmpty + : Constant.isZoneAvailable == false || + controller.allNearestRestaurant.isEmpty ? Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset("assets/images/location.gif", height: 120), + Image.asset( + "assets/images/location.gif", + height: 120, + ), const SizedBox(height: 12), - Text("No Store Found in Your Area".tr, style: TextStyle(color: isDark ? AppThemeData.grey100 : AppThemeData.grey800, fontSize: 22, fontFamily: AppThemeData.semiBold)), + Text( + "No Store Found in Your Area".tr, + style: TextStyle( + color: + isDark + ? AppThemeData.grey100 + : AppThemeData.grey800, + fontSize: 22, + fontFamily: AppThemeData.semiBold, + ), + ), const SizedBox(height: 5), Text( - "Currently, there are no available store in your zone. Try changing your location to find nearby options.".tr, + "Currently, there are no available store in your zone. Try changing your location to find nearby options." + .tr, textAlign: TextAlign.center, - style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontSize: 16, fontFamily: AppThemeData.bold), + style: TextStyle( + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey500, + fontSize: 16, + fontFamily: AppThemeData.bold, + ), ), const SizedBox(height: 20), RoundedButtonFill( - borderRadius: 10.r, + borderRadius: 10.r, title: "Change Zone".tr, width: 55, height: 5.5, @@ -129,9 +180,13 @@ class DineInScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox(height: 10), - titleView(isDark, "Explore the Categories".tr, () { - Get.to(const ViewAllCategoryDineInScreen()); - }), + titleView( + isDark, + "Explore the Categories".tr, + () { + Get.to(const ViewAllCategoryDineInScreen()); + }, + ), const SizedBox(height: 10), CategoryView(controller: controller), const SizedBox(height: 28), @@ -141,12 +196,23 @@ class DineInScreen extends StatelessWidget { controller.newArrivalRestaurantList.isEmpty ? const SizedBox() : Container( - decoration: const BoxDecoration(image: DecorationImage(image: AssetImage("assets/images/ic_new_arrival_dinein.png"), fit: BoxFit.cover)), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/ic_new_arrival_dinein.png", + ), + fit: BoxFit.cover, + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 16, + ), child: Column( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( children: [ @@ -154,17 +220,42 @@ class DineInScreen extends StatelessWidget { child: Text( "New Arrivals".tr, textAlign: TextAlign.start, - style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + style: TextStyle( + fontFamily: + AppThemeData.semiBold, + fontSize: 16, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey50, + ), ), ), InkWell( onTap: () { - Get.to(const DineInRestaurantListScreen(), arguments: {"vendorList": controller.newArrivalRestaurantList, "title": "New Arrival"}); + Get.to( + const DineInRestaurantListScreen(), + arguments: { + "vendorList": + controller + .newArrivalRestaurantList, + "title": "New Arrival", + }, + ); }, child: Text( "View all".tr, textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), + style: TextStyle( + fontFamily: + AppThemeData.regular, + color: + isDark + ? AppThemeData + .primary300 + : AppThemeData + .primary300, + ), ), ), ], @@ -177,11 +268,25 @@ class DineInScreen extends StatelessWidget { ), controller.bannerBottomModel.isEmpty ? const SizedBox() - : Padding(padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20), child: BannerBottomView(controller: controller)), + : Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 20, + ), + child: BannerBottomView(controller: controller), + ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.grey700 : AppThemeData.grey200, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.grey700 + : AppThemeData.grey200, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Padding( padding: const EdgeInsets.all(8.0), child: Row( @@ -193,15 +298,36 @@ class DineInScreen extends StatelessWidget { }, child: Container( decoration: - controller.isPopular.value == false + controller.isPopular.value == + false ? null - : ShapeDecoration(color: AppThemeData.grey900, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + : ShapeDecoration( + color: AppThemeData.grey900, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), child: Text( "Popular Stores".tr, textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), + style: TextStyle( + fontFamily: + AppThemeData.semiBold, + color: + isDark + ? AppThemeData + .primary300 + : AppThemeData + .primary300, + ), ), ), ), @@ -216,22 +342,41 @@ class DineInScreen extends StatelessWidget { decoration: controller.isPopular.value == true ? null - : ShapeDecoration(color: AppThemeData.grey900, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + : ShapeDecoration( + color: AppThemeData.grey900, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), child: Text( "All Stores".tr, textAlign: TextAlign.center, style: TextStyle( - fontFamily: AppThemeData.semiBold, + fontFamily: + AppThemeData.semiBold, color: - controller.isPopular.value == true + controller + .isPopular + .value == + true ? isDark - ? AppThemeData.grey400 - : AppThemeData.grey500 + ? AppThemeData + .grey400 + : AppThemeData + .grey500 : isDark - ? AppThemeData.primary300 - : AppThemeData.primary300, + ? AppThemeData + .primary300 + : AppThemeData + .primary300, ), ), ), @@ -244,8 +389,14 @@ class DineInScreen extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20), - child: controller.isPopular.value ? PopularRestaurant(controller: controller) : AllRestaurant(controller: controller), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 20, + ), + child: + controller.isPopular.value + ? PopularRestaurant(controller: controller) + : AllRestaurant(controller: controller), ), ], ), @@ -259,12 +410,28 @@ class DineInScreen extends StatelessWidget { Row titleView(isDark, String name, Function()? onPress) { return Row( children: [ - Expanded(child: Text(name, textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.bold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900))), + Expanded( + child: Text( + name, + textAlign: TextAlign.start, + style: TextStyle( + fontFamily: AppThemeData.bold, + color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, + ), + ), + ), InkWell( onTap: () { onPress!(); }, - child: Text("View all".tr, textAlign: TextAlign.center, style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300)), + child: Text( + "View all".tr, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: AppThemeData.regular, + color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, + ), + ), ), ], ); @@ -290,19 +457,30 @@ class PopularRestaurant extends StatelessWidget { VendorModel vendorModel = controller.popularRestaurantList[index]; return InkWell( onTap: () { - Get.to(const DineInDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const DineInDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); }, child: Padding( padding: const EdgeInsets.only(bottom: 20), child: Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))), + decoration: ShapeDecoration( + color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), child: Stack( children: [ RestaurantImageView(vendorModel: vendorModel), @@ -310,7 +488,14 @@ class PopularRestaurant extends StatelessWidget { height: Responsive.height(20, context), width: Responsive.width(100, context), decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), const Color(0xFF111827)]), + gradient: LinearGradient( + begin: const Alignment(-0.00, -1.00), + end: const Alignment(0, 1), + colors: [ + Colors.black.withOpacity(0), + const Color(0xFF111827), + ], + ), ), ), Positioned( @@ -318,21 +503,55 @@ class PopularRestaurant extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -340,22 +559,49 @@ class PopularRestaurant extends StatelessWidget { ), ), Transform.translate( - offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)), + offset: Offset( + Responsive.width(-3, context), + Responsive.height(17.5, context), + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", - style: TextStyle(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), @@ -364,18 +610,39 @@ class PopularRestaurant extends StatelessWidget { const SizedBox(width: 10), Container( decoration: ShapeDecoration( - color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData.ecommerce600 + : AppThemeData.ecommerce50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + colorFilter: ColorFilter.mode( + AppThemeData.ecommerce300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", - style: TextStyle(color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + color: + isDark + ? AppThemeData.ecommerce300 + : AppThemeData.ecommerce300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), @@ -396,13 +663,29 @@ class PopularRestaurant extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 18, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + style: TextStyle( + fontSize: 18, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), ), Text( vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -437,19 +720,30 @@ class AllRestaurant extends StatelessWidget { VendorModel vendorModel = controller.allNearestRestaurant[index]; return InkWell( onTap: () { - Get.to(const DineInDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const DineInDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); }, child: Padding( padding: const EdgeInsets.only(bottom: 20), child: Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))), + decoration: ShapeDecoration( + color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), child: Stack( children: [ RestaurantImageView(vendorModel: vendorModel), @@ -457,7 +751,14 @@ class AllRestaurant extends StatelessWidget { height: Responsive.height(20, context), width: Responsive.width(100, context), decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), const Color(0xFF111827)]), + gradient: LinearGradient( + begin: const Alignment(-0.00, -1.00), + end: const Alignment(0, 1), + colors: [ + Colors.black.withOpacity(0), + const Color(0xFF111827), + ], + ), ), ), Positioned( @@ -465,21 +766,55 @@ class AllRestaurant extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -487,22 +822,49 @@ class AllRestaurant extends StatelessWidget { ), ), Transform.translate( - offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)), + offset: Offset( + Responsive.width(-3, context), + Responsive.height(17.5, context), + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", - style: TextStyle(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), @@ -511,18 +873,39 @@ class AllRestaurant extends StatelessWidget { const SizedBox(width: 10), Container( decoration: ShapeDecoration( - color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData.ecommerce600 + : AppThemeData.ecommerce50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + colorFilter: ColorFilter.mode( + AppThemeData.ecommerce300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", - style: TextStyle(color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + color: + isDark + ? AppThemeData.ecommerce300 + : AppThemeData.ecommerce300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), @@ -543,13 +926,29 @@ class AllRestaurant extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 18, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + style: TextStyle( + fontSize: 18, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), ), Text( vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -579,12 +978,18 @@ class NewArrival extends StatelessWidget { child: ListView.builder( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, - itemCount: controller.newArrivalRestaurantList.length >= 10 ? 10 : controller.newArrivalRestaurantList.length, + itemCount: + controller.newArrivalRestaurantList.length >= 10 + ? 10 + : controller.newArrivalRestaurantList.length, itemBuilder: (BuildContext context, int index) { VendorModel vendorModel = controller.newArrivalRestaurantList[index]; return InkWell( onTap: () { - Get.to(const DineInDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const DineInDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); }, child: Padding( padding: const EdgeInsets.only(right: 10), @@ -595,13 +1000,27 @@ class NewArrival extends StatelessWidget { children: [ Expanded( child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(10)), + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), child: Stack( children: [ - NetworkImageWidget(imageUrl: vendorModel.photo.toString(), fit: BoxFit.cover, height: Responsive.height(100, context), width: Responsive.width(100, context)), + NetworkImageWidget( + imageUrl: vendorModel.photo.toString(), + fit: BoxFit.cover, + height: Responsive.height(100, context), + width: Responsive.width(100, context), + ), Container( decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(0.00, 1.00), end: const Alignment(0, -1), colors: [Colors.black.withOpacity(0), AppThemeData.grey900]), + gradient: LinearGradient( + begin: const Alignment(0.00, 1.00), + end: const Alignment(0, -1), + colors: [ + Colors.black.withOpacity(0), + AppThemeData.grey900, + ], + ), ), ), Positioned( @@ -609,21 +1028,55 @@ class NewArrival extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -636,13 +1089,25 @@ class NewArrival extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 16, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + style: TextStyle( + fontSize: 16, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark ? AppThemeData.grey50 : AppThemeData.grey50, + ), ), Row( children: [ Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 10), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", @@ -652,7 +1117,10 @@ class NewArrival extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, ), ), ], @@ -660,7 +1128,9 @@ class NewArrival extends StatelessWidget { const SizedBox(width: 20), Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg"), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + ), const SizedBox(width: 10), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", @@ -670,7 +1140,10 @@ class NewArrival extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, ), ), ], @@ -681,7 +1154,15 @@ class NewArrival extends StatelessWidget { vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -710,10 +1191,17 @@ class CategoryView extends StatelessWidget { padding: EdgeInsets.zero, itemCount: controller.vendorCategoryModel.length, itemBuilder: (context, index) { - VendorCategoryModel vendorCategoryModel = controller.vendorCategoryModel[index]; + VendorCategoryModel vendorCategoryModel = + controller.vendorCategoryModel[index]; return InkWell( onTap: () { - Get.to(const CategoryRestaurantScreen(), arguments: {"vendorCategoryModel": vendorCategoryModel, "dineIn": true}); + Get.to( + const CategoryRestaurantScreen(), + arguments: { + "vendorCategoryModel": vendorCategoryModel, + "dineIn": true, + }, + ); }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 4), @@ -723,7 +1211,14 @@ class CategoryView extends StatelessWidget { decoration: ShapeDecoration( color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder( - side: BorderSide(width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: isDark ? AppThemeData.grey800 : AppThemeData.grey100), + side: BorderSide( + width: 1, + strokeAlign: BorderSide.strokeAlignOutside, + color: + isDark + ? AppThemeData.grey800 + : AppThemeData.grey100, + ), borderRadius: BorderRadius.circular(100), ), ), @@ -731,14 +1226,32 @@ class CategoryView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox(width: 60, height: 60, child: ClipOval(child: NetworkImageWidget(imageUrl: vendorCategoryModel.photo.toString(), fit: BoxFit.cover))), + SizedBox( + width: 60, + height: 60, + child: ClipOval( + child: NetworkImageWidget( + imageUrl: vendorCategoryModel.photo.toString(), + fit: BoxFit.cover, + ), + ), + ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), child: Text( '${vendorCategoryModel.title}', textAlign: TextAlign.center, maxLines: 1, - style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium), + style: TextStyle( + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + fontFamily: AppThemeData.medium, + ), ), ), ], @@ -780,17 +1293,32 @@ class BannerBottomView extends StatelessWidget { onTap: () async { if (bannerModel.redirect_type == "store") { ShowToastDialog.showLoader("Please wait...".tr); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(bannerModel.redirect_id.toString()); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + bannerModel.redirect_id.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "product") { ShowToastDialog.showLoader("Please wait...".tr); - ProductModel? productModel = await FireStoreUtils.getProductById(bannerModel.redirect_id.toString()); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(productModel!.vendorID.toString()); + ProductModel? productModel = + await FireStoreUtils.getProductById( + bannerModel.redirect_id.toString(), + ); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + productModel!.vendorID.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "external_link") { final uri = Uri.parse(bannerModel.redirect_id.toString()); if (await canLaunchUrl(uri)) { @@ -802,7 +1330,13 @@ class BannerBottomView extends StatelessWidget { }, child: Padding( padding: const EdgeInsets.only(right: 14), - child: ClipRRect(borderRadius: const BorderRadius.all(Radius.circular(12)), child: NetworkImageWidget(imageUrl: bannerModel.photo.toString(), fit: BoxFit.cover)), + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(12)), + child: NetworkImageWidget( + imageUrl: bannerModel.photo.toString(), + fit: BoxFit.cover, + ), + ), ), ); }, @@ -813,14 +1347,22 @@ class BannerBottomView extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - children: List.generate(controller.bannerBottomModel.length, (index) { + children: List.generate(controller.bannerBottomModel.length, ( + index, + ) { return Obx( () => Container( margin: const EdgeInsets.only(right: 5), alignment: Alignment.centerLeft, height: 9, width: 9, - decoration: BoxDecoration(shape: BoxShape.circle, color: controller.currentBottomPage.value == index ? AppThemeData.primary300 : Colors.black12), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + controller.currentBottomPage.value == index + ? AppThemeData.primary300 + : Colors.black12, + ), ), ); }), diff --git a/lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart b/lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart index 2d361f6..6292219 100644 --- a/lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart +++ b/lib/screen_ui/multi_vendor_service/home_screen/home_screen.dart @@ -24,6 +24,7 @@ import 'package:customer/widget/place_picker/location_picker_screen.dart'; import 'package:customer/widget/place_picker/selected_location_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart' as flutterMap; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:geocoding/geocoding.dart'; import 'package:geolocator/geolocator.dart'; @@ -67,28 +68,53 @@ class HomeScreen extends StatelessWidget { decoration: BoxDecoration( gradient: LinearGradient( begin: const Alignment(0.00, -3), - colors: [isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce50, isDark ? AppThemeData.surfaceDark : AppThemeData.surface], + colors: [ + isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce50, + isDark ? AppThemeData.surfaceDark : AppThemeData.surface, + ], end: const Alignment(0, 1), ), ), child: controller.isLoading.value ? Constant.loader() - : Constant.isZoneAvailable == false || controller.allNearestRestaurant.isEmpty + : Constant.isZoneAvailable == false || + controller.allNearestRestaurant.isEmpty ? Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset("assets/images/location.gif", height: 120), + Image.asset( + "assets/images/location.gif", + height: 120, + ), const SizedBox(height: 12), - Text("No Store Found in Your Area".tr, style: TextStyle(color: isDark ? AppThemeData.grey100 : AppThemeData.grey800, fontSize: 22, fontFamily: AppThemeData.semiBold)), + Text( + "No Store Found in Your Area".tr, + style: TextStyle( + color: + isDark + ? AppThemeData.grey100 + : AppThemeData.grey800, + fontSize: 22, + fontFamily: AppThemeData.semiBold, + ), + ), const SizedBox(height: 5), Text( - "Currently, there are no available store in your zone. Try changing your location to find nearby options.".tr, + "Currently, there are no available store in your zone. Try changing your location to find nearby options." + .tr, textAlign: TextAlign.center, - style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontSize: 16, fontFamily: AppThemeData.bold), + style: TextStyle( + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey500, + fontSize: 16, + fontFamily: AppThemeData.bold, + ), ), const SizedBox(height: 20), RoundedButtonFill( @@ -105,7 +131,9 @@ class HomeScreen extends StatelessWidget { ), ) : Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).viewPadding.top), + padding: EdgeInsets.only( + top: MediaQuery.of(context).viewPadding.top, + ), child: controller.isListView.value == false ? const MapView() @@ -114,7 +142,9 @@ class HomeScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric( + horizontal: 16, + ), child: Column( children: [ const SizedBox(height: 10), @@ -124,97 +154,207 @@ class HomeScreen extends StatelessWidget { onTap: () { Get.back(); }, - child: Icon(Icons.arrow_back, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, size: 20), + child: Icon( + Icons + .arrow_back_ios_new_rounded, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + size: 20.r, + ), ), const SizedBox(width: 10), Expanded( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Constant.userModel == null ? InkWell( onTap: () { - Get.offAll(const LoginScreen()); + Get.offAll( + const LoginScreen(), + ); }, child: Text( - "Login".tr, - textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.medium, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 12), + "Login", + textAlign: + TextAlign.center, + style: TextStyle( + fontFamily: + AppThemeData + .medium, + color: + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey900, + fontSize: 12.sp, + ), ), ) : Text( - Constant.userModel!.fullName(), - textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.medium, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 12), + "Еда и доставка", + style: + AppThemeData.boldTextStyle( + color: + AppThemeData + .darkGrey, + fontSize: 18.sp, + ), ), InkWell( onTap: () async { - if (Constant.userModel != null) { - Get.to(AddressListScreen())!.then((value) { + if (Constant.userModel != + null) { + Get.to( + AddressListScreen(), + )!.then((value) { if (value != null) { - ShippingAddress shippingAddress = value; - Constant.selectedLocation = shippingAddress; - controller.getData(); + ShippingAddress + shippingAddress = + value; + Constant.selectedLocation = + shippingAddress; + controller + .getData(); } }); } else { Constant.checkPermission( onTap: () async { - ShowToastDialog.showLoader("Please wait...".tr); + ShowToastDialog.showLoader( + "Please wait..." + .tr, + ); // ✅ declare it once here! - ShippingAddress shippingAddress = ShippingAddress(); + ShippingAddress + shippingAddress = + ShippingAddress(); try { await Geolocator.requestPermission(); await Geolocator.getCurrentPosition(); ShowToastDialog.closeLoader(); - if (Constant.selectedMapType == 'osm') { - final result = await Get.to(() => MapPickerPage()); - if (result != null) { - final firstPlace = result; - final lat = firstPlace.coordinates.latitude; - final lng = firstPlace.coordinates.longitude; - final address = firstPlace.address; + if (Constant + .selectedMapType == + 'osm') { + final result = + await Get.to( + () => + MapPickerPage(), + ); + if (result != + null) { + final firstPlace = + result; + final lat = + firstPlace + .coordinates + .latitude; + final lng = + firstPlace + .coordinates + .longitude; + final address = + firstPlace + .address; - shippingAddress.addressAs = "Home"; - shippingAddress.locality = address.toString(); - shippingAddress.location = UserLocation(latitude: lat, longitude: lng); - Constant.selectedLocation = shippingAddress; - controller.getData(); + shippingAddress + .addressAs = + "Home"; + shippingAddress + .locality = + address + .toString(); + shippingAddress + .location = + UserLocation( + latitude: + lat, + longitude: + lng, + ); + Constant.selectedLocation = + shippingAddress; + controller + .getData(); Get.back(); } } else { - Get.to(LocationPickerScreen())!.then((value) async { - if (value != null) { - SelectedLocationModel selectedLocationModel = value; + Get.to( + LocationPickerScreen(), + )!.then(( + value, + ) async { + if (value != + null) { + SelectedLocationModel + selectedLocationModel = + value; - shippingAddress.addressAs = "Home"; - shippingAddress.location = UserLocation( - latitude: selectedLocationModel.latLng!.latitude, - longitude: selectedLocationModel.latLng!.longitude, + shippingAddress + .addressAs = + "Home"; + shippingAddress + .location = UserLocation( + latitude: + selectedLocationModel + .latLng! + .latitude, + longitude: + selectedLocationModel + .latLng! + .longitude, ); - shippingAddress.locality = "Picked from Map"; // You can reverse-geocode + shippingAddress + .locality = + "Picked from Map"; // You can reverse-geocode - Constant.selectedLocation = shippingAddress; - controller.getData(); + Constant.selectedLocation = + shippingAddress; + controller + .getData(); } }); } } catch (e) { - await placemarkFromCoordinates(19.228825, 72.854118).then((valuePlaceMaker) { - Placemark placeMark = valuePlaceMaker[0]; - shippingAddress.location = UserLocation(latitude: 19.228825, longitude: 72.854118); - String currentLocation = + await placemarkFromCoordinates( + 19.228825, + 72.854118, + ).then(( + valuePlaceMaker, + ) { + Placemark + placeMark = + valuePlaceMaker[0]; + shippingAddress + .location = + UserLocation( + latitude: + 19.228825, + longitude: + 72.854118, + ); + String + currentLocation = "${placeMark.name}, ${placeMark.subLocality}, ${placeMark.locality}, ${placeMark.administrativeArea}, ${placeMark.postalCode}, ${placeMark.country}"; - shippingAddress.locality = currentLocation; + shippingAddress + .locality = + currentLocation; }); - Constant.selectedLocation = shippingAddress; + Constant.selectedLocation = + shippingAddress; ShowToastDialog.closeLoader(); - controller.getData(); + controller + .getData(); } }, context: context, @@ -223,19 +363,36 @@ class HomeScreen extends StatelessWidget { }, child: Text.rich( maxLines: 1, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow.ellipsis, TextSpan( children: [ TextSpan( - text: Constant.selectedLocation.getFullAddress(), + text: + Constant + .selectedLocation + .getFullAddress(), style: TextStyle( - fontFamily: AppThemeData.medium, - overflow: TextOverflow.ellipsis, - color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, + fontFamily: + AppThemeData + .medium, + overflow: + TextOverflow + .ellipsis, + color: + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey900, fontSize: 14, ), ), - WidgetSpan(child: SvgPicture.asset("assets/icons/ic_down.svg")), + WidgetSpan( + child: SvgPicture.asset( + "assets/icons/ic_down.svg", + ), + ), ], ), ), @@ -246,21 +403,38 @@ class HomeScreen extends StatelessWidget { const SizedBox(width: 5), Obx( () => badges.Badge( - showBadge: cartItem.isEmpty ? false : true, + showBadge: + cartItem.isEmpty + ? false + : true, badgeContent: Text( "${cartItem.length}", style: TextStyle( fontSize: 14, - overflow: TextOverflow.ellipsis, - fontFamily: AppThemeData.semiBold, + overflow: + TextOverflow.ellipsis, + fontFamily: + AppThemeData.semiBold, fontWeight: FontWeight.w600, - color: isDark ? AppThemeData.grey50 : AppThemeData.grey50, + color: + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey50, ), ), - badgeStyle: badges.BadgeStyle(shape: badges.BadgeShape.circle, badgeColor: AppThemeData.ecommerce300), + badgeStyle: badges.BadgeStyle( + shape: + badges.BadgeShape.circle, + badgeColor: + AppThemeData.ecommerce300, + ), child: InkWell( onTap: () async { - (await Get.to(const CartScreen())); + (await Get.to( + const CartScreen(), + )); controller.getCartData(); }, child: ClipOval( @@ -269,15 +443,37 @@ class HomeScreen extends StatelessWidget { height: 42, decoration: ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide(width: 1, color: isDark ? AppThemeData.grey700 : AppThemeData.grey200), - borderRadius: BorderRadius.circular(120), + side: BorderSide( + width: 1, + color: + isDark + ? AppThemeData + .grey700 + : AppThemeData + .grey200, + ), + borderRadius: + BorderRadius.circular( + 120, + ), ), ), child: Padding( - padding: const EdgeInsets.all(8.0), + padding: + const EdgeInsets.all( + 8.0, + ), child: SvgPicture.asset( "assets/icons/ic_shoping_cart.svg", - colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey50 : AppThemeData.grey900, BlendMode.srcIn), + colorFilter: + ColorFilter.mode( + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey900, + BlendMode.srcIn, + ), ), ), ), @@ -287,106 +483,287 @@ class HomeScreen extends StatelessWidget { ), ], ), - const SizedBox(height: 10), + SizedBox(height: 25.h), InkWell( onTap: () { - Get.to(const SearchScreen(), arguments: {"vendorList": controller.allNearestRestaurant}); + Get.to( + const SearchScreen(), + arguments: { + "vendorList": + controller + .allNearestRestaurant, + }, + ); }, + // child: Container( + // height: 48.h, + // decoration: BoxDecoration( + // color: AppThemeData.cardColor, + // borderRadius: + // BorderRadius.circular(10.r), + // ), + // ), child: TextFieldWidget( + hintColor: AppThemeData.darkGrey, hintText: - Constant.sectionConstantModel?.name?.toLowerCase().contains('restaurants') == true - ? 'Search the restaurant, food and more...'.tr - : 'Search the store, item and more...'.tr, + Constant + .sectionConstantModel + ?.name + ?.toLowerCase() + .contains( + 'restaurants', + ) == + true + ? 'Искать что угодно' + : 'Search the store, item and more...' + .tr, controller: null, enable: false, - prefix: Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: SvgPicture.asset("assets/icons/ic_search.svg")), + backgroundColor: + AppThemeData.cardColor, + prefix: Padding( + padding: EdgeInsets.only( + left: 16.r, + right: 8.r, + ), + child: Icon( + Icons.search, + size: 24.r, + color: AppThemeData.darkGrey, + ), + ), ), ), - const SizedBox(height: 5), + SizedBox(height: 15.h), ], ), ), Expanded( child: SingleChildScrollView( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - controller.storyList.isEmpty || Constant.storyEnable == false - ? const SizedBox() - : Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: StoryView(controller: controller)), - SizedBox(height: controller.storyList.isEmpty ? 0 : 20), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - titleView(isDark, "Explore the Categories", () { - Get.to(const ViewAllCategoryScreen()); - }), - const SizedBox(height: 10), - CategoryView(controller: controller), - ], - ), + // controller.storyList.isEmpty || + // Constant.storyEnable == false + // ? const SizedBox() + // : Padding( + // padding: + // const EdgeInsets.symmetric( + // horizontal: 16, + // ), + // child: StoryView( + // controller: controller, + // ), + // ), + // SizedBox( + // height: + // controller.storyList.isEmpty + // ? 0 + // : 25.h, + // ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // titleView(isDark, "Explore the Categories", () { + // Get.to(const ViewAllCategoryScreen()); + // }), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 16.r, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Text( + "Категории", + style: + AppThemeData.boldTextStyle( + color: + AppThemeData + .darkGrey, + fontSize: 18.sp, + ), + ), + InkWell( + onTap: () { + Get.to( + const ViewAllCategoryScreen(), + ); + }, + child: Text( + "Все", + style: + AppThemeData.mediumTextStyle( + fontSize: 14.sp, + color: + AppThemeData + .mainColor, + ), + ), + ), + ], + ), + ), + const SizedBox(height: 10), + CategoryView( + controller: controller, + ), + ], ), const SizedBox(height: 32), - controller.bannerModel.isEmpty ? const SizedBox() : Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: BannerView(controller: controller)), - controller.couponRestaurantList.isEmpty + controller.bannerModel.isEmpty ? const SizedBox() : Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + padding: + const EdgeInsets.symmetric( + horizontal: 16, + ), + child: BannerView( + controller: controller, + ), + ), + controller + .couponRestaurantList + .isEmpty + ? const SizedBox() + : Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16, + ), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - titleView(isDark, "Largest Discounts", () { - Get.to( - const DiscountRestaurantListScreen(), - arguments: {"vendorList": controller.couponRestaurantList, "couponList": controller.couponList, "title": "Discounts Restaurants"}, - ); - }), + titleView( + isDark, + "Largest Discounts", + () { + Get.to( + const DiscountRestaurantListScreen(), + arguments: { + "vendorList": + controller + .couponRestaurantList, + "couponList": + controller + .couponList, + "title": + "Discounts Restaurants", + }, + ); + }, + ), const SizedBox(height: 16), - OfferView(controller: controller), + OfferView( + controller: controller, + ), ], ), ), const SizedBox(height: 28), - controller.newArrivalRestaurantList.isEmpty + controller + .newArrivalRestaurantList + .isEmpty ? const SizedBox() : Container( - decoration: const BoxDecoration(image: DecorationImage(image: AssetImage("assets/images/ic_new_arrival_bg.png"), fit: BoxFit.cover)), + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/ic_new_arrival_bg.png", + ), + fit: BoxFit.cover, + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: + const EdgeInsets.symmetric( + horizontal: 16, + vertical: 16, + ), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ Row( children: [ Expanded( child: Text( "New Arrivals".tr, - textAlign: TextAlign.start, - style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + textAlign: + TextAlign + .start, + style: TextStyle( + fontFamily: + AppThemeData + .semiBold, + fontSize: 16, + color: + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey50, + ), ), ), InkWell( onTap: () { - Get.to(const RestaurantListScreen(), arguments: {"vendorList": controller.newArrivalRestaurantList, "title": "New Arrival"})?.then((v) { - controller.getFavouriteRestaurant(); + Get.to( + const RestaurantListScreen(), + arguments: { + "vendorList": + controller + .newArrivalRestaurantList, + "title": + "New Arrival", + }, + )?.then((v) { + controller + .getFavouriteRestaurant(); }); }, child: Text( "View all".tr, - textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), + textAlign: + TextAlign + .center, + style: TextStyle( + fontFamily: + AppThemeData + .regular, + color: + isDark + ? AppThemeData + .primary300 + : AppThemeData + .primary300, + ), ), ), ], ), - const SizedBox(height: 16), - NewArrival(controller: controller), + const SizedBox( + height: 16, + ), + NewArrival( + controller: controller, + ), ], ), ), @@ -394,54 +771,136 @@ class HomeScreen extends StatelessWidget { const SizedBox(height: 20), controller.bannerBottomModel.isEmpty ? const SizedBox() - : Padding(padding: const EdgeInsets.symmetric(horizontal: 16), child: BannerBottomView(controller: controller)), - Visibility(visible: (Constant.isEnableAdsFeature == true && controller.advertisementList.isNotEmpty), child: const SizedBox(height: 20)), + : Padding( + padding: + const EdgeInsets.symmetric( + horizontal: 16, + ), + child: BannerBottomView( + controller: controller, + ), + ), Visibility( - visible: Constant.isEnableAdsFeature == true, + visible: + (Constant.isEnableAdsFeature == + true && + controller + .advertisementList + .isNotEmpty), + child: const SizedBox(height: 20), + ), + Visibility( + visible: + Constant.isEnableAdsFeature == + true, child: - controller.advertisementList.isEmpty + controller + .advertisementList + .isEmpty ? const SizedBox() : Container( - color: AppThemeData.primary300.withAlpha(40), + color: AppThemeData + .primary300 + .withAlpha(40), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: + const EdgeInsets.symmetric( + horizontal: 16, + vertical: 16, + ), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ Row( children: [ Expanded( child: Text( - "Highlights for you".tr, - textAlign: TextAlign.start, - style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + "Highlights for you" + .tr, + textAlign: + TextAlign + .start, + style: TextStyle( + fontFamily: + AppThemeData + .semiBold, + fontSize: + 16, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), ), ), InkWell( onTap: () { - Get.to(AllAdvertisementScreen())?.then((value) { - controller.getFavouriteRestaurant(); + Get.to( + AllAdvertisementScreen(), + )?.then(( + value, + ) { + controller + .getFavouriteRestaurant(); }); }, child: Text( - "View all".tr, - textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), + "View all" + .tr, + textAlign: + TextAlign + .center, + style: TextStyle( + fontFamily: + AppThemeData + .regular, + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + ), ), ), ], ), - const SizedBox(height: 16), + const SizedBox( + height: 16, + ), SizedBox( height: 220, child: ListView.builder( - physics: const BouncingScrollPhysics(), - scrollDirection: Axis.horizontal, - itemCount: controller.advertisementList.length >= 10 ? 10 : controller.advertisementList.length, - padding: EdgeInsets.all(0), - itemBuilder: (BuildContext context, int index) { - return AdvertisementHomeCard(controller: controller, model: controller.advertisementList[index]); + physics: + const BouncingScrollPhysics(), + scrollDirection: + Axis.horizontal, + itemCount: + controller.advertisementList.length >= + 10 + ? 10 + : controller + .advertisementList + .length, + padding: + EdgeInsets.all( + 0, + ), + itemBuilder: ( + BuildContext + context, + int index, + ) { + return AdvertisementHomeCard( + controller: + controller, + model: + controller + .advertisementList[index], + ); }, ), ), @@ -452,32 +911,77 @@ class HomeScreen extends StatelessWidget { ), const SizedBox(height: 20), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric( + horizontal: 16, + ), child: Container( decoration: ShapeDecoration( - color: isDark ? AppThemeData.grey700 : AppThemeData.grey200, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData.grey700 + : AppThemeData.grey200, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), ), child: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all( + 8.0, + ), child: Row( children: [ Expanded( child: InkWell( onTap: () { - controller.isPopular.value = true; + controller + .isPopular + .value = true; }, child: Container( decoration: - controller.isPopular.value == false + controller + .isPopular + .value == + false ? null - : ShapeDecoration(color: AppThemeData.grey900, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + : ShapeDecoration( + color: + AppThemeData + .grey900, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + padding: + const EdgeInsets.symmetric( + horizontal: + 16, + vertical: 10, + ), child: Text( - "Popular Stores".tr, - textAlign: TextAlign.center, - style: TextStyle(fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), + "Popular Stores" + .tr, + textAlign: + TextAlign + .center, + style: TextStyle( + fontFamily: + AppThemeData + .semiBold, + color: + isDark + ? AppThemeData + .primary300 + : AppThemeData + .primary300, + ), ), ), ), @@ -486,28 +990,55 @@ class HomeScreen extends StatelessWidget { Expanded( child: InkWell( onTap: () { - controller.isPopular.value = false; + controller + .isPopular + .value = false; }, child: Container( decoration: - controller.isPopular.value == true + controller + .isPopular + .value == + true ? null - : ShapeDecoration(color: AppThemeData.grey900, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + : ShapeDecoration( + color: + AppThemeData + .grey900, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + padding: + const EdgeInsets.symmetric( + horizontal: + 16, + vertical: 10, + ), child: Text( "All Stores".tr, - textAlign: TextAlign.center, + textAlign: + TextAlign + .center, style: TextStyle( - fontFamily: AppThemeData.semiBold, + fontFamily: + AppThemeData + .semiBold, color: - controller.isPopular.value == true + controller.isPopular.value == + true ? isDark ? AppThemeData.grey400 : AppThemeData.grey500 : isDark - ? AppThemeData.primary300 - : AppThemeData.primary300, + ? AppThemeData + .primary300 + : AppThemeData + .primary300, ), ), ), @@ -520,8 +1051,18 @@ class HomeScreen extends StatelessWidget { ), ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20), - child: controller.isPopular.value ? PopularRestaurant(controller: controller) : AllRestaurant(controller: controller), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 20, + ), + child: + controller.isPopular.value + ? PopularRestaurant( + controller: controller, + ) + : AllRestaurant( + controller: controller, + ), ), // controller.isPopular.value // ? PopularRestaurant( @@ -538,18 +1079,29 @@ class HomeScreen extends StatelessWidget { ), ), ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButtonLocation: + FloatingActionButtonLocation.centerFloat, floatingActionButton: Container( - decoration: BoxDecoration(color: isDark ? AppThemeData.grey800 : AppThemeData.grey100, borderRadius: const BorderRadius.all(Radius.circular(30))), + decoration: BoxDecoration( + color: isDark ? AppThemeData.grey800 : AppThemeData.grey100, + borderRadius: const BorderRadius.all(Radius.circular(30)), + ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), child: Row( mainAxisSize: MainAxisSize.min, children: [ Container( - decoration: BoxDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, borderRadius: const BorderRadius.all(Radius.circular(30))), + decoration: BoxDecoration( + color: + isDark ? AppThemeData.grey900 : AppThemeData.grey50, + borderRadius: const BorderRadius.all(Radius.circular(30)), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), child: Row( children: [ InkWell( @@ -558,12 +1110,22 @@ class HomeScreen extends StatelessWidget { }, child: ClipOval( child: Container( - decoration: BoxDecoration(color: controller.isListView.value ? AppThemeData.primary300 : null), + decoration: BoxDecoration( + color: + controller.isListView.value + ? AppThemeData.primary300 + : null, + ), child: Padding( padding: const EdgeInsets.all(8.0), child: SvgPicture.asset( "assets/icons/ic_view_grid_list.svg", - colorFilter: ColorFilter.mode(controller.isListView.value ? AppThemeData.grey50 : AppThemeData.grey500, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + controller.isListView.value + ? AppThemeData.grey50 + : AppThemeData.grey500, + BlendMode.srcIn, + ), ), ), ), @@ -577,12 +1139,22 @@ class HomeScreen extends StatelessWidget { }, child: ClipOval( child: Container( - decoration: BoxDecoration(color: controller.isListView.value == false ? AppThemeData.primary300 : null), + decoration: BoxDecoration( + color: + controller.isListView.value == false + ? AppThemeData.primary300 + : null, + ), child: Padding( padding: const EdgeInsets.all(8.0), child: SvgPicture.asset( "assets/icons/ic_map_draw.svg", - colorFilter: ColorFilter.mode(controller.isListView.value == false ? AppThemeData.grey50 : AppThemeData.grey500, BlendMode.srcIn), + colorFilter: ColorFilter.mode( + controller.isListView.value == false + ? AppThemeData.grey50 + : AppThemeData.grey500, + BlendMode.srcIn, + ), ), ), ), @@ -599,10 +1171,23 @@ class HomeScreen extends StatelessWidget { }, child: ClipOval( child: Container( - decoration: BoxDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50), + decoration: BoxDecoration( + color: + isDark + ? AppThemeData.grey900 + : AppThemeData.grey50, + ), child: Padding( padding: const EdgeInsets.all(10), - child: SvgPicture.asset("assets/icons/ic_scan_code.svg", colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey400 : AppThemeData.grey500, BlendMode.srcIn)), + child: SvgPicture.asset( + "assets/icons/ic_scan_code.svg", + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey400 + : AppThemeData.grey500, + BlendMode.srcIn, + ), + ), ), ), ), @@ -610,24 +1195,46 @@ class HomeScreen extends StatelessWidget { const SizedBox(width: 14), Theme( data: Theme.of(context).copyWith( - canvasColor: isDark ? AppThemeData.greyDark100 : AppThemeData.grey100, // background when dropdown opens + canvasColor: + isDark + ? AppThemeData.greyDark100 + : AppThemeData + .grey100, // background when dropdown opens ), child: DropdownButton( isDense: false, underline: const SizedBox(), - dropdownColor: isDark ? AppThemeData.greyDark100 : AppThemeData.grey100, + dropdownColor: + isDark + ? AppThemeData.greyDark100 + : AppThemeData.grey100, value: controller.selectedOrderTypeValue.value.tr, icon: const Icon(Icons.keyboard_arrow_down), items: - ['Delivery'.tr, 'TakeAway'.tr].map((String value) { + ['Delivery'.tr, 'TakeAway'.tr].map(( + String value, + ) { return DropdownMenuItem( value: value, - child: Text(value.tr, style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)), + child: Text( + value.tr, + style: TextStyle( + fontFamily: AppThemeData.semiBold, + fontSize: 16, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), + ), ); }).toList(), onChanged: (value) async { if (cartItem.isEmpty) { - await Preferences.setString(Preferences.foodDeliveryType, value!); + await Preferences.setString( + Preferences.foodDeliveryType, + value!, + ); controller.selectedOrderTypeValue.value = value; controller.getData(); } else { @@ -636,14 +1243,21 @@ class HomeScreen extends StatelessWidget { builder: (BuildContext context) { return CustomDialogBox( title: "Alert".tr, - descriptions: "Do you really want to change the delivery option? Your cart will be empty.".tr, + descriptions: + "Do you really want to change the delivery option? Your cart will be empty." + .tr, positiveString: "Ok".tr, negativeString: "Cancel".tr, positiveClick: () async { - await Preferences.setString(Preferences.foodDeliveryType, value!); - controller.selectedOrderTypeValue.value = value; + await Preferences.setString( + Preferences.foodDeliveryType, + value!, + ); + controller.selectedOrderTypeValue.value = + value; controller.getData(); - DatabaseHelper.instance.deleteAllCartProducts(); + DatabaseHelper.instance + .deleteAllCartProducts(); controller.cartProvider.clearDatabase(); controller.getCartData(); Get.back(); @@ -671,12 +1285,28 @@ class HomeScreen extends StatelessWidget { Row titleView(isDark, String name, Function()? onPress) { return Row( children: [ - Expanded(child: Text(name.tr, textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.bold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900))), + Expanded( + child: Text( + name.tr, + textAlign: TextAlign.start, + style: TextStyle( + fontFamily: AppThemeData.bold, + color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, + ), + ), + ), InkWell( onTap: () { onPress!(); }, - child: Text("View all".tr, textAlign: TextAlign.center, style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300)), + child: Text( + "View all".tr, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: AppThemeData.regular, + color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, + ), + ), ), ], ); @@ -702,21 +1332,37 @@ class PopularRestaurant extends StatelessWidget { VendorModel vendorModel = controller.popularRestaurantList[index]; return InkWell( onTap: () { - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel})?.then((v) { + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + )?.then((v) { controller.getFavouriteRestaurant(); }); }, child: Padding( - padding: EdgeInsets.only(bottom: controller.popularRestaurantList.length - 1 == index ? 60 : 20), + padding: EdgeInsets.only( + bottom: + controller.popularRestaurantList.length - 1 == index + ? 60 + : 20, + ), child: Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))), + decoration: ShapeDecoration( + color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), child: Stack( children: [ RestaurantImageView(vendorModel: vendorModel), @@ -724,7 +1370,14 @@ class PopularRestaurant extends StatelessWidget { height: Responsive.height(20, context), width: Responsive.width(100, context), decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), const Color(0xFF111827)]), + gradient: LinearGradient( + begin: const Alignment(-0.00, -1.00), + end: const Alignment(0, 1), + colors: [ + Colors.black.withOpacity(0), + const Color(0xFF111827), + ], + ), ), ), @@ -733,21 +1386,55 @@ class PopularRestaurant extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -755,26 +1442,46 @@ class PopularRestaurant extends StatelessWidget { ), ), Transform.translate( - offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)), + offset: Offset( + Responsive.width(-3, context), + Responsive.height(17.5, context), + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Visibility( - visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true), + visible: + (vendorModel.isSelfDelivery == true && + Constant.isSelfDeliveryFeature == true), child: Row( children: [ Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), decoration: BoxDecoration( color: AppThemeData.success300, - borderRadius: BorderRadius.circular(120), // Optional + borderRadius: BorderRadius.circular( + 120, + ), // Optional ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_free_delivery.svg"), + SvgPicture.asset( + "assets/icons/ic_free_delivery.svg", + ), const SizedBox(width: 5), - Text("Free Delivery".tr, style: TextStyle(fontSize: 14, color: AppThemeData.carRent600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600)), + Text( + "Free Delivery".tr, + style: TextStyle( + fontSize: 14, + color: AppThemeData.carRent600, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), + ), ], ), ), @@ -783,35 +1490,77 @@ class PopularRestaurant extends StatelessWidget { ), ), Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", - style: TextStyle(fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 14, + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), ), const SizedBox(width: 6), Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), decoration: ShapeDecoration( - color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData.ecommerce600 + : AppThemeData.ecommerce50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + colorFilter: ColorFilter.mode( + AppThemeData.ecommerce300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", style: TextStyle( fontSize: 14, - color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300, + color: + isDark + ? AppThemeData.ecommerce300 + : AppThemeData.ecommerce300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600, ), @@ -834,13 +1583,29 @@ class PopularRestaurant extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 18, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + style: TextStyle( + fontSize: 18, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), ), Text( vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -875,21 +1640,35 @@ class AllRestaurant extends StatelessWidget { VendorModel vendorModel = controller.allNearestRestaurant[index]; return InkWell( onTap: () { - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel})?.then((v) { + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + )?.then((v) { controller.getFavouriteRestaurant(); }); }, child: Padding( - padding: EdgeInsets.only(bottom: controller.allNearestRestaurant.length - 1 == index ? 60 : 20), + padding: EdgeInsets.only( + bottom: + controller.allNearestRestaurant.length - 1 == index ? 60 : 20, + ), child: Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))), + decoration: ShapeDecoration( + color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(16), + topRight: Radius.circular(16), + ), child: Stack( children: [ RestaurantImageView(vendorModel: vendorModel), @@ -897,7 +1676,14 @@ class AllRestaurant extends StatelessWidget { height: Responsive.height(20, context), width: Responsive.width(100, context), decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), const Color(0xFF111827)]), + gradient: LinearGradient( + begin: const Alignment(-0.00, -1.00), + end: const Alignment(0, 1), + colors: [ + Colors.black.withOpacity(0), + const Color(0xFF111827), + ], + ), ), ), Positioned( @@ -905,21 +1691,55 @@ class AllRestaurant extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -927,26 +1747,46 @@ class AllRestaurant extends StatelessWidget { ), ), Transform.translate( - offset: Offset(Responsive.width(-3, context), Responsive.height(17.5, context)), + offset: Offset( + Responsive.width(-3, context), + Responsive.height(17.5, context), + ), child: Row( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Visibility( - visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true), + visible: + (vendorModel.isSelfDelivery == true && + Constant.isSelfDeliveryFeature == true), child: Row( children: [ Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), decoration: BoxDecoration( color: AppThemeData.carRent300, - borderRadius: BorderRadius.circular(120), // Optional + borderRadius: BorderRadius.circular( + 120, + ), // Optional ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_free_delivery.svg"), + SvgPicture.asset( + "assets/icons/ic_free_delivery.svg", + ), const SizedBox(width: 5), - Text("Free Delivery".tr, style: TextStyle(fontSize: 14, color: AppThemeData.carRent600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600)), + Text( + "Free Delivery".tr, + style: TextStyle( + fontSize: 14, + color: AppThemeData.carRent600, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), + ), ], ), ), @@ -955,35 +1795,77 @@ class AllRestaurant extends StatelessWidget { ), ), Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", - style: TextStyle(fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 14, + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), ), const SizedBox(width: 6), Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 7, + ), decoration: ShapeDecoration( - color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData.ecommerce600 + : AppThemeData.ecommerce50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + colorFilter: ColorFilter.mode( + AppThemeData.ecommerce300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 5), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", style: TextStyle( fontSize: 14, - color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300, + color: + isDark + ? AppThemeData.ecommerce300 + : AppThemeData.ecommerce300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600, ), @@ -1006,13 +1888,29 @@ class AllRestaurant extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 18, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + style: TextStyle( + fontSize: 18, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + ), ), Text( vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -1042,12 +1940,18 @@ class NewArrival extends StatelessWidget { child: ListView.builder( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, - itemCount: controller.newArrivalRestaurantList.length >= 10 ? 10 : controller.newArrivalRestaurantList.length, + itemCount: + controller.newArrivalRestaurantList.length >= 10 + ? 10 + : controller.newArrivalRestaurantList.length, itemBuilder: (BuildContext context, int index) { VendorModel vendorModel = controller.newArrivalRestaurantList[index]; return InkWell( onTap: () { - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel})?.then((v) { + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + )?.then((v) { controller.getFavouriteRestaurant(); }); }, @@ -1060,13 +1964,27 @@ class NewArrival extends StatelessWidget { children: [ Expanded( child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(10)), + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), child: Stack( children: [ - NetworkImageWidget(imageUrl: vendorModel.photo.toString(), fit: BoxFit.cover, height: Responsive.height(100, context), width: Responsive.width(100, context)), + NetworkImageWidget( + imageUrl: vendorModel.photo.toString(), + fit: BoxFit.cover, + height: Responsive.height(100, context), + width: Responsive.width(100, context), + ), Container( decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(0.00, 1.00), end: const Alignment(0, -1), colors: [Colors.black.withOpacity(0), AppThemeData.grey900]), + gradient: LinearGradient( + begin: const Alignment(0.00, 1.00), + end: const Alignment(0, -1), + colors: [ + Colors.black.withOpacity(0), + AppThemeData.grey900, + ], + ), ), ), Positioned( @@ -1074,21 +1992,55 @@ class NewArrival extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where( + (p0) => + p0.restaurantId == vendorModel.id, + ) + .isNotEmpty) { + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => + item.restaurantId == vendorModel.id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel favouriteModel = + FavouriteModel( + restaurantId: vendorModel.id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -1101,17 +2053,27 @@ class NewArrival extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 16, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + style: TextStyle( + fontSize: 16, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark ? AppThemeData.grey50 : AppThemeData.grey50, + ), ), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ Visibility( - visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true), + visible: + (vendorModel.isSelfDelivery == true && + Constant.isSelfDeliveryFeature == true), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_free_delivery.svg"), + SvgPicture.asset( + "assets/icons/ic_free_delivery.svg", + ), const SizedBox(width: 4), Text( "Free Delivery".tr, @@ -1121,7 +2083,10 @@ class NewArrival extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, ), ), const SizedBox(width: 8), @@ -1130,7 +2095,13 @@ class NewArrival extends StatelessWidget { ), Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 4), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", @@ -1140,7 +2111,10 @@ class NewArrival extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, ), ), ], @@ -1148,7 +2122,9 @@ class NewArrival extends StatelessWidget { const SizedBox(width: 8), Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg"), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + ), const SizedBox(width: 4), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", @@ -1158,7 +2134,10 @@ class NewArrival extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, ), ), ], @@ -1170,7 +2149,15 @@ class NewArrival extends StatelessWidget { vendorModel.location.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, color: isDark ? AppThemeData.grey400 : AppThemeData.grey400), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.medium, + fontWeight: FontWeight.w500, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey400, + ), ), ], ), @@ -1187,7 +2174,11 @@ class AdvertisementHomeCard extends StatelessWidget { final AdvertisementModel model; final FoodHomeController controller; - const AdvertisementHomeCard({super.key, required this.controller, required this.model}); + const AdvertisementHomeCard({ + super.key, + required this.controller, + required this.model, + }); @override Widget build(BuildContext context) { @@ -1196,9 +2187,14 @@ class AdvertisementHomeCard extends StatelessWidget { return InkWell( onTap: () async { ShowToastDialog.showLoader("Please wait...".tr); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(model.vendorId!); + VendorModel? vendorModel = await FireStoreUtils.getVendorById( + model.vendorId!, + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); }, child: Container( margin: EdgeInsets.only(right: 16), @@ -1206,7 +2202,14 @@ class AdvertisementHomeCard extends StatelessWidget { decoration: BoxDecoration( color: isDark ? AppThemeData.info600 : AppThemeData.surface, borderRadius: BorderRadius.circular(16), - boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.1), blurRadius: isDark ? 6 : 2, spreadRadius: 0, offset: Offset(0, isDark ? 3 : 1))], + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.1), + blurRadius: isDark ? 6 : 2, + spreadRadius: 0, + offset: Offset(0, isDark ? 3 : 1), + ), + ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -1215,18 +2218,32 @@ class AdvertisementHomeCard extends StatelessWidget { children: [ model.type == 'restaurant_promotion' ? ClipRRect( - borderRadius: BorderRadius.vertical(top: Radius.circular(16)), - child: NetworkImageWidget(imageUrl: model.coverImage ?? '', height: 135, width: double.infinity, fit: BoxFit.cover), + borderRadius: BorderRadius.vertical( + top: Radius.circular(16), + ), + child: NetworkImageWidget( + imageUrl: model.coverImage ?? '', + height: 135, + width: double.infinity, + fit: BoxFit.cover, + ), ) - : VideoAdvWidget(url: model.video ?? '', height: 135, width: double.infinity), - if (model.type != 'video_promotion' && model.vendorId != null && (model.showRating == true || model.showReview == true)) + : VideoAdvWidget( + url: model.video ?? '', + height: 135, + width: double.infinity, + ), + if (model.type != 'video_promotion' && + model.vendorId != null && + (model.showRating == true || model.showReview == true)) Positioned( bottom: 8, right: 8, child: FutureBuilder( future: FireStoreUtils.getVendorById(model.vendorId!), builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { + if (snapshot.connectionState == + ConnectionState.waiting) { return const SizedBox(); } else { if (snapshot.hasError) { @@ -1236,16 +2253,43 @@ class AdvertisementHomeCard extends StatelessWidget { } else { VendorModel vendorModel = snapshot.data!; return Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120))), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(120), + ), + ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - if (model.showRating == true) SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), - if (model.showRating == true) const SizedBox(width: 5), + if (model.showRating == true) + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), + if (model.showRating == true) + const SizedBox(width: 5), Text( "${model.showRating == true ? Constant.calculateReview(reviewCount: vendorModel.reviewsCount!.toStringAsFixed(0), reviewSum: vendorModel.reviewsSum.toString()) : ''} ${model.showReview == true ? '(${vendorModel.reviewsCount!.toStringAsFixed(0)})' : ''}", - style: TextStyle(fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 14, + color: + isDark + ? AppThemeData.primary300 + : AppThemeData.primary300, + fontFamily: AppThemeData.semiBold, + fontWeight: FontWeight.w600, + ), ), ], ), @@ -1264,7 +2308,15 @@ class AdvertisementHomeCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (model.type == 'restaurant_promotion') - ClipRRect(borderRadius: BorderRadius.circular(30), child: NetworkImageWidget(imageUrl: model.profileImage ?? '', height: 50, width: 50, fit: BoxFit.cover)), + ClipRRect( + borderRadius: BorderRadius.circular(30), + child: NetworkImageWidget( + imageUrl: model.profileImage ?? '', + height: 50, + width: 50, + fit: BoxFit.cover, + ), + ), SizedBox(width: 8), Expanded( child: Column( @@ -1272,12 +2324,26 @@ class AdvertisementHomeCard extends StatelessWidget { children: [ Text( model.title ?? '', - style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 14, fontWeight: FontWeight.bold), + style: TextStyle( + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey900, + fontSize: 14, + fontWeight: FontWeight.bold, + ), overflow: TextOverflow.ellipsis, ), Text( model.description ?? '', - style: TextStyle(fontSize: 12, fontFamily: AppThemeData.medium, color: isDark ? AppThemeData.grey400 : AppThemeData.grey600), + style: TextStyle( + fontSize: 12, + fontFamily: AppThemeData.medium, + color: + isDark + ? AppThemeData.grey400 + : AppThemeData.grey600, + ), overflow: TextOverflow.ellipsis, maxLines: 2, ), @@ -1288,26 +2354,73 @@ class AdvertisementHomeCard extends StatelessWidget { ? IconButton( icon: Obx( () => - controller.favouriteList.where((p0) => p0.restaurantId == model.vendorId).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg", colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey400 : AppThemeData.grey600, BlendMode.srcIn)), + controller.favouriteList + .where( + (p0) => + p0.restaurantId == model.vendorId, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + colorFilter: ColorFilter.mode( + isDark + ? AppThemeData.grey400 + : AppThemeData.grey600, + BlendMode.srcIn, + ), + ), ), onPressed: () async { - if (controller.favouriteList.where((p0) => p0.restaurantId == model.vendorId).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: model.vendorId, userId: FireStoreUtils.getCurrentUid()); - controller.favouriteList.removeWhere((item) => item.restaurantId == model.vendorId); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller.favouriteList + .where((p0) => p0.restaurantId == model.vendorId) + .isNotEmpty) { + FavouriteModel favouriteModel = FavouriteModel( + restaurantId: model.vendorId, + userId: FireStoreUtils.getCurrentUid(), + ); + controller.favouriteList.removeWhere( + (item) => item.restaurantId == model.vendorId, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: model.vendorId, userId: FireStoreUtils.getCurrentUid()); + FavouriteModel favouriteModel = FavouriteModel( + restaurantId: model.vendorId, + userId: FireStoreUtils.getCurrentUid(), + ); controller.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } controller.update(); }, ) : Container( - decoration: ShapeDecoration(color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5))), - child: Padding(padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), child: Icon(Icons.arrow_forward, size: 20, color: AppThemeData.primary300)), + decoration: ShapeDecoration( + color: + isDark + ? AppThemeData.primary600 + : AppThemeData.primary50, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5), + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 4, + ), + child: Icon( + Icons.arrow_forward, + size: 20, + color: AppThemeData.primary300, + ), + ), ), ], ), @@ -1333,13 +2446,19 @@ class OfferView extends StatelessWidget { child: ListView.builder( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, - itemCount: controller.couponRestaurantList.length >= 15 ? 15 : controller.couponRestaurantList.length, + itemCount: + controller.couponRestaurantList.length >= 15 + ? 15 + : controller.couponRestaurantList.length, itemBuilder: (BuildContext context, int index) { VendorModel vendorModel = controller.couponRestaurantList[index]; CouponModel offerModel = controller.couponList[index]; return InkWell( onTap: () { - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); }, child: Padding( padding: const EdgeInsets.only(right: 10), @@ -1350,13 +2469,27 @@ class OfferView extends StatelessWidget { children: [ Expanded( child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(10)), + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), child: Stack( children: [ - NetworkImageWidget(imageUrl: vendorModel.photo.toString(), fit: BoxFit.cover, height: Responsive.height(100, context), width: Responsive.width(100, context)), + NetworkImageWidget( + imageUrl: vendorModel.photo.toString(), + fit: BoxFit.cover, + height: Responsive.height(100, context), + width: Responsive.width(100, context), + ), Container( decoration: BoxDecoration( - gradient: LinearGradient(begin: const Alignment(-0.00, -1.00), end: const Alignment(0, 1), colors: [Colors.black.withOpacity(0), AppThemeData.grey900]), + gradient: LinearGradient( + begin: const Alignment(-0.00, -1.00), + end: const Alignment(0, 1), + colors: [ + Colors.black.withOpacity(0), + AppThemeData.grey900, + ], + ), ), ), Positioned( @@ -1374,14 +2507,24 @@ class OfferView extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.regular, fontWeight: FontWeight.w900, - color: isDark ? AppThemeData.grey50 : AppThemeData.grey50, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey50, ), ), Text( "${offerModel.discountType == "Fix Price" ? Constant.currencyModel!.symbol : ""}${offerModel.discount}${offerModel.discountType == "Percentage" ? "% off".tr : "off".tr}", textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey50), + style: TextStyle( + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark + ? AppThemeData.grey50 + : AppThemeData.grey50, + ), ), ], ), @@ -1395,19 +2538,29 @@ class OfferView extends StatelessWidget { vendorModel.title.toString(), textAlign: TextAlign.start, maxLines: 1, - style: TextStyle(fontSize: 16, overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900), + style: TextStyle( + fontSize: 16, + overflow: TextOverflow.ellipsis, + fontFamily: AppThemeData.semiBold, + color: + isDark ? AppThemeData.grey50 : AppThemeData.grey900, + ), ), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ Visibility( - visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true), + visible: + (vendorModel.isSelfDelivery == true && + Constant.isSelfDeliveryFeature == true), child: Row( children: [ Row( children: [ - SvgPicture.asset("assets/icons/ic_free_delivery.svg"), + SvgPicture.asset( + "assets/icons/ic_free_delivery.svg", + ), const SizedBox(width: 5), Text( "Free Delivery".tr, @@ -1416,7 +2569,10 @@ class OfferView extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, + color: + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, ), ), ], @@ -1427,7 +2583,13 @@ class OfferView extends StatelessWidget { ), Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: ColorFilter.mode( + AppThemeData.primary300, + BlendMode.srcIn, + ), + ), const SizedBox(width: 10), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", @@ -1438,7 +2600,10 @@ class OfferView extends StatelessWidget { overflow: TextOverflow.ellipsis, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, + color: + isDark + ? AppThemeData.grey300 + : AppThemeData.grey600, ), ), ], @@ -1485,17 +2650,32 @@ class BannerView extends StatelessWidget { onTap: () async { if (bannerModel.redirect_type == "store") { ShowToastDialog.showLoader("Please wait...".tr); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(bannerModel.redirect_id.toString()); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + bannerModel.redirect_id.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "product") { ShowToastDialog.showLoader("Please wait...".tr); - ProductModel? productModel = await FireStoreUtils.getProductById(bannerModel.redirect_id.toString()); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(productModel!.vendorID.toString()); + ProductModel? productModel = + await FireStoreUtils.getProductById( + bannerModel.redirect_id.toString(), + ); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + productModel!.vendorID.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "external_link") { final uri = Uri.parse(bannerModel.redirect_id.toString()); if (await canLaunchUrl(uri)) { @@ -1507,7 +2687,13 @@ class BannerView extends StatelessWidget { }, child: Padding( padding: const EdgeInsets.only(right: 14), - child: ClipRRect(borderRadius: const BorderRadius.all(Radius.circular(12)), child: NetworkImageWidget(imageUrl: bannerModel.photo.toString(), fit: BoxFit.cover)), + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(12)), + child: NetworkImageWidget( + imageUrl: bannerModel.photo.toString(), + fit: BoxFit.cover, + ), + ), ), ); }, @@ -1525,7 +2711,13 @@ class BannerView extends StatelessWidget { alignment: Alignment.centerLeft, height: 9, width: 9, - decoration: BoxDecoration(shape: BoxShape.circle, color: controller.currentPage.value == index ? AppThemeData.primary300 : Colors.black12), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + controller.currentPage.value == index + ? AppThemeData.primary300 + : Colors.black12, + ), ), ); }), @@ -1564,17 +2756,32 @@ class BannerBottomView extends StatelessWidget { onTap: () async { if (bannerModel.redirect_type == "store") { ShowToastDialog.showLoader("Please wait...".tr); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(bannerModel.redirect_id.toString()); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + bannerModel.redirect_id.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "product") { ShowToastDialog.showLoader("Please wait...".tr); - ProductModel? productModel = await FireStoreUtils.getProductById(bannerModel.redirect_id.toString()); - VendorModel? vendorModel = await FireStoreUtils.getVendorById(productModel!.vendorID.toString()); + ProductModel? productModel = + await FireStoreUtils.getProductById( + bannerModel.redirect_id.toString(), + ); + VendorModel? vendorModel = + await FireStoreUtils.getVendorById( + productModel!.vendorID.toString(), + ); ShowToastDialog.closeLoader(); - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel}); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + ); } else if (bannerModel.redirect_type == "external_link") { final uri = Uri.parse(bannerModel.redirect_id.toString()); if (await canLaunchUrl(uri)) { @@ -1586,7 +2793,13 @@ class BannerBottomView extends StatelessWidget { }, child: Padding( padding: const EdgeInsets.only(right: 14), - child: ClipRRect(borderRadius: const BorderRadius.all(Radius.circular(12)), child: NetworkImageWidget(imageUrl: bannerModel.photo.toString(), fit: BoxFit.cover)), + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(12)), + child: NetworkImageWidget( + imageUrl: bannerModel.photo.toString(), + fit: BoxFit.cover, + ), + ), ), ); }, @@ -1597,14 +2810,22 @@ class BannerBottomView extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - children: List.generate(controller.bannerBottomModel.length, (index) { + children: List.generate(controller.bannerBottomModel.length, ( + index, + ) { return Obx( () => Container( margin: const EdgeInsets.only(right: 5), alignment: Alignment.centerLeft, height: 9, width: 9, - decoration: BoxDecoration(shape: BoxShape.circle, color: controller.currentBottomPage.value == index ? AppThemeData.primary300 : Colors.black12), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + controller.currentBottomPage.value == index + ? AppThemeData.primary300 + : Colors.black12, + ), ), ); }), @@ -1625,46 +2846,63 @@ class CategoryView extends StatelessWidget { final themeController = Get.find(); final isDark = themeController.isDark.value; return SizedBox( - height: 124, + height: 100.h, child: ListView.builder( scrollDirection: Axis.horizontal, padding: EdgeInsets.zero, itemCount: controller.vendorCategoryModel.length, itemBuilder: (context, index) { - VendorCategoryModel vendorCategoryModel = controller.vendorCategoryModel[index]; + VendorCategoryModel vendorCategoryModel = + controller.vendorCategoryModel[index]; return InkWell( onTap: () { - Get.to(const CategoryRestaurantScreen(), arguments: {"vendorCategoryModel": vendorCategoryModel, "dineIn": false}); + Get.to( + const CategoryRestaurantScreen(), + arguments: { + "vendorCategoryModel": vendorCategoryModel, + "dineIn": false, + }, + ); }, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2), - child: SizedBox( - width: 78, - child: Container( - decoration: ShapeDecoration( - color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, - shape: RoundedRectangleBorder( - side: BorderSide(width: 1, strokeAlign: BorderSide.strokeAlignOutside, color: isDark ? AppThemeData.grey800 : AppThemeData.grey100), - borderRadius: BorderRadius.circular(100), + child: Container( + width: 100.r, + height: 100.r, + margin: + index == 0 + ? EdgeInsets.only(left: 16.r, right: 10.r) + : index == controller.vendorCategoryModel.length - 1 + ? EdgeInsets.only(right: 16.r) + : EdgeInsets.only(right: 10.r), + decoration: BoxDecoration( + color: isDark ? AppThemeData.grey900 : AppThemeData.cardColor, + borderRadius: BorderRadius.circular(12.r), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(10.r), + child: Text( + '${vendorCategoryModel.title}', + textAlign: TextAlign.center, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: AppThemeData.boldTextStyle( + color: AppThemeData.darkGrey, + fontSize: 13.3.sp, + ), ), ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox(width: 60, height: 60, child: ClipOval(child: NetworkImageWidget(imageUrl: vendorCategoryModel.photo.toString(), fit: BoxFit.cover))), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), - child: Text( - '${vendorCategoryModel.title}', - textAlign: TextAlign.center, - maxLines: 1, - style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium), - ), + Expanded( + child: ClipOval( + child: NetworkImageWidget( + imageUrl: vendorCategoryModel.photo.toString(), + fit: BoxFit.cover, ), - ], + ), ), - ), + ], ), ), ); @@ -1693,7 +2931,15 @@ class StoryView extends StatelessWidget { padding: const EdgeInsets.only(right: 10), child: InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) => MoreStories(storyList: controller.storyList, index: index))); + Navigator.of(context).push( + MaterialPageRoute( + builder: + (context) => MoreStories( + storyList: controller.storyList, + index: index, + ), + ), + ); }, child: SizedBox( width: 134, @@ -1701,18 +2947,33 @@ class StoryView extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(10)), child: Stack( children: [ - NetworkImageWidget(imageUrl: storyModel.videoThumbnail.toString(), fit: BoxFit.cover, height: Responsive.height(100, context), width: Responsive.width(100, context)), + NetworkImageWidget( + imageUrl: storyModel.videoThumbnail.toString(), + fit: BoxFit.cover, + height: Responsive.height(100, context), + width: Responsive.width(100, context), + ), Container(color: Colors.black.withOpacity(0.30)), Padding( - padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 5, + vertical: 8, + ), child: FutureBuilder( - future: FireStoreUtils.getVendorById(storyModel.vendorID.toString()), + future: FireStoreUtils.getVendorById( + storyModel.vendorID.toString(), + ), builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { + if (snapshot.connectionState == + ConnectionState.waiting) { return Constant.loader(); } else { if (snapshot.hasError) { - return Center(child: Text('${"Error".tr}: ${snapshot.error}')); + return Center( + child: Text( + '${"Error".tr}: ${snapshot.error}', + ), + ); } else if (snapshot.data == null) { return const SizedBox(); } else { @@ -1721,28 +2982,51 @@ class StoryView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - ClipOval(child: NetworkImageWidget(imageUrl: vendorModel.photo.toString(), width: 30, height: 30, fit: BoxFit.cover)), + ClipOval( + child: NetworkImageWidget( + imageUrl: vendorModel.photo.toString(), + width: 30, + height: 30, + fit: BoxFit.cover, + ), + ), const SizedBox(width: 4), Expanded( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( vendorModel.title.toString(), textAlign: TextAlign.center, maxLines: 1, - style: const TextStyle(color: Colors.white, fontSize: 12, overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w700), + style: const TextStyle( + color: Colors.white, + fontSize: 12, + overflow: TextOverflow.ellipsis, + fontWeight: FontWeight.w700, + ), ), Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg"), + SvgPicture.asset( + "assets/icons/ic_star.svg", + ), const SizedBox(width: 5), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum!.toStringAsFixed(0))} reviews", textAlign: TextAlign.center, maxLines: 1, - style: const TextStyle(color: AppThemeData.warning300, fontSize: 10, overflow: TextOverflow.ellipsis, fontWeight: FontWeight.w700), + style: const TextStyle( + color: + AppThemeData.warning300, + fontSize: 10, + overflow: + TextOverflow.ellipsis, + fontWeight: FontWeight.w700, + ), ), ], ), @@ -1784,11 +3068,18 @@ class MapView extends StatelessWidget { ? flutterMap.FlutterMap( mapController: controller.osmMapController, options: flutterMap.MapOptions( - initialCenter: location.LatLng(Constant.selectedLocation.location!.latitude ?? 0.0, Constant.selectedLocation.location!.longitude ?? 0.0), + initialCenter: location.LatLng( + Constant.selectedLocation.location!.latitude ?? 0.0, + Constant.selectedLocation.location!.longitude ?? 0.0, + ), initialZoom: 10, ), children: [ - flutterMap.TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.emart.app'), + flutterMap.TileLayer( + urlTemplate: + 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.emart.app', + ), flutterMap.MarkerLayer(markers: controller.osmMarker), ], ) @@ -1806,8 +3097,26 @@ class MapView extends StatelessWidget { zoom: 18, target: controller.homeController.allNearestRestaurant.isEmpty - ? LatLng(Constant.selectedLocation.location!.latitude ?? 45.521563, Constant.selectedLocation.location!.longitude ?? -122.677433) - : LatLng(controller.homeController.allNearestRestaurant.first.latitude ?? 45.521563, controller.homeController.allNearestRestaurant.first.longitude ?? -122.677433), + ? LatLng( + Constant.selectedLocation.location!.latitude ?? + 45.521563, + Constant.selectedLocation.location!.longitude ?? + -122.677433, + ) + : LatLng( + controller + .homeController + .allNearestRestaurant + .first + .latitude ?? + 45.521563, + controller + .homeController + .allNearestRestaurant + .first + .longitude ?? + -122.677433, + ), ), ), controller.homeController.allNearestRestaurant.isEmpty @@ -1824,60 +3133,141 @@ class MapView extends StatelessWidget { Expanded( child: PageView.builder( pageSnapping: true, - controller: PageController(viewportFraction: 0.88), + controller: PageController( + viewportFraction: 0.88, + ), onPageChanged: (value) async { if (Constant.selectedMapType == "osm") { controller.osmMapController.move( - location.LatLng(controller.homeController.allNearestRestaurant[value].latitude!, controller.homeController.allNearestRestaurant[value].longitude!), + location.LatLng( + controller + .homeController + .allNearestRestaurant[value] + .latitude!, + controller + .homeController + .allNearestRestaurant[value] + .longitude!, + ), 16, ); } else { - CameraUpdate cameraUpdate = CameraUpdate.newCameraPosition( - CameraPosition( - zoom: 18, - target: LatLng(controller.homeController.allNearestRestaurant[value].latitude!, controller.homeController.allNearestRestaurant[value].longitude!), - ), + CameraUpdate cameraUpdate = + CameraUpdate.newCameraPosition( + CameraPosition( + zoom: 18, + target: LatLng( + controller + .homeController + .allNearestRestaurant[value] + .latitude!, + controller + .homeController + .allNearestRestaurant[value] + .longitude!, + ), + ), + ); + controller.mapController!.animateCamera( + cameraUpdate, ); - controller.mapController!.animateCamera(cameraUpdate); } }, - itemCount: controller.homeController.allNearestRestaurant.length, + itemCount: + controller + .homeController + .allNearestRestaurant + .length, scrollDirection: Axis.horizontal, itemBuilder: (context, index) { - VendorModel vendorModel = controller.homeController.allNearestRestaurant[index]; + VendorModel vendorModel = + controller + .homeController + .allNearestRestaurant[index]; return InkWell( onTap: () { - Get.to(const RestaurantDetailsScreen(), arguments: {"vendorModel": vendorModel})?.then((v) { - controller.homeController.getFavouriteRestaurant(); + Get.to( + const RestaurantDetailsScreen(), + arguments: {"vendorModel": vendorModel}, + )?.then((v) { + controller.homeController + .getFavouriteRestaurant(); }); }, child: Padding( - padding: EdgeInsets.symmetric(vertical: 10, horizontal: index == 0 ? 0 : 10), + padding: EdgeInsets.symmetric( + vertical: 10, + horizontal: index == 0 ? 0 : 10, + ), child: Container( - decoration: BoxDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, borderRadius: const BorderRadius.all(Radius.circular(16))), + decoration: BoxDecoration( + color: + isDark + ? AppThemeData.grey900 + : AppThemeData.grey50, + borderRadius: const BorderRadius.all( + Radius.circular(16), + ), + ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Stack( children: [ ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16)), + borderRadius: + const BorderRadius.only( + topLeft: Radius.circular( + 16, + ), + topRight: Radius.circular( + 16, + ), + ), child: Stack( children: [ NetworkImageWidget( - imageUrl: vendorModel.photo.toString(), + imageUrl: + vendorModel.photo + .toString(), fit: BoxFit.cover, - height: Responsive.height(14, context), - width: Responsive.width(100, context), + height: Responsive.height( + 14, + context, + ), + width: Responsive.width( + 100, + context, + ), ), Container( - height: Responsive.height(14, context), - width: Responsive.width(100, context), + height: Responsive.height( + 14, + context, + ), + width: Responsive.width( + 100, + context, + ), decoration: BoxDecoration( gradient: LinearGradient( - begin: const Alignment(-0.00, -1.00), - end: const Alignment(0, 1), - colors: [Colors.black.withOpacity(0), const Color(0xFF111827)], + begin: + const Alignment( + -0.00, + -1.00, + ), + end: const Alignment( + 0, + 1, + ), + colors: [ + Colors.black + .withOpacity(0), + const Color( + 0xFF111827, + ), + ], ), ), ), @@ -1886,21 +3276,75 @@ class MapView extends StatelessWidget { top: 10, child: InkWell( onTap: () async { - if (controller.homeController.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty) { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.homeController.favouriteList.removeWhere((item) => item.restaurantId == vendorModel.id); - await FireStoreUtils.removeFavouriteRestaurant(favouriteModel); + if (controller + .homeController + .favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel + .id, + ) + .isNotEmpty) { + FavouriteModel + favouriteModel = + FavouriteModel( + restaurantId: + vendorModel + .id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller + .homeController + .favouriteList + .removeWhere( + (item) => + item.restaurantId == + vendorModel + .id, + ); + await FireStoreUtils.removeFavouriteRestaurant( + favouriteModel, + ); } else { - FavouriteModel favouriteModel = FavouriteModel(restaurantId: vendorModel.id, userId: FireStoreUtils.getCurrentUid()); - controller.homeController.favouriteList.add(favouriteModel); - await FireStoreUtils.setFavouriteRestaurant(favouriteModel); + FavouriteModel + favouriteModel = + FavouriteModel( + restaurantId: + vendorModel + .id, + userId: + FireStoreUtils.getCurrentUid(), + ); + controller + .homeController + .favouriteList + .add( + favouriteModel, + ); + await FireStoreUtils.setFavouriteRestaurant( + favouriteModel, + ); } }, child: Obx( () => - controller.homeController.favouriteList.where((p0) => p0.restaurantId == vendorModel.id).isNotEmpty - ? SvgPicture.asset("assets/icons/ic_like_fill.svg") - : SvgPicture.asset("assets/icons/ic_like.svg"), + controller + .homeController + .favouriteList + .where( + (p0) => + p0.restaurantId == + vendorModel.id, + ) + .isNotEmpty + ? SvgPicture.asset( + "assets/icons/ic_like_fill.svg", + ) + : SvgPicture.asset( + "assets/icons/ic_like.svg", + ), ), ), ), @@ -1908,53 +3352,128 @@ class MapView extends StatelessWidget { ), ), Transform.translate( - offset: Offset(Responsive.width(-3, context), Responsive.height(11, context)), + offset: Offset( + Responsive.width(-3, context), + Responsive.height( + 11, + context, + ), + ), child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, children: [ Visibility( - visible: (vendorModel.isSelfDelivery == true && Constant.isSelfDeliveryFeature == true), + visible: + (vendorModel.isSelfDelivery == + true && + Constant.isSelfDeliveryFeature == + true), child: Row( children: [ Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7), + padding: + const EdgeInsets.symmetric( + horizontal: + 10, + vertical: 7, + ), decoration: BoxDecoration( - color: AppThemeData.carRent300, - borderRadius: BorderRadius.circular(120), // Optional + color: + AppThemeData + .carRent300, + borderRadius: + BorderRadius.circular( + 120, + ), // Optional ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_free_delivery.svg"), - const SizedBox(width: 5), + SvgPicture.asset( + "assets/icons/ic_free_delivery.svg", + ), + const SizedBox( + width: 5, + ), Text( - "Free Delivery".tr, - style: TextStyle(fontSize: 14, color: AppThemeData.success600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w600), + "Free Delivery" + .tr, + style: TextStyle( + fontSize: + 14, + color: + AppThemeData + .success600, + fontFamily: + AppThemeData + .semiBold, + fontWeight: + FontWeight + .w600, + ), ), ], ), ), - const SizedBox(width: 6), + const SizedBox( + width: 6, + ), ], ), ), Container( decoration: ShapeDecoration( - color: isDark ? AppThemeData.primary600 : AppThemeData.primary50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData + .primary600 + : AppThemeData + .primary50, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: + const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_star.svg", colorFilter: ColorFilter.mode(AppThemeData.primary300, BlendMode.srcIn)), - const SizedBox(width: 5), + SvgPicture.asset( + "assets/icons/ic_star.svg", + colorFilter: + ColorFilter.mode( + AppThemeData + .primary300, + BlendMode + .srcIn, + ), + ), + const SizedBox( + width: 5, + ), Text( "${Constant.calculateReview(reviewCount: vendorModel.reviewsCount.toString(), reviewSum: vendorModel.reviewsSum.toString())} (${vendorModel.reviewsCount!.toStringAsFixed(0)})", style: TextStyle( - color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, - fontFamily: AppThemeData.semiBold, - fontWeight: FontWeight.w600, + color: + isDark + ? AppThemeData + .primary300 + : AppThemeData + .primary300, + fontFamily: + AppThemeData + .semiBold, + fontWeight: + FontWeight + .w600, ), ), ], @@ -1964,21 +3483,55 @@ class MapView extends StatelessWidget { const SizedBox(width: 10), Container( decoration: ShapeDecoration( - color: isDark ? AppThemeData.ecommerce600 : AppThemeData.ecommerce50, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(120)), + color: + isDark + ? AppThemeData + .ecommerce600 + : AppThemeData + .ecommerce50, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 120, + ), + ), ), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: + const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), child: Row( children: [ - SvgPicture.asset("assets/icons/ic_map_distance.svg", colorFilter: ColorFilter.mode(AppThemeData.ecommerce300, BlendMode.srcIn)), - const SizedBox(width: 5), + SvgPicture.asset( + "assets/icons/ic_map_distance.svg", + colorFilter: + ColorFilter.mode( + AppThemeData + .ecommerce300, + BlendMode + .srcIn, + ), + ), + const SizedBox( + width: 5, + ), Text( "${Constant.getDistance(lat1: vendorModel.latitude.toString(), lng1: vendorModel.longitude.toString(), lat2: Constant.selectedLocation.location!.latitude.toString(), lng2: Constant.selectedLocation.location!.longitude.toString())} ${Constant.distanceType}", style: TextStyle( - color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300, - fontFamily: AppThemeData.semiBold, - fontWeight: FontWeight.w600, + color: + isDark + ? AppThemeData + .ecommerce300 + : AppThemeData + .ecommerce300, + fontFamily: + AppThemeData + .semiBold, + fontWeight: + FontWeight + .w600, ), ), ], @@ -1992,9 +3545,12 @@ class MapView extends StatelessWidget { ), const SizedBox(height: 15), Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), + padding: const EdgeInsets.symmetric( + horizontal: 10, + ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( vendorModel.title.toString(), @@ -2002,20 +3558,35 @@ class MapView extends StatelessWidget { maxLines: 1, style: TextStyle( fontSize: 18, - overflow: TextOverflow.ellipsis, - fontFamily: AppThemeData.semiBold, - color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, + overflow: + TextOverflow.ellipsis, + fontFamily: + AppThemeData.semiBold, + color: + isDark + ? AppThemeData + .grey50 + : AppThemeData + .grey900, ), ), Text( - vendorModel.location.toString(), + vendorModel.location + .toString(), textAlign: TextAlign.start, maxLines: 1, style: TextStyle( - overflow: TextOverflow.ellipsis, - fontFamily: AppThemeData.medium, + overflow: + TextOverflow.ellipsis, + fontFamily: + AppThemeData.medium, fontWeight: FontWeight.w500, - color: isDark ? AppThemeData.grey400 : AppThemeData.grey400, + color: + isDark + ? AppThemeData + .grey400 + : AppThemeData + .grey400, ), ), ], diff --git a/lib/screen_ui/multi_vendor_service/order_list_screen/live_tracking_screen.dart b/lib/screen_ui/multi_vendor_service/order_list_screen/live_tracking_screen.dart index 0e2a4a8..980aeb0 100644 --- a/lib/screen_ui/multi_vendor_service/order_list_screen/live_tracking_screen.dart +++ b/lib/screen_ui/multi_vendor_service/order_list_screen/live_tracking_screen.dart @@ -31,7 +31,7 @@ class LiveTrackingScreen extends StatelessWidget { mapController: controller.osmMapController, options: flutterMap.MapOptions(initialCenter: controller.driverCurrent.value, initialZoom: 14), children: [ - flutterMap.TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.emart.customer'), + flutterMap.TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'felix.fondex.uz'), if (controller.routePoints.isNotEmpty) flutterMap.PolylineLayer(polylines: [flutterMap.Polyline(points: controller.routePoints, strokeWidth: 5.0, color: Colors.blue)]), flutterMap.MarkerLayer(markers: controller.orderModel.value.id == null ? [] : controller.osmMarkers), ], diff --git a/lib/service/fire_store_utils.dart b/lib/service/fire_store_utils.dart index 8c56d2f..f054fc3 100644 --- a/lib/service/fire_store_utils.dart +++ b/lib/service/fire_store_utils.dart @@ -83,7 +83,11 @@ class FireStoreUtils { static FirebaseFirestore fireStore = FirebaseFirestore.instance; static String getCurrentUid() { - return auth.FirebaseAuth.instance.currentUser!.uid; + final user = auth.FirebaseAuth.instance.currentUser; + if(user != null){ + return user.uid; + } + return "hello"; } static Future isLogin() async { diff --git a/lib/themes/text_field_widget.dart b/lib/themes/text_field_widget.dart index 8e0b58c..dfc9c06 100644 --- a/lib/themes/text_field_widget.dart +++ b/lib/themes/text_field_widget.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../controllers/theme_controller.dart'; import 'app_them_data.dart'; @@ -121,7 +122,7 @@ class _TextFieldWidgetState extends State { errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Colors.red)), disabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor)), hintText: widget.hintText.tr, - hintStyle: AppThemeData.regularTextStyle(fontSize: 14, color: hintColor), + hintStyle: AppThemeData.regularTextStyle(fontSize: 14.sp, color: hintColor), ), ), ], diff --git a/lib/widget/osm_map/map_picker_page.dart b/lib/widget/osm_map/map_picker_page.dart index 334c7c9..7491e77 100644 --- a/lib/widget/osm_map/map_picker_page.dart +++ b/lib/widget/osm_map/map_picker_page.dart @@ -44,7 +44,7 @@ class MapPickerPage extends StatelessWidget { options: MapOptions( initialCenter: controller.pickedPlace.value?.coordinates ?? - LatLng(20.5937, 78.9629), // Default India center + LatLng(41.3775, 64.5853), // Default UZB center initialZoom: 13, onTap: (tapPos, latlng) { controller.addLatLngOnly(latlng); @@ -180,7 +180,8 @@ class MapPickerPage extends StatelessWidget { title: "Confirm Location".tr, color: AppThemeData.mainColor, textColor: AppThemeData.grey50, - height: 4.h, + borderRadius: 12, + height: 6, onPress: () async { final selected = controller.pickedPlace.value; if (selected != null) { diff --git a/pubspec.lock b/pubspec.lock index e5c9143..c69f970 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -321,6 +321,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + easy_localization: + dependency: "direct main" + description: + name: easy_localization + sha256: "2ccdf9db8fe4d9c5a75c122e6275674508fd0f0d49c827354967b8afcc56bbed" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + easy_logger: + dependency: transitive + description: + name: easy_logger + sha256: c764a6e024846f33405a2342caf91c62e357c24b02c04dbc712ef232bf30ffb7 + url: "https://pub.dev" + source: hosted + version: "0.0.2" equatable: dependency: transitive description: @@ -614,6 +630,19 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.3" + flutter_localization: + dependency: "direct main" + description: + name: flutter_localization + sha256: "578a73455a0deffc4169ef9372ba0562a3e2cff563e5c524ea87bc96daa519c0" + url: "https://pub.dev" + source: hosted + version: "0.3.3" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" flutter_map: dependency: "direct main" description: @@ -1829,6 +1858,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.1" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2 + url: "https://pub.dev" + source: hosted + version: "2.3.1" url_launcher: dependency: transitive description: @@ -2061,6 +2098,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.6.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" zxing_lib: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2365c9a..6d943bf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: customer description: "A new Flutter project." -version: 1.0.0+1 +version: 1.0.0+2 environment: sdk: ^3.7.2 @@ -88,6 +88,8 @@ dependencies: flutter_google_places_hoc081098: ^2.0.0 flutter_screenutil: ^5.9.3 flutter_hooks: ^0.21.3+1 + easy_localization: ^3.0.8 + flutter_localization: ^0.3.3 dependency_overrides: webview_flutter: ^4.9.0