PIbd-32_Shabunov_O.A._Mobil.../lib/main.dart

55 lines
1.9 KiB
Dart
Raw Normal View History

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';
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(
title: 'Cryptocurrency Exchange App',
2024-12-12 13:54:24 +04:00
locale: state.currentLocale,
localizationsDelegates: AppLocale.localizationsDelegates,
supportedLocales: AppLocale.supportedLocales,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigoAccent),
2024-12-12 13:54:24 +04:00
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
home: RepositoryProvider<MockRepository>(
2024-12-12 13:54:24 +04:00
lazy: true,
create: (_) => MockRepository(),
2024-12-12 13:54:24 +04:00
child: BlocProvider<HomeBloc>(
lazy: false,
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
);
}
}