2024-12-17 05:12:44 +04:00
|
|
|
import 'dart:io';
|
|
|
|
|
2024-11-01 22:38:39 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-12-17 05:12:44 +04:00
|
|
|
import 'package:pmu/components/locale/l10n/app_locale.dart';
|
|
|
|
import 'package:pmu/components/locale/l10n/app_locale_ru.dart';
|
2024-12-17 01:53:00 +04:00
|
|
|
import 'package:pmu/data/repository/food_repository.dart';
|
|
|
|
import 'package:pmu/presentation/home_page/bloc/bloc.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2024-11-26 11:02:52 +04:00
|
|
|
import 'package:pmu/presentation/home_page/home_page.dart';
|
2024-12-17 05:12:44 +04:00
|
|
|
import 'package:pmu/presentation/like_bloc/like_bloc.dart';
|
|
|
|
import 'package:pmu/presentation/locale_bloc/locale_bloc.dart';
|
|
|
|
import 'package:pmu/presentation/locale_bloc/locale_state.dart';
|
2024-11-01 22:38:39 +04:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-12-17 05:12:44 +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: Color(0xFFFFA400)),
|
|
|
|
useMaterial3: true,
|
|
|
|
),
|
|
|
|
home: RepositoryProvider<FoodRepository>(
|
|
|
|
lazy: true,
|
|
|
|
create: (_) => FoodRepository(),
|
|
|
|
child: BlocProvider<LikeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => LikeBloc(),
|
|
|
|
child: BlocProvider<HomeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) =>
|
|
|
|
HomeBloc(context.read<FoodRepository>()),
|
|
|
|
child: const MyHomePage(title: "Food cort"),
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
},
|
|
|
|
));
|
2024-11-01 22:38:39 +04:00
|
|
|
}
|
|
|
|
}
|