forked from eatvio/eatvio_app
67 lines
3.0 KiB
Dart
67 lines
3.0 KiB
Dart
import 'package:eatvio_app/core/app_router.dart';
|
|
import 'package:eatvio_app/core/locator_service.dart' as di;
|
|
import 'package:eatvio_app/core/locator_service.dart';
|
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
|
|
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/notifications_cubit/notifications_cubit.dart';
|
|
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
|
|
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
|
|
import 'package:eatvio_app/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart';
|
|
import 'package:eatvio_app/features/internet_connection_checker/internet_connection_checker_screen.dart';
|
|
import 'package:eatvio_app/generated/l10n.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
|
import 'package:flutter_portal/flutter_portal.dart';
|
|
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
|
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
|
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
|
await di.init();
|
|
await SentryFlutter.init(
|
|
(options) {
|
|
options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2';
|
|
options.tracesSampleRate = 1.0;
|
|
},
|
|
appRunner: () => runApp(MyApp()),
|
|
);
|
|
FlutterNativeSplash.remove();
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider<NewMessagesCubit>(create: (context) => sl<NewMessagesCubit>()),
|
|
BlocProvider<NotificationsCubit>(create: (context) => sl<NotificationsCubit>()),
|
|
BlocProvider<FeedCubit>(create: (context) => sl<FeedCubit>()..loadFeedBlogPostList()),
|
|
BlocProvider<ProfileAvatarCubit>(create: (context) => sl<ProfileAvatarCubit>()..getMyProfile()),
|
|
BlocProvider<ChatsCubit>(create: (context) => sl<ChatsCubit>()..getChatRoomsWithLoading()),
|
|
],
|
|
child: Portal(
|
|
child: KeyboardDismisser(
|
|
child: MaterialApp.router(
|
|
theme: ThemeHelper().themeData(),
|
|
routerConfig: AppRouter.appRouter,
|
|
builder: (context, child) => InternetConnectionCheckerScreen(child: child!),
|
|
debugShowCheckedModeBanner: false,
|
|
localizationsDelegates: const [
|
|
S.delegate,
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
supportedLocales: [
|
|
Locale.fromSubtags(languageCode: 'ru'),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|