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

@@ -8,6 +8,7 @@ import 'package:customer/themes/responsive.dart';
import 'package:customer/themes/round_button_fill.dart';
import 'package:customer/themes/text_field_widget.dart';
import 'package:customer/utils/network_image_widget.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -32,7 +33,7 @@ class GiftCardScreen extends StatelessWidget {
centerTitle: false,
titleSpacing: 0,
title: Text(
"Customize Gift Card".tr,
"Customize Gift Card".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
),
@@ -97,16 +98,16 @@ class GiftCardScreen extends StatelessWidget {
),
const SizedBox(height: 20),
TextFieldWidget(
title: 'Choose an amount'.tr,
title: 'Choose an amount'.tr(),
controller: controller.amountController.value,
hintText: 'Enter gift card amount'.tr,
hintText: 'Enter gift card amount'.tr(),
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
textInputAction: TextInputAction.done,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))],
prefix: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
child: Text(
Constant.currencyModel!.symbol.tr,
Constant.currencyModel!.symbol.tr(),
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.semiBold, fontSize: 18),
),
),
@@ -159,7 +160,7 @@ class GiftCardScreen extends StatelessWidget {
),
),
const SizedBox(height: 40),
TextFieldWidget(title: 'Add Message (Optional)'.tr, controller: controller.messageController.value, hintText: 'Add message here....'.tr, maxLine: 6),
TextFieldWidget(title: 'Add Message (Optional)'.tr(), controller: controller.messageController.value, hintText: 'Add message here....'.tr(), maxLine: 6),
],
),
),
@@ -170,7 +171,7 @@ class GiftCardScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child: RoundedButtonFill(
title: "Continue".tr,
title: "Continue".tr(),
height: 5.5,
color: AppThemeData.primary300,
textColor: AppThemeData.grey50,
@@ -178,12 +179,12 @@ class GiftCardScreen extends StatelessWidget {
onPress: () async {
if (controller.amountController.value.text.isNotEmpty) {
if (Constant.userModel == null) {
ShowToastDialog.showToast("Please log in to the application. You are not logged in.".tr);
ShowToastDialog.showToast("Please log in to the application. You are not logged in.".tr());
} else {
giftCardBottomSheet(context, controller);
}
} else {
ShowToastDialog.showToast("Please enter Amount".tr);
ShowToastDialog.showToast("Please enter Amount".tr());
}
},
),
@@ -229,7 +230,7 @@ class GiftCardScreen extends StatelessWidget {
padding: const EdgeInsets.all(8),
decoration: ShapeDecoration(color: AppThemeData.ecommerce50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
child: Text(
'Complete payment and share this e-gift card with loved ones using any app'.tr,
'Complete payment and share this e-gift card with loved ones using any app'.tr(),
style: TextStyle(color: AppThemeData.ecommerce300, fontSize: 14, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500),
),
),
@@ -238,7 +239,7 @@ class GiftCardScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Bill Details".tr,
"Bill Details".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 16),
),
@@ -255,7 +256,7 @@ class GiftCardScreen extends StatelessWidget {
children: [
Expanded(
child: Text(
"Sub Total".tr,
"Sub Total".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontSize: 16),
),
@@ -273,7 +274,7 @@ class GiftCardScreen extends StatelessWidget {
children: [
Expanded(
child: Text(
"Grand Total".tr,
"Grand Total".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontSize: 16),
),
@@ -294,7 +295,7 @@ class GiftCardScreen extends StatelessWidget {
const SizedBox(height: 20),
Center(
child: Text(
"${'Gift Card expire'.tr} ${controller.selectedGiftCard.value.expiryDay} ${'days after purchase'.tr}".tr,
"${'Gift Card expire'.tr()} ${controller.selectedGiftCard.value.expiryDay} ${'days after purchase'.tr()}".tr(),
textAlign: TextAlign.center,
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey500 : AppThemeData.grey400),
),
@@ -309,7 +310,7 @@ class GiftCardScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child: RoundedButtonFill(
title: "${'Pay'.tr} ${Constant.amountShow(amount: controller.amountController.value.text)}",
title: "${'Pay'.tr()} ${Constant.amountShow(amount: controller.amountController.value.text)}",
height: 5.5,
color: AppThemeData.primary300,
textColor: AppThemeData.grey50,

View File

@@ -2,6 +2,7 @@ import 'package:customer/constant/constant.dart';
import 'package:customer/controllers/history_gift_card_controller.dart';
import 'package:customer/models/gift_cards_order_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../controllers/theme_controller.dart';
@@ -26,7 +27,7 @@ class HistoryGiftCard extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16),
child:
controller.giftCardsOrderList.isEmpty
? Constant.showEmptyView(message: "Purchased Gift card not found".tr)
? Constant.showEmptyView(message: "Purchased Gift card not found".tr())
: ListView.builder(
itemCount: controller.giftCardsOrderList.length,
shrinkWrap: true,
@@ -71,7 +72,7 @@ class HistoryGiftCard extends StatelessWidget {
children: [
Expanded(
child: Text(
"Gift Code".tr,
"Gift Code".tr(),
style: TextStyle(color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
),
@@ -91,7 +92,7 @@ class HistoryGiftCard extends StatelessWidget {
children: [
Expanded(
child: Text(
"Gift Pin".tr,
"Gift Pin".tr(),
style: TextStyle(color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
),
@@ -157,7 +158,7 @@ class HistoryGiftCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Share'.tr,
'Share'.tr(),
style: TextStyle(
color: isDark ? AppThemeData.grey300 : AppThemeData.grey600,
fontSize: 14,
@@ -174,7 +175,7 @@ class HistoryGiftCard extends StatelessWidget {
),
const Expanded(child: SizedBox()),
Text(
giftCardOrderModel.redeem == true ? "Redeemed".tr : "Not Redeem".tr,
giftCardOrderModel.redeem == true ? "Redeemed".tr() : "Not Redeem".tr(),
style: TextStyle(
fontSize: 16,
color: giftCardOrderModel.redeem == true ? AppThemeData.success400 : AppThemeData.danger300,

View File

@@ -7,6 +7,7 @@ import 'package:customer/models/wallet_transaction_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/round_button_fill.dart';
import 'package:customer/themes/text_field_widget.dart';
import 'package:easy_localization/easy_localization.dart';
import '../../../controllers/theme_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -38,25 +39,25 @@ class RedeemGiftCardScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Redeem Gift Card".tr,
"Redeem Gift Card".tr(),
style: TextStyle(fontSize: 24, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
),
Text(
"Enter your gift card code to enjoy discounts and special offers on your orders.".tr,
"Enter your gift card code to enjoy discounts and special offers on your orders.".tr(),
style: TextStyle(fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.regular, fontWeight: FontWeight.w400),
),
const SizedBox(height: 20),
TextFieldWidget(
title: 'Gift Code'.tr,
title: 'Gift Code'.tr(),
controller: controller.giftCodeController.value,
hintText: 'Enter gift code'.tr,
hintText: 'Enter gift code'.tr(),
textInputType: TextInputType.number,
prefix: Padding(padding: const EdgeInsets.all(10), child: SvgPicture.asset("assets/icons/ic_gift_code.svg")),
),
TextFieldWidget(
title: 'Gift Pin'.tr,
title: 'Gift Pin'.tr(),
controller: controller.giftPinController.value,
hintText: 'Enter gift pin'.tr,
hintText: 'Enter gift pin'.tr(),
textInputType: TextInputType.number,
prefix: Padding(padding: const EdgeInsets.all(10), child: SvgPicture.asset("assets/icons/ic_gift_pin.svg")),
),
@@ -70,30 +71,30 @@ class RedeemGiftCardScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child: RoundedButtonFill(
title: "Redeem".tr,
title: "Redeem".tr(),
height: 5.5,
color: AppThemeData.primary300,
textColor: AppThemeData.grey50,
fontSizes: 16,
onPress: () async {
if (controller.giftCodeController.value.text.isEmpty) {
ShowToastDialog.showToast("Please Enter Gift Code".tr);
ShowToastDialog.showToast("Please Enter Gift Code".tr());
} else if (controller.giftPinController.value.text.isEmpty) {
ShowToastDialog.showToast("Please Enter Gift Pin".tr);
ShowToastDialog.showToast("Please Enter Gift Pin".tr());
} else {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
await FireStoreUtils.checkRedeemCode(controller.giftCodeController.value.text.replaceAll(" ", "")).then((value) async {
if (value != null) {
GiftCardsOrderModel giftCodeModel = value;
if (giftCodeModel.redeem == true) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Gift voucher already redeemed".tr);
ShowToastDialog.showToast("Gift voucher already redeemed".tr());
} else if (giftCodeModel.giftPin != controller.giftPinController.value.text) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Gift Pin Invalid".tr);
ShowToastDialog.showToast("Gift Pin Invalid".tr());
} else if (giftCodeModel.expireDate!.toDate().isBefore(DateTime.now())) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Gift Voucher expire".tr);
ShowToastDialog.showToast("Gift Voucher expire".tr());
} else {
giftCodeModel.redeem = true;
@@ -120,7 +121,7 @@ class RedeemGiftCardScreen extends StatelessWidget {
DashBoardController controller = Get.put(DashBoardController());
controller.selectedIndex.value = 2;
}
ShowToastDialog.showToast("Voucher redeem successfully".tr);
ShowToastDialog.showToast("Voucher redeem successfully".tr());
});
});
}
@@ -128,7 +129,7 @@ class RedeemGiftCardScreen extends StatelessWidget {
}
} else {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Invalid Gift Code".tr);
ShowToastDialog.showToast("Invalid Gift Code".tr());
}
});
}

View File

@@ -4,6 +4,7 @@ import 'package:customer/payment/createRazorPayOrderModel.dart';
import 'package:customer/payment/rozorpayConroller.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/round_button_fill.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../controllers/theme_controller.dart';
@@ -26,7 +27,7 @@ class SelectGiftPaymentScreen extends StatelessWidget {
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
centerTitle: false,
titleSpacing: 0,
title: Text("Payment Option".tr, textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)),
title: Text("Payment Option".tr(), textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
@@ -35,7 +36,7 @@ class SelectGiftPaymentScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Preferred Payment".tr,
"Preferred Payment".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
),
@@ -64,7 +65,7 @@ class SelectGiftPaymentScreen extends StatelessWidget {
),
const SizedBox(height: 10),
Text(
"Other Payment Options".tr,
"Other Payment Options".tr(),
textAlign: TextAlign.start,
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
),
@@ -114,7 +115,7 @@ class SelectGiftPaymentScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(bottom: 20),
child: RoundedButtonFill(
title: "Pay Now".tr,
title: "Pay Now".tr(),
height: 5,
color: AppThemeData.primary300,
textColor: AppThemeData.grey50,
@@ -144,14 +145,14 @@ class SelectGiftPaymentScreen extends StatelessWidget {
RazorPayController().createOrderRazorPay(amount: double.parse(controller.amountController.value.text), razorpayModel: controller.razorPayModel.value).then((value) {
if (value == null) {
Get.back();
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
} else {
CreateRazorPayOrderModel result = value;
controller.openCheckout(amount: controller.amountController.value.text, orderId: result.id);
}
});
} else {
ShowToastDialog.showToast("Please select payment method".tr);
ShowToastDialog.showToast("Please select payment method".tr());
}
},
),