BASE: Implement Localization In My Cab Booking Screen.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:customer/constant/const_texts.dart';
|
||||
import 'package:customer/controllers/Intercity_home_controller.dart';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:customer/constant/const_texts.dart';
|
||||
import 'package:customer/models/cab_order_model.dart';
|
||||
import 'package:customer/payment/createRazorPayOrderModel.dart';
|
||||
import 'package:customer/payment/rozorpayConroller.dart';
|
||||
@@ -5,6 +6,7 @@ import 'package:customer/screen_ui/auth_screens/login_screen.dart';
|
||||
import 'package:customer/screen_ui/multi_vendor_service/wallet_screen/wallet_screen.dart';
|
||||
import 'package:customer/themes/round_button_fill.dart';
|
||||
import 'package:customer/themes/show_toast_dialog.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -38,7 +40,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
backgroundColor: AppThemeData.primary300,
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Row(children: [const SizedBox(width: 10), Text("Ride History".tr, style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900))]),
|
||||
child: Row(children: [const SizedBox(width: 10), Text(ConstTexts.rideHistory.tr(), style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900))]),
|
||||
),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(48),
|
||||
@@ -81,17 +83,17 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text("Please Log In to Continue".tr, style: TextStyle(color: isDark ? AppThemeData.grey100 : AppThemeData.grey800, fontSize: 22, fontFamily: AppThemeData.semiBold)),
|
||||
Text(ConstTexts.plsLoginToAcc.tr(), style: TextStyle(color: isDark ? AppThemeData.grey100 : AppThemeData.grey800, fontSize: 22, fontFamily: AppThemeData.semiBold)),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
"You’re not logged in. Please sign in to access your account and explore all features.".tr,
|
||||
ConstTexts.youAreNotLoggedIn.tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontSize: 16, fontFamily: AppThemeData.bold),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
RoundedButtonFill(
|
||||
borderRadius: 10.r,
|
||||
title: "Log in".tr,
|
||||
title: ConstTexts.login.tr(),
|
||||
width: 55,
|
||||
height: 5.5,
|
||||
color: AppThemeData.primary300,
|
||||
@@ -109,7 +111,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
final orders = controller.getOrdersForTab(title);
|
||||
|
||||
if (orders.isEmpty) {
|
||||
return Center(child: Text("No order found".tr, style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)));
|
||||
return Center(child: Text(ConstTexts.noOrderfound.tr(), style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)));
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
@@ -133,7 +135,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${'Booking Date:'.tr} ${controller.formatDate(order.scheduleDateTime!)}".tr,
|
||||
"${'Booking Date:'.tr} ${controller.formatDate(order.scheduleDateTime!)}",
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 18, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
),
|
||||
@@ -220,7 +222,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text("Otp :".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
Text("Otp :", style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
|
||||
SizedBox(width: 5),
|
||||
Text(order.otpCode ?? '', style: AppThemeData.semiBoldTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
],
|
||||
@@ -229,7 +231,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
order.status == Constant.orderInTransit && order.paymentStatus == false
|
||||
? RoundedButtonFill(
|
||||
borderRadius: 10.r,
|
||||
title: "Pay Now".tr,
|
||||
title: ConstTexts.payNow.tr(),
|
||||
onPress: () async {
|
||||
controller.selectedPaymentMethod.value = order.paymentMethod.toString();
|
||||
controller.calculateTotalAmount(order);
|
||||
@@ -273,7 +275,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("Select Payment Method".tr, style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
Text(ConstTexts.selectPaymentMethod.tr(), style: AppThemeData.mediumTextStyle(fontSize: 18, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
@@ -288,7 +290,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
padding: EdgeInsets.zero,
|
||||
controller: scrollController,
|
||||
children: [
|
||||
Text("Preferred Payment".tr, textAlign: TextAlign.start, style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
|
||||
Text(ConstTexts.prefferedPayment.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(
|
||||
@@ -319,7 +321,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Other Payment Options".tr,
|
||||
ConstTexts.otherPaymentOptions.tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: AppThemeData.boldTextStyle(fontSize: 15, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
|
||||
),
|
||||
@@ -365,12 +367,12 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
),
|
||||
RoundedButtonFill(
|
||||
borderRadius: 10.r,
|
||||
title: "Continue".tr,
|
||||
title: ConstTexts.continueT.tr(),
|
||||
color: AppThemeData.primary300,
|
||||
textColor: AppThemeData.grey900,
|
||||
onPress: () async {
|
||||
if (controller.selectedPaymentMethod.value.isEmpty) {
|
||||
ShowToastDialog.showToast("Please select a payment method".tr);
|
||||
ShowToastDialog.showToast(ConstTexts.plsSelectPaymentMethod.tr());
|
||||
} else {
|
||||
if (controller.selectedPaymentMethod.value == PaymentGateway.stripe.name) {
|
||||
controller.stripeMakePayment(amount: controller.totalAmount.value.toString());
|
||||
@@ -388,7 +390,7 @@ class MyCabBookingScreen extends StatelessWidget {
|
||||
controller.completeOrder();
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.wallet.name) {
|
||||
if (Constant.userModel!.walletAmount == null || Constant.userModel!.walletAmount! < controller.totalAmount.value) {
|
||||
ShowToastDialog.showToast("You do not have sufficient wallet balance".tr);
|
||||
ShowToastDialog.showToast(ConstTexts.youDoNothaveSufficientwalletBalance.tr());
|
||||
} else {
|
||||
controller.completeOrder();
|
||||
}
|
||||
@@ -402,14 +404,14 @@ class MyCabBookingScreen 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(ConstTexts.somethingWentWrong.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(ConstTexts.plsSelectPaymentMethod.tr());
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user