169 lines
6.5 KiB
Dart
169 lines
6.5 KiB
Dart
import 'package:citycards_customer/cart/blocs/myPostcardsCart/my_postcards_cart_bloc.dart';
|
|
import 'package:citycards_customer/cart/blocs/postcard_bloc.dart';
|
|
import 'package:citycards_customer/cart/repository/my_pass_cart_repository.dart';
|
|
import 'package:citycards_customer/core/route_constants.dart';
|
|
import 'package:citycards_customer/postcard/blocs/postcard_creation_bloc.dart';
|
|
import 'package:citycards_customer/search_offers/bloc/offers_bloc.dart';
|
|
import 'package:citycards_customer/trail.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:flutter_stripe/flutter_stripe.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
|
|
import 'common_bloc/language_selection_bloc.dart';
|
|
import 'cart/blocs/myPassCart/my_pass_cart_bloc.dart';
|
|
import 'common_bloc/bottom_navigation_bloc.dart';
|
|
import 'core/app_router.dart';
|
|
import 'core/global_keys.dart';
|
|
import 'home/bloc/FirstTimeUserHome/first_time_user_home_bloc.dart';
|
|
import 'home/bloc/FirstTimeUserHome/first_time_user_home_event.dart';
|
|
import 'home/bloc/registeredHome/home_bloc.dart';
|
|
import 'home/repository/first_time_user_home_repository.dart';
|
|
import 'home/repository/home_repository.dart';
|
|
import 'itinerary_creation/bloc/createItinerary/create_itinerary_bloc.dart';
|
|
import 'itinerary_creation/bloc/get_itinerary_bloc.dart';
|
|
import 'itinerary_creation/views/magic_itinerary_view.dart';
|
|
import 'l10n/app_localizations.dart';
|
|
import 'login/bloc/login/login_bloc.dart';
|
|
import 'login/repository/login_repository.dart';
|
|
import 'my_pass/blocs/myPasses/my_passes_bloc.dart';
|
|
import 'my_pass/blocs/my_pass_bloc.dart';
|
|
import 'my_pass/repository/my_passes_repository.dart';
|
|
import 'postcard/blocs/myPostCards/my_postcard_bloc.dart';
|
|
import 'postcard/repository/my_postcard_repository.dart';
|
|
import 'profile/bloc/profile/profile_bloc.dart';
|
|
import 'search_offers/repository/offers_repository.dart';
|
|
import 'search_offers/view/search_offers_with_listing.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
await SystemChrome.setPreferredOrientations([
|
|
DeviceOrientation.portraitUp,
|
|
]);
|
|
|
|
Stripe.publishableKey =
|
|
'pk_test_51SrwZ7RtCkWyT4EmmP5ozlEVEscMvWPDPVshQbNdQe1S27iGkwZ7YD4BSEm7TUvvlgPRvznuQq6daVyA9p1UWNnz00WVsaw2Yj';
|
|
|
|
SystemChrome.setSystemUIOverlayStyle(
|
|
const SystemUiOverlayStyle(
|
|
statusBarColor: Colors.white,
|
|
statusBarIconBrightness: Brightness.dark,
|
|
statusBarBrightness: Brightness.light,
|
|
),
|
|
);
|
|
|
|
runApp(MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
MyApp({super.key});
|
|
|
|
final AppRouter _appRouter = AppRouter();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ScreenUtilInit(
|
|
designSize: const Size(360, 844), // ✅ your design size
|
|
minTextAdapt: true,
|
|
splitScreenMode: true,
|
|
builder: (context, child) {
|
|
return MediaQuery(
|
|
// 🔥 FIX: control font scaling (important)
|
|
data: MediaQuery.of(context).copyWith(
|
|
textScaleFactor:
|
|
MediaQuery.of(context).textScaleFactor.clamp(0.9, 1.1),
|
|
// OR use 1.0 if you want strict control
|
|
// textScaleFactor: 1.0,
|
|
),
|
|
child: MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider<MyPassBloc>(
|
|
create: (_) => MyPassBloc()..add(LoadMyPasses()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => PostcardCreationBloc(),
|
|
),
|
|
BlocProvider<NavigationBloc>(
|
|
create: (_) => NavigationBloc(),
|
|
),
|
|
BlocProvider<MyPassesBloc>(
|
|
create: (_) => MyPassesBloc(MyPassesRepository()),
|
|
),
|
|
BlocProvider<MyPassCartBloc>(
|
|
create: (_) =>
|
|
MyPassCartBloc(repository: MyPassCartRepository()),
|
|
),
|
|
BlocProvider<MyPostCardsCartBloc>(
|
|
create: (_) => MyPostCardsCartBloc(),
|
|
),
|
|
BlocProvider<FirstTimeUserHomeBloc>(
|
|
create: (context) => FirstTimeUserHomeBloc(
|
|
FirstTimeUserHomeRepository(),
|
|
)..add(FetchFirstTimeUserHomeEvent()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => HomeBloc(
|
|
homeRepository: HomeRepository(),
|
|
),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => LoginBloc(
|
|
loginRepository: LoginRepository(),
|
|
),
|
|
),
|
|
BlocProvider(
|
|
create: (_) => OffersBloc(OffersRepository()),
|
|
child: const OffersScreen(),
|
|
),
|
|
BlocProvider(create: (context) => ProfileBloc()),
|
|
BlocProvider<MyPostCardBloc>(
|
|
create: (context) => MyPostCardBloc(
|
|
repository: MyPostCardsRepository(),
|
|
),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => GetItineraryBloc(),
|
|
child: MagicItineraryView(),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => CreateItineraryBloc(),
|
|
),
|
|
BlocProvider<LanguageBloc>(
|
|
create: (context) =>
|
|
LanguageBloc()..add(LoadSavedLanguage()),
|
|
),
|
|
],
|
|
child: BlocBuilder<LanguageBloc, LanguageState>(
|
|
builder: (context, languageState) {
|
|
return MaterialApp(
|
|
scaffoldMessengerKey: GlobalKeys.scaffoldMessengerKey,
|
|
onGenerateRoute: _appRouter.onGenerateRoute,
|
|
initialRoute: RouteConstants.splash,
|
|
debugShowCheckedModeBanner: false,
|
|
title: 'City Cards',
|
|
locale: languageState.locale,
|
|
localizationsDelegates: const [
|
|
AppLocalizations.delegate,
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
theme: ThemeData(
|
|
textTheme: GoogleFonts.poppinsTextTheme(
|
|
Theme.of(context).textTheme,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
} |