mirrored_repositories/Cinemapedia-Flutter/lib/config



import 'package:cinemapedia/presentation/screens/screens.dart';
import 'package:go_router/go_router.dart';

final appRouter = GoRouter(
  initialLocation: '/home/0',
  routes: [
    GoRoute(
      path: '/home/:page',
      name: HomeScreen.name,
      builder: (context, state) {
        final String page =  state.pathParameters['page'] ?? '0';
        return HomeScreen(page: int.parse(page));
      },
      routes: [
        GoRoute(
          path: 'movie/:id',
          name: MovieScreen.name,
          builder: (context, state) {
            final movieId = state.pathParameters['id'] ?? 'no-id';
            return MovieScreen(movieId: movieId);
          },
        ),
      ]
    ),

    // GoRoute(
    //   path: '/movie/:id',
    //   name: MovieScreen.name,
    //   builder: (context, state) {
    //     final movieId = state.pathParameters['id'] ?? 'no-id';
    //     return MovieScreen(movieId: movieId);
    //   },
    // ),

    GoRoute(
      path: '/',
      redirect: (_, __) => '/home/0',
    ),

  ]
);