254 lines
8.0 KiB
Dart
254 lines
8.0 KiB
Dart
|
|
import 'package:citycards_customer/add_details/add_details_view.dart';
|
|
import 'package:citycards_customer/attraction_details/views/attraction_details_view.dart';
|
|
import 'package:citycards_customer/attractions/models/attraction_model.dart';
|
|
import 'package:citycards_customer/buy_a_pass/view/buy_pass_view.dart';
|
|
import 'package:citycards_customer/checkout/view/checkout_view.dart';
|
|
import 'package:citycards_customer/common_bloc/language_selection_bloc.dart';
|
|
import 'package:citycards_customer/create_account/view/create_account_view.dart';
|
|
import 'package:citycards_customer/esim_offer/esim_offer_view.dart';
|
|
import 'package:citycards_customer/hotel_offer/hotel_offer_view.dart';
|
|
import 'package:citycards_customer/intro_screens/views/intro_screen_view.dart';
|
|
import 'package:citycards_customer/itinerary_creation/bloc/itinerary_detail_bloc.dart';
|
|
import 'package:citycards_customer/itinerary_creation/bloc/itinerary_steps_selection_bloc.dart';
|
|
import 'package:citycards_customer/itinerary_creation/views/itinerary_creation_start_view.dart';
|
|
import 'package:citycards_customer/itinerary_creation/views/itinerary_creation_view.dart';
|
|
import 'package:citycards_customer/itinerary_creation/views/magic_itinerary_empty_view.dart';
|
|
import 'package:citycards_customer/itinerary_creation/views/magic_itinerary_view.dart';
|
|
import 'package:citycards_customer/offer_pass_detail/offer_pass_detail_view.dart';
|
|
import 'package:citycards_customer/search_offers/bloc/search_offers_listing_bloc.dart';
|
|
import 'package:citycards_customer/search_offers/view/search_offers_with_listing.dart';
|
|
import 'package:citycards_customer/splash_screen/views/splash_screen.dart';
|
|
import 'package:citycards_customer/trail.dart';
|
|
import 'package:citycards_customer/your_itinerary/view/your_itinerary_view.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import '../attractions/views/attractions_page_view.dart';
|
|
import '../cart/views/my_cart_view_page.dart';
|
|
import '../common_bloc/bottom_navigation_bloc.dart';
|
|
import '../home/views/home_page_view.dart';
|
|
import '../home/views/registered_user_home_page.dart';
|
|
import '../profile/view/contact_us/contact_us_view.dart';
|
|
import '../profile/view/edit_profile/edit_profile_view.dart';
|
|
import '../profile/view/faq/faq_view.dart';
|
|
import '../profile/view/privacy/privacy_view.dart';
|
|
import '../profile/view/profile_page_view.dart';
|
|
import '../profile/view/terms_and_condition/terms_and_condition_view.dart';
|
|
import '../search_offers/bloc/offers_bloc.dart';
|
|
import '../search_offers/repository/offers_repository.dart';
|
|
import 'route_constants.dart';
|
|
|
|
class AppRouter {
|
|
Route onGenerateRoute(RouteSettings settings) {
|
|
print('Navigating to route: ${settings.name}');
|
|
switch (settings.name) {
|
|
case '/':
|
|
case RouteConstants.home:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return BlocProvider(
|
|
create: (_) => NavigationBloc(),
|
|
child: const HomePage(),
|
|
);
|
|
},
|
|
);
|
|
|
|
case RouteConstants.splash:
|
|
print('✅ Splash route matched');
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return SplashScreen();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.intro:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return IntroScreensView();
|
|
},
|
|
);
|
|
case RouteConstants.attractionsPage:
|
|
final args = settings.arguments as String;
|
|
return MaterialPageRoute(builder: (_) => AttractionsPage(source: args));
|
|
case RouteConstants.profile:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return BlocProvider(
|
|
create: (_) => LanguageBloc(),
|
|
child: const ProfilePage(),
|
|
);
|
|
},
|
|
);
|
|
case RouteConstants.editProfile:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return const EditProfilePage();
|
|
},
|
|
);
|
|
case RouteConstants.contactUs:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return const ContactUsPage();
|
|
},
|
|
);
|
|
case RouteConstants.faq:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return const FaqPage();
|
|
},
|
|
);
|
|
case RouteConstants.termsAndCondition:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return const TermsAndCondition();
|
|
},
|
|
);
|
|
case RouteConstants.privacyPolicy:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return const PrivacyPolicyPage();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.itineraryCreationStart:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return ItineraryCreationStartPage();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.itineraryCreation:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider<ItineraryStepNavigationBloc>(
|
|
create: (_) => ItineraryStepNavigationBloc(),
|
|
),
|
|
|
|
BlocProvider<AddItineraryDetailBloc>(
|
|
create: (_) => AddItineraryDetailBloc(),
|
|
),
|
|
],
|
|
child: const ItineraryCreationPage(),
|
|
);
|
|
},
|
|
);
|
|
|
|
case RouteConstants.hotelOffer:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return HotelOfferView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.esimOffer:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return EsimOfferPage();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.attractionDetails:
|
|
final attractionId = settings.arguments as Attraction;
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return AttractionDetailsView(attractionId: attractionId.id,);
|
|
},
|
|
);
|
|
|
|
case RouteConstants.buyPass:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return BuyPassView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.checkout:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return CheckoutView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.cartPage:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return MyCartPage();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.searchOffer:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return BlocProvider(
|
|
create: (_) => OffersBloc(OffersRepository()),
|
|
child: OffersScreen(),
|
|
);
|
|
},
|
|
);
|
|
|
|
case RouteConstants.addDetails:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return AddDetailsView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.createAcct:
|
|
final email = settings.arguments as String;
|
|
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return CreateAccountView(
|
|
email: email, // ✅ required param
|
|
);
|
|
},
|
|
);
|
|
|
|
case RouteConstants.yourItinerary:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return YourItineraryView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.magicItineraryEmptyScreen:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return MagicItineraryEmptyView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.magicItineraryFilledScreen:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return MagicItineraryView();
|
|
},
|
|
);
|
|
|
|
case RouteConstants.offerPassDetail:
|
|
final offerId = settings.arguments as int;
|
|
|
|
return MaterialPageRoute(
|
|
builder: (_) => OffersDetailsView(
|
|
offerId: offerId,
|
|
),
|
|
);
|
|
|
|
|
|
case RouteConstants.registeredUserHome:
|
|
return MaterialPageRoute(
|
|
builder: (_) {
|
|
return RegisteredUserHomePage();
|
|
},
|
|
);
|
|
default:
|
|
return MaterialPageRoute(
|
|
builder: (_) =>
|
|
const Scaffold(body: Center(child: Text('404 - Page Not Found'))),
|
|
);
|
|
}
|
|
}
|
|
}
|