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

@@ -5,6 +5,7 @@ import 'package:customer/screen_ui/on_demand_service/worker_inbox_screen.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/custom_dialog_box.dart';
import 'package:customer/themes/responsive.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:in_app_review/in_app_review.dart';
import '../../../controllers/theme_controller.dart';
import '../../../service/fire_store_utils.dart';
@@ -51,16 +52,16 @@ class ProfileScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"My Profile".tr,
"My Profile".tr(),
style: TextStyle(fontSize: 24, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
Text(
"Manage your personal information, preferences, and settings all in one place.".tr,
"Manage your personal information, preferences, and settings all in one place.".tr(),
style: TextStyle(fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.regular, fontWeight: FontWeight.w400),
),
const SizedBox(height: 20),
Text(
"General Information".tr,
"General Information".tr(),
style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
const SizedBox(height: 10),
@@ -73,18 +74,18 @@ class ProfileScreen extends StatelessWidget {
children: [
Constant.userModel == null
? const SizedBox()
: cardDecoration(isDark, controller, "assets/images/ic_profile.svg", "Profile Information".tr, () {
: cardDecoration(isDark, controller, "assets/images/ic_profile.svg", "Profile Information".tr(), () {
Get.to(const EditProfileScreen());
}),
if (Constant.sectionConstantModel!.dineInActive == true)
cardDecoration(isDark, controller, "assets/images/ic_dinin.svg", "Dine-In".tr, () {
cardDecoration(isDark, controller, "assets/images/ic_dinin.svg", "Dine-In".tr(), () {
Get.to(const DineInScreen());
}),
cardDecoration(isDark, controller, "assets/images/ic_gift.svg", "Gift Card".tr, () {
cardDecoration(isDark, controller, "assets/images/ic_gift.svg", "Gift Card".tr(), () {
Get.to(const GiftCardScreen());
}),
if (Constant.isCashbackActive == true)
cardDecoration(isDark, controller, "assets/icons/ic_cashback_Offer.svg", "Cashback Offers".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_cashback_Offer.svg", "Cashback Offers".tr(), () {
Get.to(const CashbackOffersListScreen());
}),
],
@@ -97,7 +98,7 @@ class ProfileScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Bookings Information".tr,
"Bookings Information".tr(),
style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
const SizedBox(height: 10),
@@ -108,7 +109,7 @@ class ProfileScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: Column(
children: [
cardDecoration(isDark, controller, "assets/icons/ic_dinin_order.svg", "Dine-In Booking".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_dinin_order.svg", "Dine-In Booking".tr(), () {
Get.to(const DineInBookingScreen());
}),
],
@@ -120,7 +121,7 @@ class ProfileScreen extends StatelessWidget {
: const SizedBox(),
const SizedBox(height: 10),
Text(
"Preferences".tr,
"Preferences".tr(),
style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
const SizedBox(height: 10),
@@ -131,17 +132,17 @@ class ProfileScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
child: Column(
children: [
cardDecoration(isDark, controller, "assets/icons/ic_change_language.svg", "Change Language".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_change_language.svg", "Change Language".tr(), () {
Get.to(const ChangeLanguageScreen());
}),
cardDecoration(isDark, controller, "assets/icons/ic_light_dark.svg", "Dark Mode".tr, () {}),
cardDecoration(isDark, controller, "assets/icons/ic_light_dark.svg", "Dark Mode".tr(), () {}),
],
),
),
),
const SizedBox(height: 10),
Text(
"Social".tr,
"Social".tr(),
style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
const SizedBox(height: 10),
@@ -154,16 +155,16 @@ class ProfileScreen extends StatelessWidget {
children: [
Constant.userModel == null
? const SizedBox()
: cardDecoration(isDark, controller, "assets/icons/ic_refer.svg", "Refer a Friend".tr, () {
: cardDecoration(isDark, controller, "assets/icons/ic_refer.svg", "Refer a Friend".tr(), () {
Get.to(const ReferFriendScreen());
}),
cardDecoration(isDark, controller, "assets/icons/ic_share.svg", "Share app".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_share.svg", "Share app".tr(), () {
Share.share(
'${'Check out Foodie, your ultimate food delivery application!'.tr} \n\n${'Google Play:'.tr} ${Constant.googlePlayLink} \n\n${'App Store:'.tr} ${Constant.appStoreLink}',
subject: 'Look what I made!'.tr,
'${'Check out Foodie, your ultimate food delivery application!'.tr()} \n\n${'Google Play:'.tr()} ${Constant.googlePlayLink} \n\n${'App Store:'.tr()} ${Constant.appStoreLink}',
subject: 'Look what I made!'.tr(),
);
}),
cardDecoration(isDark, controller, "assets/icons/ic_rate.svg", "Rate the app".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_rate.svg", "Rate the app".tr(), () {
final InAppReview inAppReview = InAppReview.instance;
inAppReview.requestReview();
}),
@@ -178,7 +179,7 @@ class ProfileScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Communication".tr,
"Communication".tr(),
style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
const SizedBox(height: 10),
@@ -189,16 +190,16 @@ class ProfileScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
child: Column(
children: [
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_chat.svg", "Store Inbox".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_chat.svg", "Store Inbox".tr(), () {
Get.to(const RestaurantInboxScreen());
}),
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_driver.svg", "Driver Inbox".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_driver.svg", "Driver Inbox".tr(), () {
Get.to(const DriverInboxScreen());
}),
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_chat.svg", "Provider Inbox".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_chat.svg", "Provider Inbox".tr(), () {
Get.to(const ProviderInboxScreen());
}),
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_driver.svg", "Worker Inbox".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_restaurant_driver.svg", "Worker Inbox".tr(), () {
Get.to(const WorkerInboxScreen());
}),
],
@@ -208,7 +209,7 @@ class ProfileScreen extends StatelessWidget {
const SizedBox(height: 10),
],
),
Text("Legal".tr, style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500)),
Text("Legal".tr(), style: TextStyle(fontSize: 12, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500)),
const SizedBox(height: 10),
Container(
width: Responsive.width(100, context),
@@ -217,10 +218,10 @@ class ProfileScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
child: Column(
children: [
cardDecoration(isDark, controller, "assets/icons/ic_privacy_policy.svg", "Privacy Policy".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_privacy_policy.svg", "Privacy Policy".tr(), () {
Get.to(const TermsAndConditionScreen(type: "privacy"));
}),
cardDecoration(isDark, controller, "assets/icons/ic_tearm_condition.svg", "Terms and Conditions".tr, () {
cardDecoration(isDark, controller, "assets/icons/ic_tearm_condition.svg", "Terms and Conditions".tr(), () {
Get.to(const TermsAndConditionScreen(type: "termAndCondition"));
}),
],
@@ -237,18 +238,18 @@ class ProfileScreen extends StatelessWidget {
child: Column(
children: [
Constant.userModel == null
? cardDecoration(isDark, controller, "assets/icons/ic_logout.svg", "Log In".tr, () {
? cardDecoration(isDark, controller, "assets/icons/ic_logout.svg", "Log In".tr(), () {
Get.offAll(const LoginScreen());
})
: cardDecoration(isDark, controller, "assets/icons/ic_logout.svg", "Log out".tr, () {
: cardDecoration(isDark, controller, "assets/icons/ic_logout.svg", "Log out".tr(), () {
showDialog(
context: context,
builder: (BuildContext context) {
return CustomDialogBox(
title: "Log out".tr,
descriptions: "Are you sure you want to log out? You will need to enter your credentials to log back in.".tr,
positiveString: "Log out".tr,
negativeString: "Cancel".tr,
title: "Log out".tr(),
descriptions: "Are you sure you want to log out? You will need to enter your credentials to log back in.".tr(),
positiveString: "Log out".tr(),
negativeString: "Cancel".tr(),
positiveClick: () async {
Constant.userModel!.fcmToken = "";
await FireStoreUtils.updateUser(Constant.userModel!);
@@ -279,20 +280,20 @@ class ProfileScreen extends StatelessWidget {
context: context,
builder: (BuildContext context) {
return CustomDialogBox(
title: "Delete Account".tr,
descriptions: "Are you sure you want to delete your account? This action is irreversible and will permanently remove all your data.".tr,
positiveString: "Delete".tr,
negativeString: "Cancel".tr,
title: "Delete Account".tr(),
descriptions: "Are you sure you want to delete your account? This action is irreversible and will permanently remove all your data.".tr(),
positiveString: "Delete".tr(),
negativeString: "Cancel".tr(),
positiveClick: () async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
await controller.deleteUserFromServer();
await FireStoreUtils.deleteUser().then((value) {
ShowToastDialog.closeLoader();
if (value == true) {
ShowToastDialog.showToast("Account deleted successfully".tr);
ShowToastDialog.showToast("Account deleted successfully".tr());
Get.offAll(const LoginScreen());
} else {
ShowToastDialog.showToast("Contact Administrator".tr);
ShowToastDialog.showToast("Contact Administrator".tr());
}
});
},
@@ -311,7 +312,7 @@ class ProfileScreen extends StatelessWidget {
SvgPicture.asset("assets/icons/ic_delete.svg"),
const SizedBox(width: 10),
Text(
"Delete Account".tr,
"Delete Account".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.danger300 : AppThemeData.danger300),
),
@@ -347,25 +348,25 @@ class ProfileScreen extends StatelessWidget {
},
child: Row(
children: [
SvgPicture.asset(image, colorFilter: title == "Log In".tr || title == "Cashbacks".tr ? const ColorFilter.mode(AppThemeData.success500, BlendMode.srcIn) : null, height: 24, width: 24),
SvgPicture.asset(image, colorFilter: title == "Log In".tr() || title == "Cashbacks".tr() ? const ColorFilter.mode(AppThemeData.success500, BlendMode.srcIn) : null, height: 24, width: 24),
const SizedBox(width: 10),
Expanded(
child: Text(
title.tr,
title.tr(),
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: AppThemeData.medium,
fontSize: 16,
color:
title == "Log out".tr
title == "Log out".tr()
? AppThemeData.danger300
: title == "Log In".tr
: title == "Log In".tr()
? AppThemeData.success500
: (isDark ? AppThemeData.grey100 : AppThemeData.grey800),
),
),
),
title == "Dark Mode".tr
title == "Dark Mode".tr()
? Transform.scale(
scale: 0.8,
child: Obx(() => CupertinoSwitch(value: controller.isDarkModeSwitch.value, activeTrackColor: AppThemeData.primary300, onChanged: controller.toggleDarkMode)),