BASE: Initialize Localization.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:customer/models/coupon_model.dart';
|
||||
import 'package:customer/screen_ui/parcel_service/parcel_coupon_screen.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -42,7 +43,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text("Order Confirmation".tr, style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900)),
|
||||
Text("Order Confirmation".tr(), style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -93,7 +94,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_infoSection(
|
||||
"Pickup Address (Sender):".tr,
|
||||
"Pickup Address (Sender):".tr(),
|
||||
controller.parcelOrder.value.sender?.name ?? '',
|
||||
controller.parcelOrder.value.sender?.address ?? '',
|
||||
controller.parcelOrder.value.sender?.phone ?? '',
|
||||
@@ -104,7 +105,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_infoSection(
|
||||
"Delivery Address (Receiver):".tr,
|
||||
"Delivery Address (Receiver):".tr(),
|
||||
controller.parcelOrder.value.receiver?.name ?? '',
|
||||
controller.parcelOrder.value.receiver?.address ?? '',
|
||||
controller.parcelOrder.value.receiver?.phone ?? '',
|
||||
@@ -131,9 +132,9 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_iconTile("${controller.parcelOrder.value.distance ?? '--'} ${'KM'.tr}", "Distance".tr, "assets/icons/ic_distance_parcel.svg", isDark),
|
||||
_iconTile(controller.parcelOrder.value.parcelWeight ?? '--', "Weight".tr, "assets/icons/ic_weight_parcel.svg", isDark),
|
||||
_iconTile(Constant.amountShow(amount: controller.parcelOrder.value.subTotal), "Rate".tr, "assets/icons/ic_rate_parcel.svg", isDark),
|
||||
_iconTile("${controller.parcelOrder.value.distance ?? '--'} ${'KM'.tr()}", "Distance".tr(), "assets/icons/ic_distance_parcel.svg", isDark),
|
||||
_iconTile(controller.parcelOrder.value.parcelWeight ?? '--', "Weight".tr(), "assets/icons/ic_weight_parcel.svg", isDark),
|
||||
_iconTile(Constant.amountShow(amount: controller.parcelOrder.value.subTotal), "Rate".tr(), "assets/icons/ic_rate_parcel.svg", isDark),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -142,7 +143,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text("Coupons".tr, style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900))),
|
||||
Expanded(child: Text("Coupons".tr(), style: AppThemeData.boldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900))),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.to(ParcelCouponScreen())!.then((value) {
|
||||
@@ -152,13 +153,13 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
controller.selectedCouponModel.value = value;
|
||||
controller.calculatePrice();
|
||||
} else {
|
||||
ShowToastDialog.showToast("This offer not eligible for this booking".tr);
|
||||
ShowToastDialog.showToast("This offer not eligible for this booking".tr());
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
"View All".tr,
|
||||
"View All".tr(),
|
||||
style: AppThemeData.boldTextStyle(decoration: TextDecoration.underline, fontSize: 14, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
),
|
||||
@@ -181,14 +182,14 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
controller: controller.couponController.value,
|
||||
style: AppThemeData.semiBoldTextStyle(color: AppThemeData.parcelService500, fontSize: 16),
|
||||
decoration: InputDecoration(
|
||||
hintText: "Write coupon code".tr,
|
||||
hintText: "Write coupon code".tr(),
|
||||
hintStyle: AppThemeData.mediumTextStyle(fontSize: 16, color: AppThemeData.parcelService500),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
RoundedButtonFill(
|
||||
title: "Redeem now".tr,
|
||||
title: "Redeem now".tr(),
|
||||
onPress: () {
|
||||
if (controller.couponList.where((element) => element.code!.toLowerCase() == controller.couponController.value.text.toLowerCase()).isNotEmpty) {
|
||||
CouponModel couponModel = controller.couponList.firstWhere((p0) => p0.code!.toLowerCase() == controller.couponController.value.text.toLowerCase());
|
||||
@@ -199,13 +200,13 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
controller.calculatePrice();
|
||||
controller.update();
|
||||
} else {
|
||||
ShowToastDialog.showToast("This offer not eligible for this booking".tr);
|
||||
ShowToastDialog.showToast("This offer not eligible for this booking".tr());
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("This coupon code has been expired".tr);
|
||||
ShowToastDialog.showToast("This coupon code has been expired".tr());
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Invalid coupon code".tr);
|
||||
ShowToastDialog.showToast("Invalid coupon code".tr());
|
||||
}
|
||||
},
|
||||
borderRadius: 10,
|
||||
@@ -230,14 +231,14 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Order Summary".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey500)),
|
||||
Text("Order Summary".tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: AppThemeData.grey500)),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Subtotal
|
||||
_summaryTile("Subtotal".tr, Constant.amountShow(amount: controller.subTotal.value.toString()), isDark, null),
|
||||
_summaryTile("Subtotal".tr(), Constant.amountShow(amount: controller.subTotal.value.toString()), isDark, null),
|
||||
|
||||
// Discount
|
||||
_summaryTile("Discount".tr, "-${Constant.amountShow(amount: controller.discount.value.toString())}", isDark, AppThemeData.dangerDark300),
|
||||
_summaryTile("Discount".tr(), "-${Constant.amountShow(amount: controller.discount.value.toString())}", isDark, AppThemeData.dangerDark300),
|
||||
|
||||
// Tax List
|
||||
...List.generate(Constant.taxList.length, (index) {
|
||||
@@ -251,7 +252,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
const Divider(),
|
||||
|
||||
// Total
|
||||
_summaryTile("Order Total".tr, Constant.amountShow(amount: controller.totalAmount.value.toString()), isDark, null),
|
||||
_summaryTile("Order Total".tr(), Constant.amountShow(amount: controller.totalAmount.value.toString()), isDark, null),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -267,7 +268,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Title
|
||||
Text("Payment by".tr, style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
Text("Payment by".tr(), style: AppThemeData.boldTextStyle(fontSize: 14, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Row with Sender and Receiver options
|
||||
@@ -284,7 +285,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text("Sender".tr, style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
Text("Sender".tr(), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -302,7 +303,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text("Receiver".tr, style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
Text("Receiver".tr(), style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -316,7 +317,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
|
||||
// Continue button
|
||||
RoundedButtonFill(
|
||||
title: controller.paymentBy.value == "Sender" ? "Select Payment Method".tr : "Continue".tr,
|
||||
title: controller.paymentBy.value == "Sender" ? "Select Payment Method".tr() : "Continue".tr(),
|
||||
onPress: () async {
|
||||
if (controller.paymentBy.value == "Sender") {
|
||||
Get.bottomSheet(
|
||||
@@ -394,7 +395,7 @@ class ParcelOrderConfirmationScreen 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();
|
||||
@@ -408,7 +409,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
child: ListView(
|
||||
controller: scrollController,
|
||||
children: [
|
||||
Text("Preferred Payment".tr, textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
Text("Preferred Payment".tr(), textAlign: TextAlign.start, 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)
|
||||
Container(
|
||||
@@ -434,7 +435,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (controller.walletSettingModel.value.isEnabled == true || controller.cashOnDeliverySettingModel.value.isEnabled == true) const SizedBox(height: 10),
|
||||
Text("Other Payment Options".tr, textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
Text("Other Payment Options".tr(), textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -474,7 +475,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
RoundedButtonFill(
|
||||
title: "Continue".tr,
|
||||
title: "Continue".tr(),
|
||||
color: AppThemeData.taxiBooking300,
|
||||
textColor: AppThemeData.grey900,
|
||||
onPress: () async {
|
||||
@@ -496,7 +497,7 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
double walletBalance = double.tryParse(controller.userModel.value.walletAmount.toString()) ?? 0.0;
|
||||
double amountToPay = double.tryParse(controller.totalAmount.value.toString()) ?? 0.0;
|
||||
if (walletBalance < amountToPay) {
|
||||
ShowToastDialog.showToast("Insufficient wallet balance".tr);
|
||||
ShowToastDialog.showToast("Insufficient wallet balance".tr());
|
||||
return;
|
||||
}
|
||||
controller.placeOrder();
|
||||
@@ -514,14 +515,14 @@ class ParcelOrderConfirmationScreen extends StatelessWidget {
|
||||
RazorPayController().createOrderRazorPay(amount: double.parse(controller.totalAmount.value.toString()), 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.totalAmount.value.toString(), orderId: result.id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Please select payment method".tr);
|
||||
ShowToastDialog.showToast("Please select payment method".tr());
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user