lab7 ready
This commit is contained in:
parent
3588ff0f02
commit
168a9e287c
@ -1,8 +1,14 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:testlab/presentaition/home_page/home_page.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:testlab/presentaition/home_page/bloc/bloc.dart';
|
||||
import 'data/repositories/potter_films_repository.dart';
|
||||
import 'package:testlab/presentaition/like_bloc/like_bloc.dart';
|
||||
import 'package:testlab/presentaition/locale_bloc/locale_bloc.dart';
|
||||
import 'package:testlab/presentaition/locale_bloc/locale_state.dart';
|
||||
import 'components/locale/l10n/app_locale.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@ -13,21 +19,36 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: RepositoryProvider<PotterFilmsRepository>(
|
||||
lazy: true,
|
||||
create: (_) => PotterFilmsRepository(),
|
||||
child: BlocProvider<HomeBloc>(
|
||||
lazy: false,
|
||||
create: (context) => HomeBloc(context.read<PotterFilmsRepository>()),
|
||||
child: const MyHomePage(title: 'Фирсов Кирилл Алексеевич'),
|
||||
),
|
||||
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.deepPurple),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: RepositoryProvider<PotterFilmsRepository>(
|
||||
lazy: true,
|
||||
create: (_) => PotterFilmsRepository(),
|
||||
child: BlocProvider<LikeBloc>(
|
||||
lazy: false,
|
||||
create: (context) => LikeBloc(),
|
||||
child: BlocProvider<HomeBloc>(
|
||||
lazy: false,
|
||||
create: (context) => HomeBloc(context.read<PotterFilmsRepository>()),
|
||||
child: const MyHomePage(title: 'Фирсов Кирилл Алексеевич'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user