mirrored_repositories/real_estate_ui/lib
import 'package:flutter/material.dart';
import 'package:real_estate_ui/screens/homescreen.dart';
import 'package:real_estate_ui/screens/profile_screen.dart';
import 'package:real_estate_ui/screens/search_screen.dart';
import 'package:real_estate_ui/screens/wishlist_screen.dart';

class DashboardScreen extends StatefulWidget {
  const DashboardScreen({Key? key}) : super(key: key);

  @override
  State<DashboardScreen> createState() => _DashboardScreenState();
}

class _DashboardScreenState extends State<DashboardScreen> {
  int _selectedIndex = 0;

  final List<Widget> _pages = <Widget>[
    HomeScreen(),
    SearchScreen(),
    WishlistScreen(),
    ProfileScreen(),
  ];

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: _pages.elementAt(_selectedIndex),
      ),
      // bottom bar
      bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        selectedFontSize: 15,
        selectedIconTheme: IconThemeData(color: Color.fromARGB(255, 8, 5, 163)),
        selectedItemColor: Color.fromARGB(255, 8, 5, 163),
        selectedLabelStyle: const TextStyle(fontWeight: FontWeight.bold),
        unselectedItemColor: Colors.grey,
        unselectedLabelStyle: const TextStyle(color: Colors.grey),
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
              icon: Icon(
                Icons.home,
                size: 26,
              ),
              label: 'Home'),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.search_rounded,
                size: 26,
              ),
              label: 'Search'),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.favorite_border_outlined,
                size: 26,
              ),
              label: 'WishList'),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.message_outlined,
                size: 26,
              ),
              label: 'Inbox')
        ],
        currentIndex: _selectedIndex,
        onTap: _onItemTapped,
      ),
    );
  }
}
