pmu_flutter/lec6/lib/main.dart

39 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:test_app/data/repository/potter_repository.dart';
import 'package:test_app/view/home_page/bloc/bloc.dart';
import 'package:test_app/view/home_page/home_page.dart';
import 'package:test_app/view/home_page/like_bloc/like_bloc.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My Test App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: RepositoryProvider<PotterRepository>(
lazy: true,
create: (_) => PotterRepository(),
child: BlocProvider<HomeBloc>(
lazy: true,
create: (context) => HomeBloc(context.read<PotterRepository>()),
child: BlocProvider<LikeBloc>(
lazy: true,
create: (context) => LikeBloc(),
child: const MyHomePage(title: 'My Test App'),
),
),
));
}
}