mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00

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.
93 lines
3.6 KiB
Dart
93 lines
3.6 KiB
Dart
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';
|
|
import 'package:syncrow_app/features/auth/view/widgets/one_time_password/one_time_password_view.dart';
|
|
import 'package:syncrow_app/features/auth/view/widgets/privacy_policy/privacy_policy_view.dart';
|
|
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';
|
|
import 'package:syncrow_app/features/profile/view/profile_view.dart';
|
|
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
|
import 'package:syncrow_app/features/splash/view/splash_view.dart';
|
|
|
|
import 'routing_constants.dart';
|
|
|
|
class Router {
|
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
|
switch (settings.name) {
|
|
case Routes.splash:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const SplashView(), settings: settings);
|
|
|
|
case Routes.devicesRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => BlocProvider(
|
|
create: (_) => DevicesCubit.getInstance(),
|
|
child: const DevicesView(),
|
|
),
|
|
settings: settings);
|
|
|
|
case Routes.profileRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const ProfileView(), settings: settings);
|
|
|
|
case Routes.sceneRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const SceneView(), settings: settings);
|
|
|
|
case Routes.layoutRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const LayoutPage(), settings: settings);
|
|
|
|
case Routes.authLogin:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const LoginView(), settings: settings);
|
|
|
|
case Routes.authOneTimePassword:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const OneTimePasswordView(), settings: settings);
|
|
|
|
case Routes.authSignUp:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const SignUpView(), settings: settings);
|
|
|
|
case Routes.policyRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const PrivacyPolicyView(), settings: settings);
|
|
|
|
case Routes.termsRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const UserAgreementView(), settings: settings);
|
|
|
|
case Routes.authDidNotGetCode:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const DidntGetCodeView(), settings: settings);
|
|
|
|
case Routes.dashboardRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const DashboardView(), settings: settings);
|
|
|
|
case Routes.homeRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const AppLayout(), settings: settings);
|
|
|
|
case Routes.menuRoute:
|
|
return MaterialPageRoute(
|
|
builder: (_) => const MenuView(), settings: settings);
|
|
|
|
default:
|
|
return MaterialPageRoute(
|
|
builder: (_) => Scaffold(
|
|
body: Center(child: Text('No route defined for ${settings.name}')),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
}
|