import 'package:citycards_customer/home/views/registered_user_home_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../../common_bloc/bottom_navigation_bloc.dart';
import '../../common_packages/custom_bottom_navbar.dart';
import 'first_time_user_home_page.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {


  @override
  Widget build(BuildContext context) {
    return BlocBuilder<NavigationBloc, NavigationState>(
      builder: (context, state) {
        Widget body;
        switch (state.selectedIndex){
          case 0:
            body = const FirstTimeUserHomePage();
          case 1:
            body = const RegisteredUserHomePage();
            break;
          default:
            body = const FirstTimeUserHomePage();
        }
        return SafeArea(
          top: false,
          child: Scaffold(
            body: body,
            bottomNavigationBar: CustomBottomNavBar(),
          ),
        );
      }
    );
  }
}
