Bottom Bar
Bottom bar helps create an optimized bottom navigation bar with beautiful animations. This package is inspired by bottom_navy_bar and has many improvements over it:
- BottomBarItem's width is dynamic and not fixed (Bottom_bar vs bottom_navy_bar)
- Dark Mode Support
- More optimized (BottomBarItem vs BottomNavyBarItem)
- Allows inserting keys for each
BottomBarItemfor widget testing

Content
Installation
Add bottom_bar to pubspec.yaml
dependencies:
bottom_bar: ^1.3.0+1
Parameters
BottomBar
Creates a BottomBar that displays a list of BottomBarItem
selectedIndex-Indexof selected itembackgroundColor- Background Color ofBottomBarshowActiveBackgroundColor- Shows the background color ofBottomBarItemwhen it is active and when this is set to truecurve-Curveof animationduration-Durationof animationheight- Height ofBottomBaritems- List of BottomBarItem to displayitemPadding-Paddingbetween the background color and (Rowthat contains icon and title)onTap- Fires whenever aBottomBarItemis tappedtextStyle-TextStyleoftitlewidget (Only applied when widget isText)
BottomBarItem
Contains information about the item that BottomBar has to display
icon-IconofBottomBarIteminactiveIcon- Icon to display whenBottomBarItemis not activetitle-TitleofBottomBarItemactiveColor-Coloroficon,title, andbackgroundofBottomBarItemduring light mode when it is selecteddarkActiveColor-Coloroficon,title, andbackgroundofBottomBarItemduring dark mode when it is selectedinactiveColor-Coloroficon,title, andbackgroundofBottomBarItemwhen it is not selected
Usage
Import the Package
import 'package:bottom_bar/bottom_bar.dart';
Example
int _currentPage = 0;
final _pageController = PageController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: _pageController,
children: [
Container(color: Colors.blue),
Container(color: Colors.red),
Container(color: Colors.greenAccent.shade700),
Container(color: Colors.orange),
],
onPageChanged: (index) {
// Use a better state management solution
// setState is used for simplicity
setState(() => _currentPage = index);
},
),
bottomNavigationBar: BottomBar(
selectedIndex: _currentPage,
onTap: (int index) {
_pageController.jumpToPage(index);
setState(() => _currentPage = index);
},
items: <BottomBarItem>[
BottomBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
activeColor: Colors.blue,
),
BottomBarItem(
icon: Icon(Icons.favorite),
title: Text('Favorites'),
activeColor: Colors.red,
darkActiveColor: Colors.red.shade400, // Optional
),
BottomBarItem(
icon: Icon(Icons.person),
title: Text('Account'),
activeColor: Colors.greenAccent.shade700,
darkActiveColor: Colors.greenAccent.shade400, // Optional
),
BottomBarItem(
icon: Icon(Icons.settings),
title: Text('Settings'),
activeColor: Colors.orange,
),
],
),
);
}
Community Support
If you have any suggestions or issues, feel free to open an issue
If you would like to contribute, feel free to create a PR