import 'package:flutter/material.dart'; import '../widgets/main_app_bar.dart'; import 'dashboard_screen.dart'; import 'order_screen.dart'; import 'invoice_screen.dart'; import 'chat_screen.dart'; import 'settings_screen.dart'; class MainBottomNav extends StatefulWidget { const MainBottomNav({super.key}); @override State createState() => MainBottomNavState(); } class MainBottomNavState extends State { int _currentIndex = 0; void setIndex(int index) { setState(() { _currentIndex = index; }); } final List _screens = const [ DashboardScreen(), OrdersScreen(), InvoiceScreen(), ChatScreen(), SettingsScreen(), ]; @override Widget build(BuildContext context) { return Scaffold( appBar: const MainAppBar(), body: _screens[_currentIndex], bottomNavigationBar: BottomNavigationBar( currentIndex: _currentIndex, selectedItemColor: Colors.red, unselectedItemColor: Colors.black, type: BottomNavigationBarType.fixed, onTap: (index) { setState(() => _currentIndex = index); }, items: const [ BottomNavigationBarItem(icon: Icon(Icons.dashboard_outlined), label: "Dashboard"), BottomNavigationBarItem(icon: Icon(Icons.shopping_bag_outlined), label: "Orders"), BottomNavigationBarItem(icon: Icon(Icons.receipt_long_outlined), label: "Invoice"), BottomNavigationBarItem(icon: Icon(Icons.chat_bubble_outline), label: "Chat"), BottomNavigationBarItem(icon: Icon(Icons.settings_outlined), label: "Settings"), ], ), ); } }