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

@@ -4,6 +4,7 @@ import 'package:customer/themes/show_toast_dialog.dart';
import 'package:customer/utils/utils.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:dropdown_textfield/dropdown_textfield.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
@@ -51,9 +52,9 @@ class BookParcelScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Book Your Document Delivery".tr, style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900)),
Text("Book Your Document Delivery".tr(), style: AppThemeData.boldTextStyle(fontSize: 18, color: AppThemeData.grey900)),
Text(
"Schedule a secure and timely pickup & delivery".tr,
"Schedule a secure and timely pickup & delivery".tr(),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: AppThemeData.mediumTextStyle(fontSize: 12, color: AppThemeData.grey900),
@@ -78,7 +79,7 @@ class BookParcelScreen extends StatelessWidget {
const SizedBox(height: 16),
buildInfoSectionView(
title: "Sender Information".tr,
title: "Sender Information".tr(),
locationController: controller.senderLocationController.value,
nameController: controller.senderNameController.value,
mobileController: controller.senderMobileController.value,
@@ -101,7 +102,7 @@ class BookParcelScreen extends StatelessWidget {
controller.senderLocationController.value.text = address; // ✅
controller.senderLocation.value = UserLocation(latitude: lat, longitude: lng); // ✅ <-- Add this
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
}
} else {
@@ -113,7 +114,7 @@ class BookParcelScreen extends StatelessWidget {
controller.senderLocationController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.senderLocation.value = UserLocation(latitude: selectedLocationModel.latLng!.latitude, longitude: selectedLocationModel.latLng!.longitude);
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
// ✅ <-- Add this
}
@@ -123,7 +124,7 @@ class BookParcelScreen extends StatelessWidget {
),
const SizedBox(height: 16),
buildInfoSectionView(
title: "Receiver Information".tr,
title: "Receiver Information".tr(),
locationController: controller.receiverLocationController.value,
nameController: controller.receiverNameController.value,
mobileController: controller.receiverMobileController.value,
@@ -147,7 +148,7 @@ class BookParcelScreen extends StatelessWidget {
controller.receiverLocationController.value.text = address; // ✅
controller.receiverLocation.value = UserLocation(latitude: lat, longitude: lng);
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
}
} else {
@@ -159,7 +160,7 @@ class BookParcelScreen extends StatelessWidget {
controller.receiverLocationController.value.text = Utils.formatAddress(selectedLocation: selectedLocationModel);
controller.receiverLocation.value = UserLocation(latitude: selectedLocationModel.latLng!.latitude, longitude: selectedLocationModel.latLng!.longitude); // ✅ <-- Add this
} else {
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr);
ShowToastDialog.showToast("Service is unavailable at the selected address.".tr());
}
}
});
@@ -170,7 +171,7 @@ class BookParcelScreen extends StatelessWidget {
const SizedBox(height: 15),
RoundedButtonFill(
title: "Continue".tr,
title: "Continue".tr(),
onPress: () {
controller.bookNow();
},
@@ -197,7 +198,7 @@ class BookParcelScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Select delivery type".tr, style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500, fontSize: 13)),
Text("Select delivery type".tr(), style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500, fontSize: 13)),
const SizedBox(height: 10),
InkWell(
onTap: () {
@@ -208,7 +209,7 @@ class BookParcelScreen extends StatelessWidget {
children: [
Image.asset("assets/images/image_parcel.png", height: 38, width: 38),
const SizedBox(width: 20),
Expanded(child: Text("As soon as possible".tr, style: AppThemeData.semiBoldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 16))),
Expanded(child: Text("As soon as possible".tr(), style: AppThemeData.semiBoldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 16))),
Icon(
controller.selectedDeliveryType.value == 'now' ? Icons.radio_button_checked : Icons.radio_button_off,
color: controller.selectedDeliveryType.value == 'now' ? AppThemeData.primary300 : (isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
@@ -229,7 +230,7 @@ class BookParcelScreen extends StatelessWidget {
children: [
Image.asset("assets/images/image_parcel_scheduled.png", height: 38, width: 38),
const SizedBox(width: 20),
Expanded(child: Text("Scheduled".tr, style: AppThemeData.semiBoldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 16))),
Expanded(child: Text("Scheduled".tr(), style: AppThemeData.semiBoldTextStyle(color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900, fontSize: 16))),
Icon(
controller.selectedDeliveryType.value == 'later' ? Icons.radio_button_checked : Icons.radio_button_off,
color: controller.selectedDeliveryType.value == 'later' ? AppThemeData.primary300 : (isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
@@ -242,7 +243,7 @@ class BookParcelScreen extends StatelessWidget {
GestureDetector(
onTap: () => controller.pickScheduledDate(context),
child: TextFieldWidget(
hintText: "When to pickup at this address".tr,
hintText: "When to pickup at this address".tr(),
controller: controller.scheduledDateController.value,
enable: false,
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
@@ -254,7 +255,7 @@ class BookParcelScreen extends StatelessWidget {
GestureDetector(
onTap: () => controller.pickScheduledTime(context),
child: TextFieldWidget(
hintText: "When to pickup at this address".tr,
hintText: "When to pickup at this address".tr(),
controller: controller.scheduledTimeController.value,
enable: false,
// onchange: (v) => controller.pickScheduledTime(context),
@@ -283,7 +284,7 @@ class BookParcelScreen extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Upload parcel image".tr, style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500, fontSize: 13)),
Text("Upload parcel image".tr(), style: AppThemeData.boldTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500, fontSize: 13)),
const SizedBox(height: 10),
DottedBorder(
options: RoundedRectDottedBorderOptions(strokeWidth: 1, radius: const Radius.circular(10), color: isDark ? AppThemeData.greyDark300 : AppThemeData.grey300),
@@ -296,13 +297,13 @@ class BookParcelScreen extends StatelessWidget {
children: [
SvgPicture.asset("assets/icons/ic_upload_parcel.svg", height: 40, width: 40),
const SizedBox(height: 10),
Text("Upload Parcel Image".tr, style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
Text("Upload Parcel Image".tr(), style: AppThemeData.mediumTextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900)),
const SizedBox(height: 4),
Text("Supported: .jpg, .jpeg, .png".tr, style: AppThemeData.semiBoldTextStyle(fontSize: 12, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
Text("Max size 1MB".tr, style: AppThemeData.semiBoldTextStyle(fontSize: 12, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
Text("Supported: .jpg, .jpeg, .png".tr(), style: AppThemeData.semiBoldTextStyle(fontSize: 12, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
Text("Max size 1MB".tr(), style: AppThemeData.semiBoldTextStyle(fontSize: 12, color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800)),
const SizedBox(height: 8),
RoundedButtonFill(
title: "Browse Image".tr,
title: "Browse Image".tr(),
onPress: () {
controller.onCameraClick(Get.context!);
},
@@ -378,7 +379,7 @@ class BookParcelScreen extends StatelessWidget {
GestureDetector(
onTap: onTap,
child: TextFieldWidget(
hintText: "Your Location".tr,
hintText: "Your Location".tr(),
controller: locationController,
suffix: const Padding(padding: EdgeInsets.only(right: 10), child: Icon(Icons.location_on_outlined)),
@@ -390,7 +391,7 @@ class BookParcelScreen extends StatelessWidget {
const SizedBox(height: 10),
TextFieldWidget(
hintText: "Name".tr,
hintText: "Name".tr(),
controller: nameController,
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
borderColor: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200,
@@ -398,7 +399,7 @@ class BookParcelScreen extends StatelessWidget {
const SizedBox(height: 10),
TextFieldWidget(
hintText: "Enter Mobile number".tr,
hintText: "Enter Mobile number".tr(),
controller: mobileController,
textInputType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(10)],
@@ -435,7 +436,7 @@ class BookParcelScreen extends StatelessWidget {
clearOption: false,
enableSearch: false,
textFieldDecoration: InputDecoration(
hintText: "Select parcel Weight".tr,
hintText: "Select parcel Weight".tr(),
hintStyle: AppThemeData.regularTextStyle(fontSize: 14, color: isDark ? AppThemeData.grey400 : AppThemeData.greyDark400),
filled: true,
fillColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
@@ -447,8 +448,8 @@ class BookParcelScreen extends StatelessWidget {
dropDownList:
controller.parcelWeight.map((e) {
return DropDownValueModel(
name: e.title ?? 'Normal'.tr,
value: e.title ?? 'Normal'.tr, // safer to use title string
name: e.title ?? 'Normal'.tr(),
value: e.title ?? 'Normal'.tr(), // safer to use title string
);
}).toList(),
onChanged: (val) {
@@ -464,7 +465,7 @@ class BookParcelScreen extends StatelessWidget {
const SizedBox(height: 10),
TextFieldWidget(
hintText: "Notes (Optional)".tr,
hintText: "Notes (Optional)".tr(),
controller: noteController,
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
borderColor: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200,