How to add a notification badge in bottom navigation bar

Overview

bottom_navigation_badge / BottomNavigationBadge

BottomNavigationBadge is a Flutter class developed by westdabestdb.

Getting Started

Add this to your package's pubspec.yaml file:

...
dependencies:
  bottom_navigation_badge: ^1.0.3

Now in your Dart code, you can use:

import 'package:bottom_navigation_badge/bottom_navigation_badge.dart';

Usage

Initialize the badger. Isn't it a nice variable name lol 😁

BottomNavigationBadge badger = new BottomNavigationBadge(
  backgroundColor: Colors.red,
  badgeShape: BottomNavigationBadgeShape.circle,
  textColor: Colors.white,
  position: BottomNavigationBadgePosition.topRight,
  textSize: 8);

Create a list of BottomNavigationBarItems

List<BottomNavigationBarItem> items = [
  BottomNavigationBarItem(icon: Icon(Icons.home), title: Text("Home")),
  BottomNavigationBarItem(icon: Icon(Icons.notifications), title: Text("Notifications")),
  BottomNavigationBarItem(icon: Icon(Icons.face), title: Text("Profile"))
];

Add badge to index with content "1"

setState(() {
  items = badger.setBadge(items, "1", index);
});

Remove the badge at index

setState(() {
  items = badger.removeBadge(items, index);
});

Remove all the badges

setState(() {
  items = badger.removeAll(items);
});
You might also like...

Flutter-nav-bottom-bar-tutorial - A flutter bottom navigation bar tutorial

Flutter-nav-bottom-bar-tutorial - A flutter bottom navigation bar tutorial

Flutter Bottom Navigation Bar Tutorial A tutorial with various Flutter bottom na

Oct 25, 2022

Custom bottom bar - A bottom tool bar that can be swiped left or right to expose more tools.

Custom bottom bar - A bottom tool bar that can be swiped left or right to expose more tools.

custom_bottom_bar A bottom tool bar that can be swiped left or right to expose more tools. usage Create your custom bottom bars with up to four custom

Jan 26, 2020

A beautiful and simple bottom navigation bar with smooth animation when switching selected item.

A beautiful and simple bottom navigation bar with smooth animation when switching selected item.

Titled Bottom Navigation Bar A beautiful, clean and simple bottom navigation bar with smooth animation on click. This package is high customizable, re

Dec 26, 2022

Custom Bottom navigation bar on Flutter.

Custom Bottom navigation bar on Flutter.

Intro Custom Bottom navigation bar on Flutter. The updated one Support : Null safety & Support 9 items on Tabs & Some Color, Size, Effects and font cu

Oct 8, 2021

Bottom navigation bar with sliding clip effect.

Bottom navigation bar with sliding clip effect.

Sliding Clipped Nav Bar Design Credit Toolbar icons animation by Cuberto How to use? API reference barItems → ListBarItem List of bar items that sho

Dec 3, 2022

Custom bottom navigation bar with diamond icon in the middle.

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

Dec 21, 2022

A custom bottom navigation bar with box animation for flutter

A custom bottom navigation bar with box animation for flutter

A custom bottom navigation bar with box animation. This is inspired from some of the earlier designs, but in a more simplified and yet exiting way. De

Jul 31, 2022

New trick on how to create your own custom icons in flutter with bottom bar navigation

New trick on how to create your own custom icons in flutter with bottom bar navigation

Customized Bottom Navigation Bar in Flutter | Tech With Sam Customized Bottom Navigation Bar in Flutter - Watch on youtube ✌   App Preview App Screens

Oct 26, 2022

This is repository for Spin Circle Bottom Navigation Bar Package for Flutter

This is repository for Spin Circle Bottom Navigation Bar Package for Flutter

Spin Circle Bottom Bar An easy to implement Spin Circle Bottom Navigation Bar for Flutter Applications. Current Features Initial Release for Spin Circ

Dec 22, 2022

simple flutter bottom navigation bar widget

simple flutter bottom navigation bar widget

bmnav A very flexible Flutter implementation of the Bottom Navigation Bar. Get Started Add bmanv to your pubspec.yaml file: dependencies: bmnav: ^0.

Oct 8, 2022

A 3D Bottom Navigation Bar in Flutter

A 3D Bottom Navigation Bar in Flutter

