api integration

This commit is contained in:
jayesh
2024-07-19 16:20:14 +05:30
parent 948777ee21
commit 4e768e6f6a
44 changed files with 166 additions and 113 deletions

View File

@@ -29,8 +29,9 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
on<LoginSubmitted>((event, emit) async {
if (!formKey.currentState!.validate()) {
emit(LoginLoading());
emit(
const LoginFailure("Login failed. Please check your credentials."));
emit(LoginFailure(Globalconst.languageSelected == "en"
? "Login failed. Please check your credentials."
: "فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك."));
return;
}
emit(LoginLoading());
@@ -58,8 +59,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
emit(LoginFailure(response.message.toString()));
}
} else {
emit(const LoginFailure(
"Login failed. Please check your credentials."));
emit(LoginFailure(response.message.toString()));
}
} catch (e) {
emit(LoginFailure(e.toString()));

View File

@@ -16,6 +16,7 @@ class LoginScreen extends StatelessWidget {
Widget build(BuildContext context) {
final SecureStorageService secureStorageService = SecureStorageService();
final radioBloc = context.read<RadioBloc>();
return WillPopScope(
onWillPop: () async {
if (fromScreen == "welcome" ||

View File

@@ -59,6 +59,7 @@ class BottomSection extends StatelessWidget {
successToastMessage(context, "login successful !");
goRouter.pop();
radioBloc.resetSelection();
loginbloc.resetFields();
await secureStorageService.write('isLoginedIn', "true");
goRouter.pushNamed(RouteName.pinScreen, pathParameters: {
"fromScreen":

View File

@@ -197,7 +197,7 @@ class LoginForm extends StatelessWidget {
child: FormLabelTextField(
hintText: localizations.translate(AppText.enterPassword),
title: localizations.translate(AppText.password),
type: "password",
type: "login-password",
textEditingController: loginBloc.passwordTextField,
),
),