import 'package:flutter/material.dart';
import 'package:pmu/data/repository/food_repository.dart';
import 'package:pmu/presentation/home_page/bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:pmu/presentation/home_page/home_page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Color(0xFFFFA400)),
        useMaterial3: true,
      ),
      home: RepositoryProvider<FoodRepository>(
        lazy: true,
        create: (_) => FoodRepository(),
        child: BlocProvider<HomeBloc>(
          lazy: false,
          create: (context) => HomeBloc(context.read<FoodRepository>()),
          child: const MyHomePage(title: "Food cort"),
        ),
      )
    );
  }
}