flip_box_bar A 3D BottomNavigationBar inspired by Dribbble design by Dannniel [https://dribbble.com/shots/4811135-Tab-Bar-Cube-Interaction]. Demo Exam

Nov 19, 2022

Playful and customizable bottom navigation bar for Flutter

Playful and customizable bottom navigation bar for Flutter

rolling_nav_bar A bottom nav bar with layout inspired by this design and with heavily customizable animations, colors, and shapes. Getting Started To

Dec 22, 2022

Customized 🚀 Bottom Navigation Bar Using Flutter 🐦

 Customized 🚀 Bottom Navigation Bar Using Flutter 🐦

Customized 🚀 Bottom Navigation Bar Using Flutter 🐦

Dec 7, 2022

Persistent Bottom Navigation Bar

Persistent Bottom Navigation Bar

Persistent Bottom Navigation Bar A persistent/static bottom navigation bar for Flutter. NOTE: Those migrating from pre 2.0.0 version should check the

Dec 20, 2022

A bottom navigation bar that you can customize with the options you need, without any limits.

A bottom navigation bar that you can customize with the options you need, without any limits.

Bottom Personalized Dot Bar A bottom navigation bar that you can customize with the options you need, without any limits. You can also customize the a

Oct 20, 2022

A fancy animated bottom navigation bar 💫.

A fancy animated bottom navigation bar 💫.

Stacky_bottom_nav_bar A fancy animated bottom navigation bar. Preview Default Light Mode Default Dark Mode ⚠️ IMPORTANT: when adding this widget don’t

Oct 23, 2022

Custom Shaped Bottom Navigation Bar in Flutter

Custom Shaped Bottom Navigation Bar in Flutter

CustomShapedBottomBar Custom Shaped Bottom Navigation Bar in Flutter **Usage: ** Add CustomPaint Widget to use this Painter class like this: C

May 6, 2022

Support to update the app badge on the launcher (both for Android and iOS)

Support to update the app badge on the launcher (both for Android and iOS)

Flutter App Badger plugin This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS and some Android de

Dec 25, 2022

Support to update the app badge on the launcher (both for Android and iOS)

Support to update the app badge on the launcher (both for Android and iOS)

Flutter App Badger plugin This plugin for Flutter adds the ability to change the badge of the app in the launcher. It supports iOS and some Android de

Dec 25, 2022
Comments
  • Not working when items was created with 'label' instead of 'title'

    Not working when items was created with 'label' instead of 'title'

    old

    BottomNavigationBarItem(
         icon: ImageIcon(AssetImage('assets/icons/my_profile.png')),
         title: Text('Profile'),
    )
    

    new

    BottomNavigationBarItem(
         icon: ImageIcon(AssetImage('assets/icons/my_profile.png')),
         label: 'Profile',
    )
    
    opened by esforexco 0
  • Updates for flutter 1.22

    Updates for flutter 1.22

    General update PR.

    • Updated to Flutter Embeddings v2
    • Updated to Gradle 4
    • Moved from android.support to androidx
    • Compatibility with flutter 1.22 (BottomNavigationBarItems use label instead of title)
    • improved .gitignore (however, you will still need to remove the newly ignored files from your repo)
    opened by felixgabler 0
  • Badge is giving padding on top

    Badge is giving padding on top

    Implemented this plugin, it gives bottom overflowby 12 px, tried resizing title text, warning does not go. anyhelp would be appreciated. thanks in advance

    opened by hamzai3 0
  • A Major Update (50%+ code re-write)

    A Major Update (50%+ code re-write)

    Changes:

    1. delete duplicate labels see (https://github.com/westdabestdb/bottom_navigation_badge/pull/10)
    2. migrate to support null-safety
    3. fix major bugs
    • removeAll not actually removing every badge (if you have 2 layers of the badge)
    • allowing multiple layers of the badge is a bad idea
    1. update example

    All changes above are extensively tested on the example.

    I will be happy to take on maintaining this package if you wish.

    opened by KokeCacao 0
Owner
Görkem Erol
Full stack developer
Görkem Erol
Easily add staggered animations to your ListView, GridView, Column and Row children.

Flutter Staggered Animations Easily add staggered animations to your ListView, GridView, Column and Row children as shown in Material Design guideline

null 1.2k Jan 6, 2023
A collection of Screens and attractive UIs built with Flutter ready to be used in your applications. No external libraries are used. Just download, add to your project and use.

Flutter Screens A collection of Login Screens, Buttons, Loaders and Widgets with attractive UIs, built with Flutter, ready to be used in your applicat

Samarth Agarwal 5k Dec 31, 2022
Custom Layout with interactive add button to impove your UI and UX .

Interactive Add button layout Custom Layout with interactive add button to impove your UI and UX . the package is available here inspired from Oleg Fr

Dokkar Rachid Reda 20 Sep 13, 2021
Add an indicator for a progression. You can customize indicators (shape, color, ..)

dots_indicator Widget to display dots indicator to show a position (for a PageView for example). Installation You just need to add dots_indicator as a

Jean-Charles Moussé 139 Dec 1, 2022
Fade animation - Add fade animation to your app easily

fade_animation Add fade animation to your app easily using simple_animations pac

Mazouzi Aymene 3 Oct 6, 2022
Add particle effects to anything.

Showcase Features Highly customizable (Don't like my particle effects? Make your own with little effort!) Very easy to use A lot of premade particles

Norbert Kozsir 271 Oct 2, 2022
Shimmer loading - A Flutter project to show how to add shimmer loading animation

shimmer_loading A Flutter project to show how to add shimmer loading animation.

null 0 Feb 6, 2022
Page Transition package for multiple navigation types

f_page_transition A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

VAMSI KRISHNA THANIKANTI 1 Oct 29, 2021
A Flutter package for easily implementing Material Design navigation transitions.

Morpheus A Flutter package for easily implementing Material Design navigation transitions. Examples Parent-child transition You can use MorpheusPageRo

Sander R. D. Larsen 186 Jan 7, 2023
Circular Bottom Navigation Iman KhoshabiCircular Bottom Navigation [368⭐] - Beautiful animated bottom navigation bar by Iman Khoshabi.

Circular Bottom Navigation (or maybe a tab bar). This is implementation of an artwork in Uplabs Donate Support us by becoming a patron on Patreon Let'

Iman khoshabi 523 Dec 30, 2022