BASE: Initialize Localization.

This commit is contained in:
2025-12-03 18:21:19 +05:00
parent cf58d069ab
commit b04050384d
141 changed files with 1577 additions and 1419 deletions

View File

@@ -1,5 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:customer/constant/constant.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../controllers/rental_home_controller.dart';
@@ -57,7 +58,7 @@ class RentalHomeScreen extends StatelessWidget {
onTap: () {
Get.offAll(const LoginScreen());
},
child: Text("Login".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey900)),
child: Text("Login".tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey900)),
)
: Text(Constant.userModel!.fullName(), style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey900)),
],
@@ -92,7 +93,7 @@ class RentalHomeScreen extends StatelessWidget {
controller.sourceTextEditController.value.text = address;
controller.departureLatLongOsm.value = latlong.LatLng(lat, lng);
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
}
} else {
@@ -104,7 +105,7 @@ class RentalHomeScreen extends StatelessWidget {
controller.sourceTextEditController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.departureLatLong.value = latlong.LatLng(selectedLocationModel.latLng!.latitude, selectedLocationModel.latLng!.longitude);
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
}
});
@@ -113,8 +114,8 @@ class RentalHomeScreen extends StatelessWidget {
hoverColor: Colors.transparent,
child: TextFieldWidget(
controller: controller.sourceTextEditController.value,
hintText: "Your current location".tr,
title: "Pickup Location".tr,
hintText: "Your current location".tr(),
title: "Pickup Location".tr(),
enable: false,
prefix: Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Icon(Icons.stop_circle_outlined, color: Colors.green)),
),
@@ -124,7 +125,7 @@ class RentalHomeScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text("Select Your Vehicle Type".tr, style: AppThemeData.boldTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text("Select Your Vehicle Type".tr(), style: AppThemeData.boldTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
const SizedBox(width: 10),
GestureDetector(
onTap: () => controller.pickDate(context),
@@ -247,27 +248,27 @@ class RentalHomeScreen extends StatelessWidget {
),
const SizedBox(height: 25),
RoundedButtonFill(
title: "Continue".tr,
title: "Continue".tr(),
onPress: () async {
final sourceText = controller.sourceTextEditController.value.text.trim();
if (Constant.userModel == null) {
ShowToastDialog.showToast("Please login to continue".tr);
ShowToastDialog.showToast("Please login to continue".tr());
return;
}
if (sourceText.isEmpty) {
ShowToastDialog.showToast("Please select source location".tr);
ShowToastDialog.showToast("Please select source location".tr());
return;
}
if (controller.selectedVehicleType.value == null) {
ShowToastDialog.showToast("Please select a vehicle type".tr);
ShowToastDialog.showToast("Please select a vehicle type".tr());
return;
}
await controller.getRentalPackage();
if (controller.rentalPackages.isEmpty) {
ShowToastDialog.showToast("No preference available for the selected vehicle type".tr);
ShowToastDialog.showToast("No preference available for the selected vehicle type".tr());
return;
}
@@ -308,7 +309,7 @@ class RentalHomeScreen extends StatelessWidget {
alignment: Alignment.topLeft,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Text("Select Preferences".tr, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: isDark ? Colors.white : Colors.black)),
child: Text("Select Preferences".tr(), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: isDark ? Colors.white : Colors.black)),
),
),
@@ -398,7 +399,7 @@ class RentalHomeScreen extends StatelessWidget {
const SizedBox(height: 10),
RoundedButtonFill(
title: "Continue".tr,
title: "Continue".tr(),
onPress: () {
Get.bottomSheet(paymentBottomSheet(context, controller, isDark), isScrollControlled: true, backgroundColor: Colors.transparent);
},
@@ -434,7 +435,7 @@ class RentalHomeScreen extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Select Payment Method".tr, style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text("Select Payment Method".tr(), style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
GestureDetector(onTap: () => Get.back(), child: const Icon(Icons.close)),
],
),
@@ -446,7 +447,7 @@ class RentalHomeScreen extends StatelessWidget {
padding: EdgeInsets.zero,
controller: scrollController,
children: [
Text("Preferred Payment".tr, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
Text("Preferred Payment".tr(), style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
const SizedBox(height: 10),
if (controller.walletSettingModel.value.isEnabled == true || controller.cashOnDeliverySettingModel.value.isEnabled == true)
@@ -478,7 +479,7 @@ class RentalHomeScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
Text("Other Payment Options".tr, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
Text("Other Payment Options".tr(), style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
const SizedBox(height: 10),
],
),
@@ -524,12 +525,12 @@ class RentalHomeScreen extends StatelessWidget {
// Continue button
RoundedButtonFill(
title: "Continue".tr,
title: "Continue".tr(),
color: AppThemeData.primary300,
textColor: AppThemeData.grey900,
onPress: () async {
if (controller.selectedPaymentMethod.value.isEmpty) {
ShowToastDialog.showToast("Please select a payment method".tr);
ShowToastDialog.showToast("Please select a payment method".tr());
return;
}
@@ -539,7 +540,7 @@ class RentalHomeScreen extends StatelessWidget {
num baseFare = double.tryParse(controller.selectedPackage.value?.baseFare.toString() ?? "0") ?? 0;
if (walletAmount < baseFare) {
ShowToastDialog.showToast("You do not have sufficient wallet balance".tr);
ShowToastDialog.showToast("You do not have sufficient wallet balance".tr());
return;
}
}