Refactor email and password validation logic in LoginForm widget

Update email and password validation logic in the LoginForm widget to only
perform validation when the state is not AuthTokenError. This ensures that
validation is skipped when there is an authentication token error.
This commit is contained in:
Mohammad Salameh
2024-04-02 18:09:23 +03:00
parent ef41940333
commit 9cc479ba17
13 changed files with 57 additions and 60 deletions

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/view/app_layout.dart';
import 'package:syncrow_app/features/auth/view/widgets/didnt_get_code/didnt_get_code_view.dart';
import 'package:syncrow_app/features/auth/view/widgets/login/login_view.dart';
@ -7,6 +8,7 @@ import 'package:syncrow_app/features/auth/view/widgets/privacy_policy/privacy_po
import 'package:syncrow_app/features/auth/view/widgets/sign_up/sign_up_view.dart';
import 'package:syncrow_app/features/auth/view/widgets/user_agreement/user_agreement_view.dart';
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/features/devices/view/devices_view.dart';
import 'package:syncrow_app/features/layout/view/layout_view.dart';
import 'package:syncrow_app/features/menu/view/menu_view.dart';
@ -25,7 +27,11 @@ class Router {
case Routes.devicesRoute:
return MaterialPageRoute(
builder: (_) => const DevicesView(), settings: settings);
builder: (_) => BlocProvider(
create: (_) => DevicesCubit.getInstance(),
child: const DevicesView(),
),
settings: settings);
case Routes.profileRoute:
return MaterialPageRoute(