2024-09-16 15:06:59 +04:00
|
|
|
import 'package:flutter/material.dart';
|
2024-09-30 04:34:25 +04:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:pmd/data/repositories/mock_repository.dart';
|
|
|
|
import 'package:pmd/data/repositories/potter_repository.dart';
|
|
|
|
import 'package:pmd/home_page/bloc/bloc.dart';
|
2024-09-20 16:16:06 +04:00
|
|
|
import 'package:pmd/home_page/home_page.dart';
|
2024-09-16 15:06:59 +04:00
|
|
|
|
|
|
|
void main() {
|
2024-09-17 03:13:55 +04:00
|
|
|
runApp(const MyApp());
|
2024-09-16 15:06:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
2024-09-17 03:13:55 +04:00
|
|
|
const MyApp({super.key});
|
|
|
|
|
2024-09-16 15:06:59 +04:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
2024-09-17 03:13:55 +04:00
|
|
|
title: 'Flutter Demo',
|
2024-09-16 15:15:08 +04:00
|
|
|
debugShowCheckedModeBanner: false,
|
2024-09-16 15:06:59 +04:00
|
|
|
theme: ThemeData(
|
2024-09-20 16:16:06 +04:00
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
2024-09-17 03:13:55 +04:00
|
|
|
useMaterial3: true,
|
2024-09-16 15:06:59 +04:00
|
|
|
),
|
2024-09-30 04:34:25 +04:00
|
|
|
home: RepositoryProvider<PotterRepository>(
|
|
|
|
lazy: true,
|
|
|
|
create: (_) => PotterRepository(),
|
|
|
|
child: BlocProvider<HomeBloc>(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => HomeBloc(context.read<PotterRepository>()),
|
|
|
|
child: const MyHomePage(title: 'Laboratory 6: Architecture (Debounce and Bloc)'),
|
|
|
|
),
|
|
|
|
),
|
2024-09-16 15:06:59 +04:00
|
|
|
);
|
|
|
|
}
|
2024-09-17 03:13:55 +04:00
|
|
|
}
|