import 'package:flutter/material.dart'; import 'package:animated_bottom_navigation_bar/animated_bottom_navigation_bar.dart'; class CustomBottomNavigationBar extends StatefulWidget { final Function(int) onTabChanged; final List icons; final List labels; // Add labels list final int initialIndex; const CustomBottomNavigationBar({ Key? key, required this.onTabChanged, required this.icons, required this.labels, this.initialIndex = 0, }) : super(key: key); @override _CustomBottomNavigationBarState createState() => _CustomBottomNavigationBarState(); } class _CustomBottomNavigationBarState extends State { late int _currentIndex; @override void initState() { super.initState(); _currentIndex = widget.initialIndex; } @override Widget build(BuildContext context) { return AnimatedBottomNavigationBar.builder( itemCount: widget.icons.length, tabBuilder: (int index, bool isActive) { Color backgroundColor = Color(0xFFFFFCE5); Color iconColor = isActive ? Color(0xFFE26728) : Color(0xFF404040); TextStyle textStyle = TextStyle( color: iconColor, fontSize: 10, fontWeight: isActive ? FontWeight.w400 : FontWeight.normal, ); return Container( color: backgroundColor, padding: EdgeInsets.all(8), // Adjust padding as needed child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( widget.icons[index], size: 24, color: iconColor, ), SizedBox(height: 2), // Spacing between icon and text Text( widget.labels[index], style: textStyle, ), ], ), ); }, activeIndex: _currentIndex, gapLocation: GapLocation.none, notchSmoothness: NotchSmoothness.verySmoothEdge, leftCornerRadius: 32, rightCornerRadius: 32, onTap: (index) { setState(() { _currentIndex = index; widget.onTabChanged(index); }); }, ); } }