A beautiful and animated bottom navigation bar. also you are free to customize it way you want.
items
- navigation items, required more than one item and less than sixonTap
- listen when a item is tapped it provide the selected item's index
backgroundColor
- the navigation bar's background colorheight
- changes the bottom bar heighticonSize
- the item icon's sizeshowLabel
- the item's textactiveColor
- the item selected colorinActiveColor
- the item unselected colorshowElevation
- if false the bottom bar elevation will be removedanimationDuration
- time duration for the notch and text animationinitialIndex
- set initial selected itemshowCurvedBar
- if false the bottom bar curve will be removedshowCurvedBarAnimation
- if false the bottom bar curve animation will be removed
icon
- the icon of this itemname
- the text under the icon
color
- item color
Add the dependency in pubspec.yaml
:
dependencies:
top_notch_bottom_bar: ^0.1.0
Adding the widget
class _HomePageState extends State<HomePage> {
static const TextStyle txtstyle = TextStyle(fontSize: 30);
List<Widget> screens = [
const Center(child: Text('Home', style: txtstyle)),
const Center(child: Text('Favourite', style: txtstyle)),
const Center(child: Text('Messages', style: txtstyle)),
const Center(child: Text('Settings', style: txtstyle)),
];
int index = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Top Notch Bottom Bar')),
body: screens[index],
bottomNavigationBar: TopNotchBottomBar(
height: 56, // changes the bottom bar height -> default = 50
onTap: ((value) => setState(() {
index = value;
})),
items: [
TopNotchItem(icon: const Icon(Icons.home), name: 'Home'),
TopNotchItem(icon: const Icon(Icons.favorite), name: 'Favourite'),
TopNotchItem(icon: const Icon(Icons.message), name: 'Messages'),
TopNotchItem(icon: const Icon(Icons.settings), name: 'Settings'),
]),
);
}
}