Flutter bottom nav bar plugin

Overview

Pub Awesome Flutter

bottom_nav_bar

An easy-to-use and clean bottom navigation bar.

Preview 1 Preview 2
Preview 1 Preview 2
Preview 3
---------
Preview 3

Available Customization options

BottomNavBar

  • iconSize - the item icon's size
  • items - navigation items, item length should be from 3 to 5
  • selectedIndex - the current item index. Use this to change the selected item. Defaults to zero
  • onItemSelected - required to listen when an item is tapped it provides the selected item's index
  • backgroundColor - the navigation bar's background color
  • showElevation - if false the appBar's elevation will be removed
  • mainAxisAlignment - use this property to change the horizontal alignment of the items. It is mostly used when you have ony two items and you want to center the items
  • curve - param to customize the item change's animation
  • containerHeight - changes the Navigation Bar's height
  • containerPadding - changes the Navigation Bar's padding

BottomNavBarItem

  • icon - the icon of this item
  • title - the text that will appear next to the icon when this item is selected
  • activeColor - the active item's icon and text color
  • inactiveColor - the inactive item's icon color
  • activeBackgroundColor - the active item's background color
  • inactiveBackgroundColor - the inactive item's background color

Basic Widget

import 'package:bottom_nav_bar/bottom_nav_bar.dart';

bottomNavigationBar: BottomNavBar(
        showElevation: true,
        selectedIndex: _currentIndex,
        onItemSelected: (index) {
          setState(() => _currentIndex = index);
        },
        items: <BottomNavBarItem>[
          BottomNavBarItem(
            title: 'Home',
            icon: const Icon(Icons.home),
            activeColor: Colors.white,
            inactiveColor: Colors.black,
            activeBackgroundColor: Colors.red.shade300,
          ),
          BottomNavBarItem(
            title: 'Profile',
            icon: const Icon(Icons.person),
            activeColor: Colors.white,
            inactiveColor: Colors.black,
            activeBackgroundColor: Colors.blue.shade300,
          ),
          BottomNavBarItem(
            title: 'Message',
            icon: const Icon(Icons.chat_bubble),
            inactiveColor: Colors.black,
            activeColor: Colors.white,
            activeBackgroundColor: Colors.green.shade300,
          ),
          BottomNavBarItem(
            title: 'Settings',
            icon: const Icon(Icons.settings),
            inactiveColor: Colors.black,
            activeColor: Colors.black,
            activeBackgroundColor: Colors.yellow.shade300,
          ),
        ],
      )

Full Example using IndexedStack

import 'package:bottom_nav_bar/bottom_nav_bar.dart';

class RootPage extends StatefulWidget {
  const RootPage({Key? key}) : super(key: key);

  @override
  _RootPageState createState() => _RootPageState();
}

class _RootPageState extends State<RootPage> {
  int _currentIndex = 0;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _body(),
      bottomNavigationBar: _bottomNavBar(),
    );
  }

  Widget _body() => SizedBox.expand(
        child: IndexedStack(
          index: _currentIndex,
          children: const <Widget>[
            PageOne(),
            PageTwo(),
            PageThree(),
            PageFour(),
          ],
        ),
      );

  Widget _bottomNavBar() => BottomNavBar(
        showElevation: true,
        selectedIndex: _currentIndex,
        onItemSelected: (index) {
          setState(() => _currentIndex = index);
        },
        items: <BottomNavBarItem>[
          BottomNavBarItem(
            title: 'Home',
            icon: const Icon(Icons.home),
            activeColor: Colors.white,
            inactiveColor: Colors.black,
            activeBackgroundColor: Colors.red.shade300,
          ),
          BottomNavBarItem(
            title: 'Profile',
            icon: const Icon(Icons.person),
            activeColor: Colors.white,
            inactiveColor: Colors.black,
            activeBackgroundColor: Colors.blue.shade300,
          ),
          BottomNavBarItem(
            title: 'Message',
            icon: const Icon(Icons.chat_bubble),
            inactiveColor: Colors.black,
            activeColor: Colors.white,
            activeBackgroundColor: Colors.green.shade300,
          ),
          BottomNavBarItem(
            title: 'Settings',
            icon: const Icon(Icons.settings),
            inactiveColor: Colors.black,
            activeColor: Colors.black,
            activeBackgroundColor: Colors.yellow.shade300,
          ),
        ],
      );
}
You might also like...

This plugin allows Flutter desktop apps to resizing and repositioning the window.

window_manager This plugin allows Flutter desktop apps to resizing and repositioning the window. window_manager Platform Support Quick Start Installat

