mirrored_repositories/devfest/lib
import 'package:devfest/home/index.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'home_widgets/home_front.dart';

class HomeScreen extends StatefulWidget {

  const HomeScreen({
    Key key,
    @required HomeBloc homeBloc,
  }) : _homeBloc = homeBloc,
        super(key: key);

  final HomeBloc _homeBloc;

  @override
  HomeScreenState createState() {
    return HomeScreenState(_homeBloc);
  }
}

class HomeScreenState extends State<HomeScreen> {

  final HomeBloc _homeBloc;
  HomeScreenState(this._homeBloc);

@override
  void initState() {
    super.initState();
    this._homeBloc.dispatch(LoadHomeEvent());
  }

@override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return BlocBuilder<HomeBloc, HomeState>(
      bloc: widget._homeBloc,
      builder: (context, currentState){
        if(currentState is UnHomeState){
          return Center(child: CircularProgressIndicator(),);
        }

        return HomeFront();
      },
    );
      
  }
}