2024-12-19 08:53:16 +04:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:card_app/components/locale/l10n/app_locale.dart';
|
2024-12-11 12:40:09 +04:00
|
|
|
import 'package:card_app/presentation/home_page/bloc/bloc.dart';
|
2024-10-22 14:53:02 +04:00
|
|
|
import 'package:card_app/presentation/home_page/home_page.dart';
|
2024-12-21 15:59:22 +04:00
|
|
|
import 'package:card_app/presentation/know_bloc/know_bloc.dart';
|
2024-12-19 08:53:16 +04:00
|
|
|
import 'package:card_app/presentation/locale_bloc/locale_bloc.dart';
|
|
|
|
import 'package:card_app/presentation/locale_bloc/locale_state.dart';
|
2024-12-11 12:40:09 +04:00
|
|
|
import 'package:card_app/repositories/WordsRepository.dart';
|
2024-09-08 20:09:41 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-12-11 12:40:09 +04:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2024-09-08 20:09:41 +04:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
2024-09-18 14:39:19 +04:00
|
|
|
@override
|
2024-09-08 20:09:41 +04:00
|
|
|
Widget build(BuildContext context) {
|
2024-12-19 08:53:16 +04:00
|
|
|
|
|
|
|
return BlocProvider<LocaleBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => LocaleBloc(Locale(Platform.localeName)),
|
|
|
|
child: BlocBuilder<LocaleBloc, LocaleState>(
|
|
|
|
builder: (context, state) {
|
|
|
|
|
|
|
|
return MaterialApp(
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
locale: state.currentLocale,
|
|
|
|
localizationsDelegates: AppLocale.localizationsDelegates,
|
|
|
|
supportedLocales: AppLocale.supportedLocales,
|
|
|
|
theme: ThemeData(
|
|
|
|
// Настраиваем цветовую схему приложения
|
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigoAccent),
|
|
|
|
useMaterial3: true,
|
|
|
|
),
|
|
|
|
home: RepositoryProvider<WordsRepository>(
|
|
|
|
lazy: true,
|
|
|
|
create: (_) => WordsRepository(),
|
|
|
|
child: BlocProvider<KnowBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => KnowBloc(),
|
|
|
|
child:
|
|
|
|
BlocProvider<HomeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => HomeBloc(context.read<WordsRepository>()),
|
|
|
|
child: MyHomePage(title: 'FlashCardsApp'),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2024-12-11 12:40:09 +04:00
|
|
|
),
|
2024-09-08 20:09:41 +04:00
|
|
|
);
|
2024-12-19 08:53:16 +04:00
|
|
|
|
|
|
|
|
2024-09-08 20:09:41 +04:00
|
|
|
}
|
2024-12-19 08:53:16 +04:00
|
|
|
}
|