2024-12-12 13:54:24 +04:00
|
|
|
import 'dart:io';
|
|
|
|
|
2024-09-09 23:23:55 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-12-12 00:08:22 +04:00
|
|
|
import 'package:flutter_android_app/presentation/home_page/bloc/bloc.dart';
|
2024-10-03 00:24:49 +04:00
|
|
|
import 'package:flutter_android_app/presentation/home_page/home_page.dart';
|
2024-12-12 13:54:24 +04:00
|
|
|
import 'package:flutter_android_app/presentation/like_bloc/like_bloc.dart';
|
|
|
|
import 'package:flutter_android_app/presentation/locale_bloc/locale_bloc.dart';
|
|
|
|
import 'package:flutter_android_app/presentation/locale_bloc/locale_state.dart';
|
2024-12-15 23:23:00 +04:00
|
|
|
import 'package:flutter_android_app/repositories/mock_repository.dart';
|
2024-12-12 00:08:22 +04:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2024-09-09 23:23:55 +04:00
|
|
|
|
2024-12-12 13:54:24 +04:00
|
|
|
import 'components/locale/l10n/app_localizations.dart';
|
|
|
|
|
2024-09-09 23:23:55 +04:00
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-12-12 13:54:24 +04:00
|
|
|
return BlocProvider<LikeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => LikeBloc(),
|
|
|
|
child: BlocProvider<LocaleBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => LocaleBloc(Locale(Platform.localeName)),
|
|
|
|
child: BlocBuilder<LocaleBloc, LocaleState>(
|
|
|
|
builder: (context, state) => MaterialApp(
|
2024-12-15 23:23:00 +04:00
|
|
|
title: 'Cryptocurrency Exchange App',
|
2024-12-12 13:54:24 +04:00
|
|
|
locale: state.currentLocale,
|
|
|
|
localizationsDelegates: AppLocale.localizationsDelegates,
|
|
|
|
supportedLocales: AppLocale.supportedLocales,
|
|
|
|
theme: ThemeData(
|
2024-12-15 23:23:00 +04:00
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigoAccent),
|
2024-12-12 13:54:24 +04:00
|
|
|
useMaterial3: true,
|
|
|
|
),
|
2024-12-15 23:23:00 +04:00
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
home: RepositoryProvider<MockRepository>(
|
2024-12-12 13:54:24 +04:00
|
|
|
lazy: true,
|
2024-12-15 23:23:00 +04:00
|
|
|
create: (_) => MockRepository(),
|
2024-12-12 13:54:24 +04:00
|
|
|
child: BlocProvider<HomeBloc>(
|
|
|
|
lazy: false,
|
2024-12-15 23:23:00 +04:00
|
|
|
create: (context) => HomeBloc(context.read<MockRepository>()),
|
|
|
|
child: const MyHomePage(title: 'Cryptocurrency Exchange'),
|
2024-12-12 13:54:24 +04:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2024-12-12 00:08:22 +04:00
|
|
|
),
|
|
|
|
),
|
2024-09-09 23:23:55 +04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|