BASE: Switch From EasyLocalization To GetX Localization.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:get/get.dart';
|
||||
import '../themes/show_toast_dialog.dart';
|
||||
|
||||
class ForgotPasswordController extends GetxController {
|
||||
@@ -12,32 +11,29 @@ class ForgotPasswordController extends GetxController {
|
||||
final email = emailEditingController.value.text.trim();
|
||||
|
||||
if (email.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter your email address.".tr());
|
||||
ShowToastDialog.showToast("Please enter your email address.".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetUtils.isEmail(email)) {
|
||||
ShowToastDialog.showToast("Please enter a valid email address.".tr());
|
||||
ShowToastDialog.showToast("Please enter a valid email address.".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
ShowToastDialog.showLoader("Please wait...".tr);
|
||||
await FirebaseAuth.instance.sendPasswordResetEmail(email: email);
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast(
|
||||
'reset_password_link_sent'.tr(namedArgs: {'email': email})
|
||||
|
||||
'reset_password_link_sent'.trParams({'email': email}),
|
||||
);
|
||||
Get.back();
|
||||
} on FirebaseAuthException catch (e) {
|
||||
ShowToastDialog.closeLoader();
|
||||
if (e.code == 'user-not-found') {
|
||||
ShowToastDialog.showToast('No user found for that email.'.tr());
|
||||
ShowToastDialog.showToast('No user found for that email.'.tr);
|
||||
} else {
|
||||
ShowToastDialog.showToast(
|
||||
e.message?.tr() ?? "something_went_wrong".tr(),
|
||||
);
|
||||
ShowToastDialog.showToast(e.message?.tr ?? "something_went_wrong".tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user