forked from eatvio/eatvio_app
54 lines
2.3 KiB
Dart
54 lines
2.3 KiB
Dart
import 'package:eatvio_app/core/locator_service.dart';
|
|
import 'package:eatvio_app/core/views/cubit/views_cubit.dart';
|
|
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart';
|
|
import 'package:eatvio_app/features/notifications/presentation/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';
|
|
|
|
/// Конфигурация приложения
|
|
class AppConfig {
|
|
/// Список глобальных BlocProvider'ов
|
|
static List<BlocProvider> get globalBlocProviders => [
|
|
BlocProvider<NewMessagesCubit>(create: (context) => sl<NewMessagesCubit>()),
|
|
BlocProvider<NotificationsCubit>(
|
|
create: (context) => sl<NotificationsCubit>()..getNotifications(),
|
|
),
|
|
BlocProvider<FeedCubit>(
|
|
create: (context) => sl<FeedCubit>()..loadFeedBlogPostList(),
|
|
),
|
|
BlocProvider<ProfileAvatarCubit>(
|
|
create: (context) => sl<ProfileAvatarCubit>()..getMyProfile(),
|
|
),
|
|
BlocProvider<ChatsCubit>(
|
|
create: (context) => sl<ChatsCubit>()..getChatRoomsWithLoading(),
|
|
),
|
|
];
|
|
|
|
/// Делегаты локализации
|
|
static const List<LocalizationsDelegate> localizationDelegates = [
|
|
S.delegate,
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
];
|
|
|
|
/// Поддерживаемые локали
|
|
static const List<Locale> supportedLocales = [
|
|
Locale.fromSubtags(languageCode: 'ru'),
|
|
];
|
|
|
|
/// Создание обертки для проверки интернет-соединения
|
|
static Widget createInternetConnectionWrapper(Widget child) {
|
|
return BlocProvider(
|
|
create: (context) => sl<ViewsCubit>(),
|
|
child: InternetConnectionCheckerScreen(child: child),
|
|
);
|
|
}
|
|
}
|