56 lines
1.9 KiB
Dart
Raw Normal View History

2024-11-25 23:02:19 +04:00
import 'dart:io';
2024-09-16 15:07:17 +04:00
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart%20%20';
2024-11-25 23:02:19 +04:00
import 'package:pmu_labs/components/locale/l10n/app_locale.dart';
import 'package:pmu_labs/data/repositories/bosses_repository.dart';
import 'package:pmu_labs/presentation/home_page/bloc/bloc.dart';
2024-11-25 23:02:19 +04:00
import 'package:pmu_labs/presentation/like_bloc/like_bloc.dart';
import 'package:pmu_labs/presentation/locale_bloc/locale_bloc.dart';
import 'package:pmu_labs/presentation/locale_bloc/locale_state.dart';
2024-10-14 20:41:05 +04:00
import 'presentation/home_page/home_page.dart';
2024-09-16 15:07:17 +04:00
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
2024-10-01 00:21:59 +04:00
@override
2024-09-16 15:07:17 +04:00
Widget build(BuildContext context) {
2024-11-25 23:02:19 +04:00
return BlocProvider<LocaleBloc>(
lazy: false,
create: (context) => LocaleBloc(Locale(Platform.localeName)),
child: BlocBuilder<LocaleBloc, LocaleState>(
builder: (context, state) {
return MaterialApp(
title: 'Flutter Demo',
locale: state.currentLocale,
localizationsDelegates: AppLocale.localizationsDelegates,
supportedLocales: AppLocale.supportedLocales,
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurpleAccent),
useMaterial3: true,
),
home: RepositoryProvider<BossesRepository>(
lazy: true,
create: (_) => BossesRepository(),
child: BlocProvider<LikeBloc>(
lazy: false,
create: (context) => LikeBloc(),
child: BlocProvider<HomeBloc>(
lazy: false,
create: (context) => HomeBloc(context.read<BossesRepository>()),
child: const MyHomePage(title: 'Боссы Sekiro'),
),
),
),
);
}
),
2024-09-16 15:07:17 +04:00
);
}
}