Jan 3, 2023

A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Oct 1, 2022

This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut).

hotkey_manager This plugin allows Flutter desktop apps to defines system/inapp wide hotkey (i.e. shortcut). hotkey_manager Platform Support Quick Star

Dec 21, 2022

A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux & Android.

A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux & Android.

flutter_media_metadata A Flutter plugin to read metadata of media files. A part of Harmonoid open source project 💜 Install Add in your pubspec.yaml.

Dec 2, 2022

Flutter plugin to store data behind biometric authentication (ie. fingerprint)

biometric_storage Encrypted file store, optionally secured by biometric lock for Android, iOS, MacOS and partial support for Linux, Windows and Web. M

Jan 6, 2023

flutter app upgrade plugin

flutter app upgrade plugin

官网地址:http://laomengit.com/plugin/upgrade.html 添加依赖 1、在pubspec.yaml中加入: dependencies: flutter_app_upgrade: ^1.1.0 2、执行flutter命令获取包: flutter pub get`

Dec 17, 2022

A Flutter plugin that supports Pangle SDK on Android and iOS.

A Flutter plugin that supports Pangle SDK on Android and iOS.

Thanks for non-commercial open source development authorization by JetBrains. 穿山甲 Flutter SDK `pangle_flutter`是一款集成了字节跳动穿山甲 Android 和 iOS SDK的 Flutter

Dec 2, 2022

Flutter plugin that detects the charset (encoding) of text bytes

Flutter plugin that detects the charset (encoding) of text bytes

flutter_charset_detector Automatically detect and decode the charset (character encoding) of text bytes. The example app; details This plugin uses nat

Jun 8, 2022

A Flutter plugin for retrieving the device locale information.

A Flutter plugin for retrieving the device locale information.

A Flutter plugin for retrieving the device locale information. Installation Add this to your package's pubspec.yaml file: dependencies: flutter_devi

Sep 8, 2022
Owner
Sujan Gainju
Computer engineer, Flutter Developer, Freelancer
Sujan Gainju
Bottom Sheet Expandable Bar for Flutter

Bottom Sheet Expandable Bar This package create a bottom navigation bar with the capability to show a bottom sheet. Instalation Include bottom_sheet_e

Aarón J. Montes 8 Oct 31, 2022
Custom bottom navigation bar with diamond icon in the middle.

Pub.dev Scaled List Custom bottom navigation bar with diamond icon in the middle you can customize the number of items either be Five or three. Usage

Hosain Mohamed 4 Dec 21, 2022
A beautiful navigation bar to use in flutter

Beauty Navigation A beautiful navigation bar to use in flutter Inspired from the #dribbble shot by Mauricio Bucardo @m.bucardo Usage Add the Package i

Poojan Pandya 21 Oct 26, 2021
A library of Flutter to add a new style in the navigation bar.

Navigation Dot Bar Una libreria de Flutter, el cual agrega un BottomNavigationBar con un mejor estilo. Inspirada en la aplicacion "Reflectly" Como usa

null 38 Oct 17, 2022
A simple and beautiful animated app bar created with Flutter.

Animated App Bar Flutter application showcasing the creation of an animated app bar. End Result Relevant YouTube Video https://youtu.be/SkkmoT_DZUA Ge

Vihar 23 Jan 15, 2022
Connectionstatusbar - Flutter connection status bar, widget that animates when internet connection changes

connection_status_bar A widget that animates when internet connection changes Getting Started add it to your dependencies then use it anywhere on your

Amir Ghezelbash 112 Nov 23, 2022
Flutter Music Player - First Open Source Flutter based material design music player with audio plugin to play local music files.

Flutter Music Player First Open Source Flutter based Beautiful Material Design Music Player(Online Radio will be added soon.) Demo App Play Store BETA

Pawan Kumar 1.5k Jan 8, 2023
A Flutter plugin for the Google Mobile Ads SDK

A Flutter plugin for the Google Mobile Ads SDK

Google Ads 251 Jan 2, 2023
Flutter plugin that allows users to create TextAvatar easily!

Colorize Text Avatar Colorize Text Avatar is a package to generate avatar based on your user initials. It supports to generate avatars based on your s

Deniz Çolak 17 Dec 14, 2022
Official plugin for using Thepeer SDK with flutter https://thepeer.co

Flutter Thepeer This package makes it easy to use the Thepeer in a flutter project. ?? Screen Shots ?? How to Use plugin ThePeer Send Launch ThepeerSe

The Peer 23 Dec 27, 2022