2024-12-19 18:44:53 +04:00
|
|
|
import 'dart:io';
|
|
|
|
|
2024-09-17 20:55:24 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-12-13 04:00:50 +04:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2024-12-19 13:20:27 +04:00
|
|
|
import 'package:pmu/data/repositories/api_repository.dart';
|
2024-12-13 04:00:50 +04:00
|
|
|
import 'package:pmu/presentation/home_page/bloc/bloc.dart';
|
2024-11-26 15:44:55 +04:00
|
|
|
import 'package:pmu/presentation/home_page/home_page.dart';
|
2024-12-19 18:44:53 +04:00
|
|
|
import 'package:pmu/presentation/like/bloc.dart';
|
|
|
|
import 'package:pmu/presentation/locale/bloc.dart';
|
|
|
|
import 'package:pmu/presentation/locale/state.dart';
|
|
|
|
|
|
|
|
import 'components/locale/l10n/app_locale.dart';
|
2024-09-17 20:55:24 +04:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-12-19 18:44:53 +04:00
|
|
|
return BlocProvider<LocaleBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => LocaleBloc(Locale(Platform.localeName)),
|
|
|
|
child: BlocBuilder<LocaleBloc, LocaleState>(
|
|
|
|
builder: (context, state) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'LoveSearch',
|
|
|
|
locale: state.currentLocale,
|
|
|
|
localizationsDelegates: AppLocale.localizationsDelegates,
|
|
|
|
supportedLocales: AppLocale.supportedLocales,
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
home: RepositoryProvider<ApiRepository>(
|
|
|
|
lazy: true,
|
|
|
|
create: (_) => ApiRepository(),
|
|
|
|
child: BlocProvider<LikeBloc>(
|
|
|
|
lazy: true,
|
|
|
|
create: (context) => LikeBloc(),
|
|
|
|
child: BlocProvider<HomeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) =>
|
|
|
|
HomeBloc(context.read<ApiRepository>()),
|
|
|
|
child: const HomePage()),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2024-09-17 20:55:24 +04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|