Velar/Frontend/lib/main_pages/HomePage/navbar.dart

106 lines
2.7 KiB
Dart
Raw Normal View History

2025-08-06 20:28:19 -07:00
// ignore_for_file: deprecated_member_use
import 'package:flutter/material.dart';
class CustomNavBar extends StatelessWidget {
final int currentIndex;
2025-08-26 23:53:12 -07:00
final Function(int) onTap;
2025-08-06 20:28:19 -07:00
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,
2025-08-26 19:07:15 -07:00
required this.cardColor,
2025-08-06 20:28:19 -07:00
});
@override
Widget build(BuildContext context) {
2025-08-26 23:53:12 -07:00
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),
2025-08-06 20:28:19 -07:00
),
2025-08-26 23:53:12 -07:00
],
2025-08-06 20:28:19 -07:00
),
2025-08-26 23:53:12 -07:00
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
2025-08-26 19:07:15 -07:00
children: [
2025-08-26 23:53:12 -07:00
_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,
2025-08-06 20:28:19 -07:00
),
2025-08-26 23:53:12 -07:00
_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,
2025-08-06 20:28:19 -07:00
),
],
),
);
}
2025-08-26 23:53:12 -07:00
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,
),
),
],
),
),
),
);
}
2025-08-06 20:28:19 -07:00
}