Skip to content

Commit

Permalink
update routes
Browse files Browse the repository at this point in the history
  • Loading branch information
HamiiidAsgarian committed Sep 18, 2024
1 parent 31bd5da commit 4952649
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions lib/core/rouing/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ import 'package:flutter_showcase/features/auth/presentation/login_screen.dart';
import 'package:flutter_showcase/features/auth/presentation/login_screen_bloc.dart';
import 'package:flutter_showcase/features/auth/presentation/signup_screen.dart';
import 'package:flutter_showcase/features/auth/presentation/signup_screen_bloc.dart';
import 'package:flutter_showcase/features/home/home_screen.dart';
import 'package:flutter_showcase/features/onboarding/domain/repository/auth_repository.dart';
import 'package:flutter_showcase/features/onboarding/presentation/onboarding_bloc.dart';
import 'package:flutter_showcase/features/onboarding/presentation/onboarding_screen.dart';
import 'package:flutter_showcase/features/splash/presentation/spash_bloc.dart';
import 'package:flutter_showcase/features/splash/presentation/splash_screen.dart';
import 'package:go_router/go_router.dart';

/// Contains the main app routing.
///
/// * [Routes], the enum for the different routes.
enum Routes { onBoarding, login, singup }
enum Routes { splash, onBoarding, login, singup, home }

/// * [GoRouter], the class from the go_router package that handles the routing.
class AppRouter {
Expand All @@ -21,13 +25,26 @@ class AppRouter {
/// Returns the [GoRouter] that handles the app's routing.
static GoRouter getRoutes() {
return GoRouter(
initialLocation: '/login',
initialLocation: '/splash',
routes: <RouteBase>[
GoRoute(
path: '/splash',
name: Routes.splash.name,
builder: (context, state) => BlocProvider(
create: (context) => SplashBloc(
authRepository: getIt<IAuthRepository>(),
onBoardingRepository: getIt<IOnboardingRepository>(),
),
child: const SplashScreen(),
),
),
GoRoute(
path: '/onboarding',
name: Routes.onBoarding.name,
builder: (context, state) => BlocProvider(
create: (context) => OnBoardingBloc(),
create: (context) => OnBoardingBloc(
onboardingRepository: getIt<IOnboardingRepository>(),
),
child: const OnBoardingScreen(),
),
),
Expand All @@ -51,6 +68,16 @@ class AppRouter {
child: const SignUpScreen(),
),
),
GoRoute(
path: '/home',
name: Routes.home.name,
builder: (context, state) => BlocProvider(
create: (context) => SignUpScreeBloc(
authRepository: getIt<IAuthRepository>(),
),
child: const HomeScreen(),
),
),
],
);
}
Expand Down

0 comments on commit 4952649

Please sign in to comment.