The BottomNavbar
widget is a customizable bottom navigation bar component built for Flutter applications. It provides an intuitive way to navigate between different sections of your app.
- Customizable Icons: Easily replace icons for various sections.
- Dynamic Content: Updates displayed content based on the selected index.
-
Add this package to your
pubspec.yaml
:dependencies: flutter: sdk: flutter # other dependencies...
-
Install dependencies:
flutter pub get
-
Import the widget:
import 'package:flutter/material.dart'; // Import the BottomNavbar widget. import 'path_to_bottom_navbar/bottom_navbar.dart';
-
Implement the
BottomNavbar
widget:class MyHomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('My App'), ), body: Center( child: Text('My App Content Here'), ), bottomNavigationBar: BottomNavbar(), ); } }
-
Customize the icons and labels to suit your app's sections:
BottomNavigationBar( onTap: (index) { // Handle taps and navigate accordingly. }, currentIndex: _selectedIndex, items: const [ BottomNavigationBarItem( icon: Icon(Icons.home), label: 'Home', ), BottomNavigationBarItem( icon: Icon(Icons.phone), label: 'Calls', ), // Add more items as needed... ], )
You can add 2 or more icons/ buttons on navbar.
The state changes on tapping the desired icon/button on navbar, this is implemented in BottomNavbar class
Special thanks to the Flutter community and contributors for their valuable libraries and resources.