BASE: Implement Localization In Intercity Home Screen.

This commit is contained in:
2025-12-03 17:30:54 +05:00
parent 452722faaa
commit f2a7679d4b
3 changed files with 66 additions and 62 deletions

View File

@@ -94,5 +94,9 @@
"typeComment": "Type comment....", "typeComment": "Type comment....",
"title": "Title", "title": "Title",
"typeDescription": "Type Description...", "typeDescription": "Type Description...",
"save": "Save" "save": "Save",
"popularDestinations": "Popular Destinations",
"selectPaymentMethod": "Select Payment Method",
"prefferedPayment": "Preferred Payment",
"otherPaymentOptions": "Other Payment Options"
} }

View File

@@ -94,10 +94,10 @@ class ConstTexts {
static String title = "title"; static String title = "title";
static String typeDescription = "typeDescription"; static String typeDescription = "typeDescription";
static String save = "save"; static String save = "save";
static String everyRideVerified = "everyRideVerified"; static String popularDestinations = "popularDestinations";
static String allDriversIDCheck = "allDriversIDCheck"; static String selectPaymentMethod = "selectPaymentMethod";
static String intercity = "intercity"; static String prefferedPayment = "prefferedPayment";
static String aroundTheCity = "aroundTheCity"; static String otherPaymentOptions = "otherPaymentOptions";
static String rideDetails = "rideDetails"; static String rideDetails = "rideDetails";
static String youDoNothaveSufficientwalletBalance = "youDoNothaveSufficientwalletBalance"; static String youDoNothaveSufficientwalletBalance = "youDoNothaveSufficientwalletBalance";
static String somethingWentWrong = "somethingWentWrong"; static String somethingWentWrong = "somethingWentWrong";

View File

@@ -1,6 +1,5 @@
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:customer/constant/const_texts.dart';
import 'package:customer/controllers/Intercity_home_controller.dart'; import 'package:customer/controllers/Intercity_home_controller.dart';
import 'package:customer/models/coupon_model.dart'; import 'package:customer/models/coupon_model.dart';
import 'package:customer/models/tax_model.dart'; import 'package:customer/models/tax_model.dart';
@@ -14,6 +13,7 @@ import 'package:customer/themes/round_button_border.dart';
import 'package:customer/utils/network_image_widget.dart'; import 'package:customer/utils/network_image_widget.dart';
import 'package:customer/utils/utils.dart'; import 'package:customer/utils/utils.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -174,7 +174,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller.sourceTextEditController.value.text = address.toString(); controller.sourceTextEditController.value.text = address.toString();
controller.setDepartureMarker(lat, lng); controller.setDepartureMarker(lat, lng);
} else { } else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr); ShowToastDialog.showToast(ConstTexts.serviceIsUnavailable.tr());
} }
} }
} else { } else {
@@ -186,7 +186,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller.sourceTextEditController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel); controller.sourceTextEditController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.setDepartureMarker(selectedLocationModel.latLng!.latitude, selectedLocationModel.latLng!.longitude); controller.setDepartureMarker(selectedLocationModel.latLng!.latitude, selectedLocationModel.latLng!.longitude);
} else { } else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr); ShowToastDialog.showToast(ConstTexts.serviceIsUnavailable.tr());
} }
} }
}); });
@@ -194,7 +194,7 @@ class IntercityHomeScreen extends StatelessWidget {
}, },
child: TextFieldWidget( child: TextFieldWidget(
controller: controller.sourceTextEditController.value, controller: controller.sourceTextEditController.value,
hintText: "Pickup Location".tr, hintText: ConstTexts.pickUpLocation.tr(),
enable: false, enable: false,
prefix: Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Image.asset("assets/icons/pickup.png", height: 22, width: 22)), prefix: Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Image.asset("assets/icons/pickup.png", height: 22, width: 22)),
), ),
@@ -229,7 +229,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller: controller.destinationTextEditController.value, controller: controller.destinationTextEditController.value,
// backgroundColor: AppThemeData.grey50, // backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50, // borderColor: AppThemeData.grey50,
hintText: "Destination Location".tr, hintText: ConstTexts.destinationLocation.tr(),
enable: false, enable: false,
prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)), prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)),
), ),
@@ -257,7 +257,7 @@ class IntercityHomeScreen extends StatelessWidget {
], ],
), ),
SizedBox(height: 15), SizedBox(height: 15),
Align(alignment: Alignment.centerLeft, child: Text("Popular Destinations".tr, style: AppThemeData.boldTextStyle(fontSize: 16, color: AppThemeData.grey900))), Align(alignment: Alignment.centerLeft, child: Text(ConstTexts.popularDestinations.tr(), style: AppThemeData.boldTextStyle(fontSize: 16, color: AppThemeData.grey900))),
SizedBox( SizedBox(
height: 120, height: 120,
child: Padding( child: Padding(
@@ -322,12 +322,12 @@ class IntercityHomeScreen extends StatelessWidget {
SizedBox(height: 10), SizedBox(height: 10),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Continue".tr, title: ConstTexts.continueT.tr(),
onPress: () { onPress: () {
if (controller.sourceTextEditController.value.text.isEmpty) { if (controller.sourceTextEditController.value.text.isEmpty) {
ShowToastDialog.showToast("Please select source location".tr); ShowToastDialog.showToast(ConstTexts.plsSelectSourceLocation.tr());
} else if (controller.destinationTextEditController.value.text.isEmpty) { } else if (controller.destinationTextEditController.value.text.isEmpty) {
ShowToastDialog.showToast("Please select destination location".tr); ShowToastDialog.showToast(ConstTexts.plsSelectDestinationLocations.tr());
} else { } else {
controller.bottomSheetType.value = "vehicleSelection"; controller.bottomSheetType.value = "vehicleSelection";
} }
@@ -364,7 +364,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
child: Text( child: Text(
"Select Your Vehicle Type".tr, ConstTexts.selectVehicleType.tr(),
style: AppThemeData.boldTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.boldTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
textAlign: TextAlign.start, textAlign: TextAlign.start,
), ),
@@ -473,7 +473,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller.calculateTotalAmount(); controller.calculateTotalAmount();
controller.bottomSheetType.value = "payment"; controller.bottomSheetType.value = "payment";
} else { } else {
ShowToastDialog.showToast("Please select a vehicle type first.".tr); ShowToastDialog.showToast(ConstTexts.plsSelectVehicleTypeFirst.tr());
} }
}, },
color: AppThemeData.primary300, color: AppThemeData.primary300,
@@ -506,7 +506,7 @@ class IntercityHomeScreen extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Select Payment Method".tr, style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.selectPaymentMethod.tr(), style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.back(); Get.back();
@@ -521,7 +521,7 @@ class IntercityHomeScreen extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
controller: scrollController, controller: scrollController,
children: [ children: [
Text("Preferred Payment".tr, textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)), Text(ConstTexts.prefferedPayment.tr(), textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
const SizedBox(height: 10), const SizedBox(height: 10),
if (controller.walletSettingModel.value.isEnabled == true || controller.cashOnDeliverySettingModel.value.isEnabled == true) if (controller.walletSettingModel.value.isEnabled == true || controller.cashOnDeliverySettingModel.value.isEnabled == true)
Container( Container(
@@ -552,7 +552,7 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
"Other Payment Options".tr, ConstTexts.otherPaymentOptions.tr(),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500), style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
), ),
@@ -598,18 +598,18 @@ class IntercityHomeScreen extends StatelessWidget {
), ),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Continue".tr, title: ConstTexts.continueT.tr(),
color: AppThemeData.primary300, color: AppThemeData.primary300,
textColor: AppThemeData.grey900, textColor: AppThemeData.grey900,
onPress: () async { onPress: () async {
if (controller.selectedPaymentMethod.value.isEmpty) { if (controller.selectedPaymentMethod.value.isEmpty) {
ShowToastDialog.showToast("Please select a payment method".tr); ShowToastDialog.showToast(ConstTexts.plsSelectPaymentMethod.tr());
return; return;
} }
if (controller.selectedPaymentMethod.value == "wallet") { if (controller.selectedPaymentMethod.value == "wallet") {
num walletAmount = controller.userModel.value.walletAmount ?? 0; num walletAmount = controller.userModel.value.walletAmount ?? 0;
if (walletAmount <= 0) { if (walletAmount <= 0) {
ShowToastDialog.showToast("Insufficient wallet balance. Please select another payment method.".tr); ShowToastDialog.showToast(ConstTexts.insufficientWallet.tr());
return; return;
} }
} }
@@ -703,7 +703,7 @@ class IntercityHomeScreen extends StatelessWidget {
}, },
child: TextFieldWidget( child: TextFieldWidget(
controller: controller.sourceTextEditController.value, controller: controller.sourceTextEditController.value,
hintText: "Pickup Location".tr, hintText: ConstTexts.pickUpLocation.tr(),
enable: false, enable: false,
prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.stop_circle_outlined, color: Colors.green)), prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.stop_circle_outlined, color: Colors.green)),
), ),
@@ -738,7 +738,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller: controller.destinationTextEditController.value, controller: controller.destinationTextEditController.value,
// backgroundColor: AppThemeData.grey50, // backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50, // borderColor: AppThemeData.grey50,
hintText: "Destination Location".tr, hintText: ConstTexts.destinationLocation.tr(),
enable: false, enable: false,
prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)), prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)),
), ),
@@ -769,7 +769,7 @@ class IntercityHomeScreen extends StatelessWidget {
Row( Row(
children: [ children: [
Expanded(child: Text("Promo code".tr, style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900))), Expanded(child: Text(ConstTexts.promoCode.tr(), style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900))),
InkWell( InkWell(
onTap: () { onTap: () {
Get.to(CabCouponCodeScreen())!.then((value) { Get.to(CabCouponCodeScreen())!.then((value) {
@@ -779,13 +779,13 @@ class IntercityHomeScreen extends StatelessWidget {
controller.selectedCouponModel.value = value; controller.selectedCouponModel.value = value;
controller.calculateTotalAmount(); controller.calculateTotalAmount();
} else { } else {
ShowToastDialog.showToast("This offer not eligible for this booking".tr); ShowToastDialog.showToast(ConstTexts.thisOfferNotEligible.tr());
} }
} }
}); });
}, },
child: Text( child: Text(
"View All".tr, ConstTexts.viewAll.tr(),
style: AppThemeData.boldTextStyle(decoration: TextDecoration.underline, fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300), style: AppThemeData.boldTextStyle(decoration: TextDecoration.underline, fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
), ),
), ),
@@ -815,7 +815,7 @@ class IntercityHomeScreen extends StatelessWidget {
style: AppThemeData.semiBoldTextStyle(color: AppThemeData.parcelService500, fontSize: 16), style: AppThemeData.semiBoldTextStyle(color: AppThemeData.parcelService500, fontSize: 16),
decoration: InputDecoration( decoration: InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: 'Write coupon Code'.tr, hintText: ConstTexts.writeCoupon.tr(),
contentPadding: EdgeInsets.only(bottom: 10), contentPadding: EdgeInsets.only(bottom: 10),
hintStyle: AppThemeData.semiBoldTextStyle(color: AppThemeData.parcelService500, fontSize: 16), hintStyle: AppThemeData.semiBoldTextStyle(color: AppThemeData.parcelService500, fontSize: 16),
), ),
@@ -824,7 +824,7 @@ class IntercityHomeScreen extends StatelessWidget {
), ),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Redeem now".tr, title: ConstTexts.redeemNow.tr(),
width: 27.w, width: 27.w,
fontSizes: 14, fontSizes: 14,
@@ -842,13 +842,13 @@ class IntercityHomeScreen extends StatelessWidget {
controller.calculateTotalAmount(); controller.calculateTotalAmount();
controller.update(); controller.update();
} else { } else {
ShowToastDialog.showToast("This offer not eligible for this booking".tr); ShowToastDialog.showToast(ConstTexts.thisOfferNotEligible.tr());
} }
} else { } else {
ShowToastDialog.showToast("This coupon code has been expired".tr); ShowToastDialog.showToast(ConstTexts.couponExpired.tr());
} }
} else { } else {
ShowToastDialog.showToast("Invalid coupon code".tr); ShowToastDialog.showToast(ConstTexts.invalidCouponCode.tr());
} }
}, },
color: AppThemeData.parcelService300, color: AppThemeData.parcelService300,
@@ -872,7 +872,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("Order Summary".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)), Text(ConstTexts.orderSummary.tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
const SizedBox(height: 8), const SizedBox(height: 8),
Padding( Padding(
@@ -880,7 +880,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Subtotal".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.subtotal.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text( Text(
Constant.amountShow(amount: controller.subTotal.value.toString()), Constant.amountShow(amount: controller.subTotal.value.toString()),
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
@@ -896,7 +896,7 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
Row( Row(
children: [ children: [
Text("Discount".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.discount.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
SizedBox(width: 5), SizedBox(width: 5),
Text( Text(
controller.selectedCouponModel.value.id == null ? "" : "(${controller.selectedCouponModel.value.code})", controller.selectedCouponModel.value.id == null ? "" : "(${controller.selectedCouponModel.value.code})",
@@ -923,7 +923,7 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
'${taxModel.title} (${taxModel.tax} ${taxModel.type == "Fixed" ? Constant.currencyData!.code : "%"})'.tr, '${taxModel.title} (${taxModel.tax} ${taxModel.type == "Fixed" ? Constant.currencyData!.code : "%"})',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.mediumTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.mediumTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -931,7 +931,7 @@ class IntercityHomeScreen extends StatelessWidget {
Text( Text(
Constant.amountShow( Constant.amountShow(
amount: Constant.calculateTax(amount: (controller.subTotal.value - controller.discount.value).toString(), taxModel: taxModel).toString(), amount: Constant.calculateTax(amount: (controller.subTotal.value - controller.discount.value).toString(), taxModel: taxModel).toString(),
).tr, ),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -947,7 +947,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Order Total".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.orderTotal.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text( Text(
Constant.amountShow(amount: controller.totalAmount.value.toString()), Constant.amountShow(amount: controller.totalAmount.value.toString()),
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
@@ -995,7 +995,7 @@ class IntercityHomeScreen extends StatelessWidget {
: cardDecorationScreen(controller, PaymentGateway.razorpay, isDark, "assets/images/razorpay.png"), : cardDecorationScreen(controller, PaymentGateway.razorpay, isDark, "assets/images/razorpay.png"),
SizedBox(width: 22), SizedBox(width: 22),
Text( Text(
controller.selectedPaymentMethod.value.tr, controller.selectedPaymentMethod.value,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -1007,7 +1007,7 @@ class IntercityHomeScreen extends StatelessWidget {
), ),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Confirm Booking".tr, title: ConstTexts.confirmBooking.tr(),
onPress: () async { onPress: () async {
controller.placeOrder(); controller.placeOrder();
}, },
@@ -1042,11 +1042,11 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
Container(decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppThemeData.grey400), height: 4, width: 33), Container(decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppThemeData.grey400), height: 4, width: 33),
SizedBox(height: 30), SizedBox(height: 30),
Text("Waiting for driver....".tr, style: AppThemeData.mediumTextStyle(fontSize: 18, color: AppThemeData.grey900)), Text(ConstTexts.waitingForDriver.tr(), style: AppThemeData.mediumTextStyle(fontSize: 18, color: AppThemeData.grey900)),
Image.asset('assets/loader.gif', width: 250), Image.asset('assets/loader.gif', width: 250),
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Cancel Ride".tr, title: ConstTexts.cancelRide.tr(),
onPress: () async { onPress: () async {
try { try {
// 1. Update current order status // 1. Update current order status
@@ -1081,12 +1081,12 @@ class IntercityHomeScreen extends StatelessWidget {
} }
// 5. Optional feedback // 5. Optional feedback
ShowToastDialog.showToast("Ride cancelled successfully".tr); ShowToastDialog.showToast(ConstTexts.riderCancelledSucces.tr());
Get.back(); Get.back();
CabDashboardController cabDashboardController = Get.put(CabDashboardController()); CabDashboardController cabDashboardController = Get.put(CabDashboardController());
cabDashboardController.selectedIndex.value = 0; cabDashboardController.selectedIndex.value = 0;
} catch (e) { } catch (e) {
ShowToastDialog.showToast("Failed to cancel ride".tr); ShowToastDialog.showToast(ConstTexts.failedToCancel.tr());
} }
}, },
color: AppThemeData.danger300, color: AppThemeData.danger300,
@@ -1157,7 +1157,7 @@ class IntercityHomeScreen extends StatelessWidget {
}, },
child: TextFieldWidget( child: TextFieldWidget(
controller: controller.sourceTextEditController.value, controller: controller.sourceTextEditController.value,
hintText: "Pickup Location".tr, hintText: ConstTexts.pickUpLocation.tr(),
enable: false, enable: false,
readOnly: true, readOnly: true,
prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.stop_circle_outlined, color: Colors.green)), prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.stop_circle_outlined, color: Colors.green)),
@@ -1193,7 +1193,7 @@ class IntercityHomeScreen extends StatelessWidget {
controller: controller.destinationTextEditController.value, controller: controller.destinationTextEditController.value,
// backgroundColor: AppThemeData.grey50, // backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50, // borderColor: AppThemeData.grey50,
hintText: "Destination Location".tr, hintText: ConstTexts.destinationLocation.tr(),
enable: false, enable: false,
readOnly: true, readOnly: true,
prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)), prefix: const Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.radio_button_checked, color: Colors.red)),
@@ -1277,7 +1277,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("Order Summary".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)), Text(ConstTexts.orderSummary.tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
const SizedBox(height: 8), const SizedBox(height: 8),
Padding( Padding(
@@ -1285,7 +1285,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Subtotal".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.subtotal.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text( Text(
Constant.amountShow(amount: controller.subTotal.value.toString()), Constant.amountShow(amount: controller.subTotal.value.toString()),
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
@@ -1299,7 +1299,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Discount".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.discount.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text(Constant.amountShow(amount: controller.discount.value.toString()), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: AppThemeData.danger300)), Text(Constant.amountShow(amount: controller.discount.value.toString()), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: AppThemeData.danger300)),
], ],
), ),
@@ -1319,7 +1319,7 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
'${taxModel.title} (${taxModel.tax} ${taxModel.type == "Fixed" ? Constant.currencyData!.code : "%"})'.tr, '${taxModel.title} (${taxModel.tax} ${taxModel.type == "Fixed" ? Constant.currencyData!.code : "%"})',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.mediumTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.mediumTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -1327,7 +1327,7 @@ class IntercityHomeScreen extends StatelessWidget {
Text( Text(
Constant.amountShow( Constant.amountShow(
amount: Constant.calculateTax(amount: (controller.subTotal.value - controller.discount.value).toString(), taxModel: taxModel).toString(), amount: Constant.calculateTax(amount: (controller.subTotal.value - controller.discount.value).toString(), taxModel: taxModel).toString(),
).tr, ),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -1343,7 +1343,7 @@ class IntercityHomeScreen extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("Order Total".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)), Text(ConstTexts.orderTotal.tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text( Text(
Constant.amountShow(amount: controller.totalAmount.value.toString()), Constant.amountShow(amount: controller.totalAmount.value.toString()),
style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
@@ -1393,7 +1393,7 @@ class IntercityHomeScreen extends StatelessWidget {
: cardDecorationScreen(controller, PaymentGateway.razorpay, isDark, "assets/images/razorpay.png"), : cardDecorationScreen(controller, PaymentGateway.razorpay, isDark, "assets/images/razorpay.png"),
SizedBox(width: 22), SizedBox(width: 22),
Text( Text(
controller.selectedPaymentMethod.value.tr, controller.selectedPaymentMethod.value,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900), style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
), ),
@@ -1408,13 +1408,13 @@ class IntercityHomeScreen extends StatelessWidget {
children: [ children: [
RoundedButtonFill( RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "SOS".tr, title: "SOS",
color: Colors.red.withOpacity(0.50), color: Colors.red.withValues(alpha: 0.50),
textColor: AppThemeData.grey50, textColor: AppThemeData.grey50,
isCenter: true, isCenter: true,
icon: Icon(Icons.call, color: Colors.white), icon: Icon(Icons.call, color: Colors.white),
onPress: () async { onPress: () async {
ShowToastDialog.showLoader("Please wait...".tr); ShowToastDialog.showLoader(ConstTexts.pleaseWait.tr());
LocationData location = await controller.currentLocation.value.getLocation(); LocationData location = await controller.currentLocation.value.getLocation();
@@ -1426,7 +1426,7 @@ class IntercityHomeScreen extends StatelessWidget {
SnackBar( SnackBar(
content: Builder( content: Builder(
builder: (context) { builder: (context) {
return Text("Your SOS request has been submitted to admin".tr); return Text(ConstTexts.yourSosRequest.tr());
}, },
), ),
backgroundColor: Colors.green, backgroundColor: Colors.green,
@@ -1440,7 +1440,7 @@ class IntercityHomeScreen extends StatelessWidget {
SnackBar( SnackBar(
content: Builder( content: Builder(
builder: (context) { builder: (context) {
return Text("Your SOS request is already submitted".tr); return Text(ConstTexts.yourSosrequestAlreadySubmitted.tr());
}, },
), ),
backgroundColor: Colors.red, backgroundColor: Colors.red,
@@ -1465,7 +1465,7 @@ class IntercityHomeScreen extends StatelessWidget {
if (controller.currentOrder.value.status == Constant.orderInTransit && controller.currentOrder.value.paymentStatus == false) { if (controller.currentOrder.value.status == Constant.orderInTransit && controller.currentOrder.value.paymentStatus == false) {
return RoundedButtonFill( return RoundedButtonFill(
borderRadius: 10.r, borderRadius: 10.r,
title: "Pay Now".tr, title: ConstTexts.payNow.tr(),
onPress: () async { onPress: () async {
if (controller.selectedPaymentMethod.value == PaymentGateway.stripe.name) { if (controller.selectedPaymentMethod.value == PaymentGateway.stripe.name) {
controller.stripeMakePayment(amount: controller.totalAmount.value.toString()); controller.stripeMakePayment(amount: controller.totalAmount.value.toString());
@@ -1493,14 +1493,14 @@ class IntercityHomeScreen extends StatelessWidget {
RazorPayController().createOrderRazorPay(amount: double.parse(controller.totalAmount.value.toString()), razorpayModel: controller.razorPayModel.value).then((value) { RazorPayController().createOrderRazorPay(amount: double.parse(controller.totalAmount.value.toString()), razorpayModel: controller.razorPayModel.value).then((value) {
if (value == null) { if (value == null) {
Get.back(); Get.back();
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr); ShowToastDialog.showToast(ConstTexts.somethingWentWrong.tr());
} else { } else {
CreateRazorPayOrderModel result = value; CreateRazorPayOrderModel result = value;
controller.openCheckout(amount: controller.totalAmount.value.toString(), orderId: result.id); controller.openCheckout(amount: controller.totalAmount.value.toString(), orderId: result.id);
} }
}); });
} else { } else {
ShowToastDialog.showToast("Please select payment method".tr); ShowToastDialog.showToast(ConstTexts.plsSelectPaymentMethod.tr());
} }
}, },
color: AppThemeData.primary300, color: AppThemeData.primary300,