// ignore_for_file: deprecated_member_use import 'package:flutter/material.dart'; class CustomNavBar extends StatelessWidget { final int currentIndex; final Function(int) onTap; final Color backgroundColor; final Color accentColor; final Color primaryColor; final Color cardColor; const CustomNavBar({ super.key, required this.currentIndex, required this.onTap, required this.backgroundColor, required this.accentColor, required this.primaryColor, required this.cardColor, }); @override Widget build(BuildContext context) { return Container( height: 80, // Fixed height for bottom navigation decoration: BoxDecoration( color: backgroundColor, boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, -2), ), ], ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ _buildNavItem( icon: Icons.home_outlined, activeIcon: Icons.home_rounded, label: 'Home', index: 0, ), _buildNavItem( icon: Icons.analytics_outlined, activeIcon: Icons.analytics_rounded, label: 'Analytics', index: 1, ), _buildNavItem( icon: Icons.account_balance_wallet_outlined, activeIcon: Icons.account_balance_wallet_rounded, label: 'Budget', index: 2, ), _buildNavItem( icon: Icons.person_outlined, activeIcon: Icons.person_rounded, label: 'Profile', index: 3, ), ], ), ); } Widget _buildNavItem({ required IconData icon, required IconData activeIcon, required String label, required int index, }) { final isActive = currentIndex == index; return Expanded( child: Material( color: Colors.transparent, child: InkWell( onTap: () => onTap(index), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( isActive ? activeIcon : icon, color: isActive ? accentColor : primaryColor.withOpacity(0.6), size: 24, ), const SizedBox(height: 4), Text( label, style: TextStyle( color: isActive ? accentColor : primaryColor.withOpacity(0.6), fontSize: 12, fontWeight: isActive ? FontWeight.w600 : FontWeight.w500, ), ), ], ), ), ), ); } }