mirrored_repositories/Bazaar-Online-Shopping/lib
import 'package:bazaar/Pages/CartList.dart';
import 'package:bazaar/Pages/ProductList.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';

import 'package:flutter/material.dart';
import 'package:bazaar/Providers/CartProvider.dart';
import 'package:bazaar/Providers/FavoriteProvider.dart';

import '../Pages/FavoriteList.dart';
import '../Pages/Profile.dart';

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

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final List<Widget> _pages = [
    const ProductList(),
    FavoriteList(),
    CartList(),
    const Profile(),
  ];

  int currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Color.fromARGB(255, 252, 206, 34),
          leading: const Padding(
            padding: EdgeInsets.only(left: 8.0),
            child: CircleAvatar(
              radius: 20,
              backgroundImage: NetworkImage(
                  'https://picsum.photos/200'), //Todo: Get User Image
            ),
          ),
          title: Text(
            'Welcome Back, Mohamed',
            style: TextStyle(fontSize: 18),
          ), //Todo: Get User Name
          actions: [
            IconButton(
              onPressed: () {},
              icon: const Icon(Icons.logout),
            ),
          ],
        ),
        body: _pages[currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: currentIndex,
          onTap: (index) {
            setState(() {
              currentIndex = index;
            });
          },
          selectedItemColor: Color.fromARGB(255, 252, 206, 34),
          unselectedItemColor: Colors.white60,
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: 'Home',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.favorite),
              label: 'Favorite',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.shopping_cart),
              label: 'Cart',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: 'Profile',
            ),
          ],
        ));
  }
}
