BASE: Switch From EasyLocalization To GetX Localization.

This commit is contained in:
2025-12-04 16:56:39 +05:00
parent 157545f1c0
commit bf1d07a048
218 changed files with 2535 additions and 2313 deletions

View File

@@ -14,11 +14,10 @@ import 'package:customer/themes/round_button_border.dart';
import 'package:customer/utils/network_image_widget.dart';
import 'package:customer/utils/utils.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart' hide Trans;
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter_map/flutter_map.dart' as flutterMap;
import 'package:latlong2/latlong.dart' as latlong;
@@ -286,7 +285,7 @@ class CabBookingScreen extends StatelessWidget {
controller.setDepartureMarker(lat, lng);
} else {
ShowToastDialog.showToast(
ConstTexts.serviceIsUnavailable.tr(),
ConstTexts.serviceIsUnavailable.tr,
);
}
}
@@ -319,7 +318,7 @@ class CabBookingScreen extends StatelessWidget {
);
} else {
ShowToastDialog.showToast(
ConstTexts.serviceIsUnavailable.tr(),
ConstTexts.serviceIsUnavailable.tr,
);
}
}
@@ -330,7 +329,7 @@ class CabBookingScreen extends StatelessWidget {
controller:
controller.sourceTextEditController.value,
// backgroundColor: AppThemeData.cardColor,
hintText: ConstTexts.pickUpLocation.tr(),
hintText: ConstTexts.pickUpLocation.tr,
enable: false,
prefix: Padding(
padding: EdgeInsets.only(left: 10, right: 10),
@@ -394,7 +393,7 @@ class CabBookingScreen extends StatelessWidget {
.value,
// backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50,
hintText: ConstTexts.destinationLocation.tr(),
hintText: ConstTexts.destinationLocation.tr,
// backgroundColor: AppThemeData.cardColor,
enable: false,
prefix: const Padding(
@@ -431,7 +430,7 @@ class CabBookingScreen extends StatelessWidget {
SizedBox(height: 15),
RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.continueT.tr(),
title: ConstTexts.continueT.tr,
onPress: () {
if (controller
.sourceTextEditController
@@ -439,7 +438,7 @@ class CabBookingScreen extends StatelessWidget {
.text
.isEmpty) {
ShowToastDialog.showToast(
ConstTexts.plsSelectSourceLocation.tr(),
ConstTexts.plsSelectSourceLocation.tr,
);
} else if (controller
.destinationTextEditController
@@ -447,7 +446,7 @@ class CabBookingScreen extends StatelessWidget {
.text
.isEmpty) {
ShowToastDialog.showToast(
ConstTexts.plsSelectDestinationLocations.tr(),
ConstTexts.plsSelectDestinationLocations.tr,
);
} else {
controller.bottomSheetType.value = "vehicleSelection";
@@ -506,7 +505,7 @@ class CabBookingScreen extends StatelessWidget {
Padding(
padding: EdgeInsetsGeometry.symmetric(horizontal: 16.r),
child: Text(
ConstTexts.selectVehicleType.tr(),
ConstTexts.selectVehicleType.tr,
style: AppThemeData.boldTextStyle(
fontSize: 18.sp,
color:
@@ -668,15 +667,21 @@ class CabBookingScreen extends StatelessWidget {
child: Obx(
() => RoundedButtonFill(
borderRadius: 10.r,
title: 'pay_amount'.tr(namedArgs: {
'amount': controller.selectedVehicleType.value.id == null
? Constant.amountShow(amount: "0.0")
: Constant.amountShow(
amount: controller
.getAmount(controller.selectedVehicleType.value)
.toString(),
),
}),
title: 'pay_amount'.trParams({
'amount':
controller.selectedVehicleType.value.id == null
? Constant.amountShow(amount: "0.0")
: Constant.amountShow(
amount:
controller
.getAmount(
controller
.selectedVehicleType
.value,
)
.toString(),
),
}),
onPress: () async {
if (controller.selectedVehicleType.value.id != null) {
@@ -684,7 +689,7 @@ class CabBookingScreen extends StatelessWidget {
controller.bottomSheetType.value = "payment";
} else {
ShowToastDialog.showToast(
ConstTexts.plsSelectVehicleTypeFirst.tr(),
ConstTexts.plsSelectVehicleTypeFirst.tr,
);
}
},
@@ -904,13 +909,13 @@ class CabBookingScreen extends StatelessWidget {
),
RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.continueT.tr(),
title: ConstTexts.continueT.tr,
color: AppThemeData.mainColor,
textColor: AppThemeData.grey50,
onPress: () async {
if (controller.selectedPaymentMethod.value.isEmpty) {
ShowToastDialog.showToast(
ConstTexts.plsSelectPaymentMethod.tr(),
ConstTexts.plsSelectPaymentMethod.tr,
);
return;
}
@@ -919,7 +924,7 @@ class CabBookingScreen extends StatelessWidget {
controller.userModel.value.walletAmount ?? 0;
if (walletAmount <= 0) {
ShowToastDialog.showToast(
ConstTexts.insufficientWallet.tr(),
ConstTexts.insufficientWallet.tr,
);
return;
}
@@ -1059,7 +1064,7 @@ class CabBookingScreen extends StatelessWidget {
.sourceTextEditController
.value,
hintText:
ConstTexts.pickUpLocation.tr(),
ConstTexts.pickUpLocation.tr,
enable: false,
prefix: const Padding(
padding: EdgeInsets.only(
@@ -1142,8 +1147,7 @@ class CabBookingScreen extends StatelessWidget {
// backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50,
hintText:
ConstTexts.destinationLocation
.tr(),
ConstTexts.destinationLocation.tr,
enable: false,
prefix: const Padding(
padding: EdgeInsets.only(
@@ -1190,7 +1194,7 @@ class CabBookingScreen extends StatelessWidget {
children: [
Expanded(
child: Text(
ConstTexts.promoCode.tr(),
ConstTexts.promoCode.tr,
style: AppThemeData.boldTextStyle(
fontSize: 16,
color:
@@ -1224,15 +1228,14 @@ class CabBookingScreen extends StatelessWidget {
controller.calculateTotalAmount();
} else {
ShowToastDialog.showToast(
ConstTexts.thisOfferNotEligible
.tr(),
ConstTexts.thisOfferNotEligible.tr,
);
}
}
});
},
child: Text(
ConstTexts.viewAll.tr(),
ConstTexts.viewAll.tr,
style: AppThemeData.boldTextStyle(
decoration: TextDecoration.underline,
fontSize: 14,
@@ -1293,7 +1296,7 @@ class CabBookingScreen extends StatelessWidget {
decoration: InputDecoration(
border: InputBorder.none,
hintText:
ConstTexts.writeCoupon.tr(),
ConstTexts.writeCoupon.tr,
contentPadding: EdgeInsets.only(
bottom: 10,
),
@@ -1310,7 +1313,7 @@ class CabBookingScreen extends StatelessWidget {
),
RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.redeemNow.tr(),
title: ConstTexts.redeemNow.tr,
width: 27.w,
fontSizes: 14,
onPress: () async {
@@ -1321,8 +1324,9 @@ class CabBookingScreen extends StatelessWidget {
.trim()
.isEmpty) {
ShowToastDialog.showToast(
ConstTexts.plsEnterCouponCode
.tr(),
ConstTexts
.plsEnterCouponCode
.tr,
);
return;
}
@@ -1374,26 +1378,24 @@ class CabBookingScreen extends StatelessWidget {
controller
.calculateTotalAmount();
ShowToastDialog.showToast(
ConstTexts.couponApplied
.tr(),
ConstTexts.couponApplied.tr,
);
controller.update();
} else {
ShowToastDialog.showToast(
ConstTexts
.thisOfferNotEligible
.tr(),
.tr,
);
}
} else {
ShowToastDialog.showToast(
ConstTexts.couponExpired.tr(),
ConstTexts.couponExpired.tr,
);
}
} else {
ShowToastDialog.showToast(
ConstTexts.invalidCouponCode
.tr(),
ConstTexts.invalidCouponCode.tr,
);
}
},
@@ -1426,7 +1428,7 @@ class CabBookingScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
ConstTexts.orderSummary.tr(),
ConstTexts.orderSummary.tr,
style: AppThemeData.boldTextStyle(
fontSize: 14,
color:
@@ -1446,7 +1448,7 @@ class CabBookingScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
ConstTexts.subtotal.tr(),
ConstTexts.subtotal.tr,
style: AppThemeData.mediumTextStyle(
fontSize: 16,
color:
@@ -1484,7 +1486,7 @@ class CabBookingScreen extends StatelessWidget {
Row(
children: [
Text(
ConstTexts.discount.tr(),
ConstTexts.discount.tr,
style:
AppThemeData.mediumTextStyle(
fontSize: 16,
@@ -1603,7 +1605,7 @@ class CabBookingScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
ConstTexts.orderTotal.tr(),
ConstTexts.orderTotal.tr,
style: AppThemeData.mediumTextStyle(
fontSize: 16,
color:
@@ -1779,8 +1781,10 @@ class CabBookingScreen extends StatelessWidget {
controller.selectedPaymentMethod.value ==
"cod"
? "Наличными"
: controller.selectedPaymentMethod.value
.tr(),
: controller
.selectedPaymentMethod
.value
.tr,
textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(
fontSize: 16,
@@ -1798,7 +1802,7 @@ class CabBookingScreen extends StatelessWidget {
),
RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.confirmBooking.tr(),
title: ConstTexts.confirmBooking.tr,
onPress: () async {
controller.placeOrder();
},
@@ -1854,7 +1858,7 @@ class CabBookingScreen extends StatelessWidget {
),
SizedBox(height: 30),
Text(
ConstTexts.waitingForDriver.tr(),
ConstTexts.waitingForDriver.tr,
style: AppThemeData.boldTextStyle(
fontSize: 18.sp,
color:
@@ -1866,7 +1870,7 @@ class CabBookingScreen extends StatelessWidget {
Image.asset('assets/loader.gif', width: 250),
RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.cancelRide.tr(),
title: ConstTexts.cancelRide.tr,
color: AppThemeData.mainColor,
textColor: AppThemeData.surface,
onPress: () async {
@@ -1913,7 +1917,7 @@ class CabBookingScreen extends StatelessWidget {
await FireStoreUtils.updateUser(Constant.userModel!);
}
ShowToastDialog.showToast(
ConstTexts.riderCancelledSucces.tr(),
ConstTexts.riderCancelledSucces.tr,
);
// Get.offAll(const CabDashboardScreen());
Get.back();
@@ -1922,9 +1926,7 @@ class CabBookingScreen extends StatelessWidget {
);
cabDashboardController.selectedIndex.value = 0;
} catch (e) {
ShowToastDialog.showToast(
ConstTexts.failedToCancel.tr(),
);
ShowToastDialog.showToast(ConstTexts.failedToCancel.tr);
}
},
),
@@ -2019,7 +2021,7 @@ class CabBookingScreen extends StatelessWidget {
controller
.sourceTextEditController
.value,
hintText: ConstTexts.pickUpLocation.tr(),
hintText: ConstTexts.pickUpLocation.tr,
enable: false,
readOnly: true,
prefix: const Padding(
@@ -2067,7 +2069,7 @@ class CabBookingScreen extends StatelessWidget {
// backgroundColor: AppThemeData.grey50,
// borderColor: AppThemeData.grey50,
hintText:
ConstTexts.destinationLocation.tr(),
ConstTexts.destinationLocation.tr,
enable: false,
readOnly: true,
prefix: const Padding(
@@ -2280,7 +2282,7 @@ class CabBookingScreen extends StatelessWidget {
InkWell(
onTap: () async {
ShowToastDialog.showLoader(
ConstTexts.pleaseWait.tr(),
ConstTexts.pleaseWait.tr,
);
UserModel? customer =
@@ -2491,7 +2493,7 @@ class CabBookingScreen extends StatelessWidget {
),
),
Text(
ConstTexts.change.tr(),
ConstTexts.change.tr,
textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(
fontSize: 16,
@@ -2525,7 +2527,7 @@ class CabBookingScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
ConstTexts.orderSummary.tr(),
ConstTexts.orderSummary.tr,
style: AppThemeData.boldTextStyle(
fontSize: 14,
color:
@@ -2545,7 +2547,7 @@ class CabBookingScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
ConstTexts.subtotal.tr(),
ConstTexts.subtotal.tr,
style: AppThemeData.mediumTextStyle(
fontSize: 16,
color:
@@ -2581,7 +2583,7 @@ class CabBookingScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
ConstTexts.discount.tr(),
ConstTexts.discount.tr,
style: AppThemeData.mediumTextStyle(
fontSize: 16,
color:
@@ -2670,7 +2672,7 @@ class CabBookingScreen extends StatelessWidget {
MainAxisAlignment.spaceBetween,
children: [
Text(
ConstTexts.orderTotal.tr(),
ConstTexts.orderTotal.tr,
style: AppThemeData.mediumTextStyle(
fontSize: 16,
color:
@@ -2718,7 +2720,7 @@ class CabBookingScreen extends StatelessWidget {
icon: const Icon(Icons.call, color: Colors.white),
onPress: () async {
ShowToastDialog.showLoader(
ConstTexts.pleaseWait.tr(),
ConstTexts.pleaseWait.tr,
);
LocationData location =
@@ -2740,7 +2742,7 @@ class CabBookingScreen extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
ConstTexts.yourSosRequest.tr(),
ConstTexts.yourSosRequest.tr,
),
backgroundColor: Colors.green,
duration: Duration(seconds: 3),
@@ -2754,7 +2756,7 @@ class CabBookingScreen extends StatelessWidget {
content: Text(
ConstTexts
.yourSosrequestAlreadySubmitted
.tr(),
.tr,
),
backgroundColor: Colors.red,
duration: Duration(seconds: 3),
@@ -2777,7 +2779,7 @@ class CabBookingScreen extends StatelessWidget {
controller.currentOrder.value.paymentStatus == false) {
return RoundedButtonFill(
borderRadius: 10.r,
title: ConstTexts.payNow.tr(),
title: ConstTexts.payNow.tr,
onPress: () async {
if (controller.selectedPaymentMethod.value ==
PaymentGateway.stripe.name) {
@@ -2822,8 +2824,9 @@ class CabBookingScreen extends StatelessWidget {
Constant.userModel!.walletAmount! <
controller.totalAmount.value) {
ShowToastDialog.showToast(
ConstTexts.youDoNothaveSufficientwalletBalance
.tr(),
ConstTexts
.youDoNothaveSufficientwalletBalance
.tr,
);
} else {
controller.completeOrder();
@@ -2859,7 +2862,7 @@ class CabBookingScreen extends StatelessWidget {
if (value == null) {
Get.back();
ShowToastDialog.showToast(
ConstTexts.somethingWentWrong.tr(),
ConstTexts.somethingWentWrong.tr,
);
} else {
CreateRazorPayOrderModel result = value;
@@ -2873,7 +2876,7 @@ class CabBookingScreen extends StatelessWidget {
});
} else {
ShowToastDialog.showToast(
ConstTexts.plsSelectPaymentMethod.tr(),
ConstTexts.plsSelectPaymentMethod.tr,
);
}
},
@@ -3007,7 +3010,7 @@ class CabBookingScreen extends StatelessWidget {
: Expanded(
child: Text(
value.name == "cod"
? ConstTexts.cash.tr()
? ConstTexts.cash.tr
: value.name.capitalizeString(),
textAlign: TextAlign.start,
style: AppThemeData.semiBoldTextStyle(