BASE: Switch From EasyLocalization To GetX Localization.

This commit is contained in:
2025-12-04 16:56:39 +05:00
parent 157545f1c0
commit bf1d07a048
218 changed files with 2535 additions and 2313 deletions

View File

@@ -1,9 +1,10 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:customer/utils/app_router.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart' hide Trans;
import 'package:get/get.dart';
import 'package:firebase_auth/firebase_auth.dart' as auth;
import '../constant/constant.dart';
import '../models/referral_model.dart';
@@ -68,7 +69,7 @@ class SignUpController extends GetxController {
try {
if (!_validateInputs()) return;
ShowToastDialog.showLoader("Creating account...".tr());
ShowToastDialog.showLoader("Creating account...".tr);
if (type.value == "mobileNumber") {
await _signUpWithMobile();
@@ -80,32 +81,32 @@ class SignUpController extends GetxController {
} catch (e, st) {
ShowToastDialog.closeLoader();
debugPrint("SIGNUP OUTER EXCEPTION: $e\n$st");
ShowToastDialog.showToast("${'signup_failed'.tr()}: $e");
ShowToastDialog.showToast("${'signup_failed'.tr}: $e");
}
}
/// Validation Logic
bool _validateInputs() {
if (firstNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter first name".tr());
ShowToastDialog.showToast("Please enter first name".tr);
return false;
} else if (lastNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter last name".tr());
ShowToastDialog.showToast("Please enter last name".tr);
return false;
} else if (emailController.value.text.isEmpty ||
!emailController.value.text.isEmail) {
ShowToastDialog.showToast("Please enter a valid email address".tr());
ShowToastDialog.showToast("Please enter a valid email address".tr);
return false;
} else if (mobileController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter a valid phone number".tr());
ShowToastDialog.showToast("Please enter a valid phone number".tr);
return false;
} else if (passwordController.value.text.length < 6) {
ShowToastDialog.showToast("Password must be at least 6 characters".tr());
ShowToastDialog.showToast("Password must be at least 6 characters".tr);
return false;
} else if (passwordController.value.text !=
confirmPasswordController.value.text) {
ShowToastDialog.showToast(
"Password and Confirm password do not match".tr(),
"Password and Confirm password do not match".tr,
);
return false;
}
@@ -132,18 +133,18 @@ class SignUpController extends GetxController {
"FirebaseAuthException caught: code=${e.code}, message=${e.message}",
);
if (e.code == 'email-already-in-use') {
ShowToastDialog.showToast("Email already in use".tr());
ShowToastDialog.showToast("Email already in use".tr);
} else if (e.code == 'weak-password') {
ShowToastDialog.showToast("Password is too weak".tr());
ShowToastDialog.showToast("Password is too weak".tr);
} else if (e.code == 'invalid-email') {
ShowToastDialog.showToast("Invalid email address".tr());
ShowToastDialog.showToast("Invalid email address".tr);
} else {
ShowToastDialog.showToast(e.message ?? "signup_failed".tr());
ShowToastDialog.showToast(e.message ?? "signup_failed".tr);
}
} catch (e) {
debugPrint("Something went wrong: ${e.toString()}");
ShowToastDialog.showToast(
"${'something_went_wrong'.tr()}: ${e.toString()}",
"${'something_went_wrong'.tr}: ${e.toString()}",
);
}
}
@@ -161,7 +162,7 @@ class SignUpController extends GetxController {
_navigateBasedOnAddress(userModel.value);
} catch (e) {
ShowToastDialog.showToast("${'signup_failed'.tr()}: $e");
ShowToastDialog.showToast("${'signup_failed'.tr}: $e");
}
}
@@ -212,9 +213,9 @@ class SignUpController extends GetxController {
/// Save the default address to global constant
Constant.selectedLocation = defaultAddress;
Get.offAll(() => const ServiceListScreen());
Get.offAll(ServiceListScreen());
} else {
Get.offAll(() => const LocationPermissionScreen());
Get.offAll(LocationPermissionScreen());
}
}
}