Flutter notification badge on app icon



Flutter is a new mobile app development framework by Google. The framework allows for the quick and easy development of mobile apps by using the Dart programming language. Flutter also allows for widgets to be created that work across both iOS and Android platforms.

Flutter Badge on app icon

In this project, a Flutter badge widget will be created that will have the ability to display a number of different badges depending on the type of event that is occurring.

Read also, Flutter Photo View Example.

How install this package for your app project?

Add this dependency:

dependencies:
  badges: ^2.0.1

Import this Package:

import 'package:badges/badges.dart';

Flutter Badges:

Badge(
           badgeContent: Text('15'),
           badgeColor: Colors.redAccent,
           child: Icon(Icons.message,size: 50,color:Colors.blue),
         ),

You can Change Badges Shape:

shape: BadgeShape.square,

You can add also Animation:

BadgeAnimationType.slide
//or
BadgeAnimationType.scale
//or
BadgeAnimationType.fade

Flutter Badges Example

Flutter Badges

Flutter Badges Tutorial Code Example:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:badges/badges.dart';


void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HOMEWIDGET(),
    );
  }
}

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

  @override
  _HOMEWIDGETState createState() => _HOMEWIDGETState();


}
class _HOMEWIDGETState extends State<HOMEWIDGET> {


  @override
  Widget build(BuildContext context) {
    return Scaffold(
       body: Center(
         child: Badge(
           badgeContent: Text('15'),
           badgeColor: Colors.redAccent, 
           child: Icon(Icons.message,size: 50,color:Colors.blue),
         ),
       )

    );
  }
}

  • How to Conduct YouTube Keyword Research Easily?
    Introduction YouTube is the second largest search engine in the world, making it a valuable platform for content creators and businesses alike. To maximize your visibility and reach on YouTube, it is crucial to conduct proper keyword research. By identifying the right keywords, you can optimize your videos for search and increase your chances of …

    Read more …

  • How to upgrade the Dart SDK version in flutter
    If you’re a Flutter developer, you know how important it is to stay up-to-date with the latest version of the Dart SDK. Upgrading the Dart SDK ensures that you have access to the latest features, bug fixes, and performance improvements. Step 1: Check Your Current Dart SDK Version Before you begin the upgrade process, it’s …

    Read more …

  • Why Do Advertisers Use Testimonials?
    In the ever-competitive business landscape, nurturing strong connections with your customers remains paramount for enhancing your credibility and positioning yourself as an industry authority. Establishing credibility is the bedrock upon which trust is built, ultimately translating into increased sales. To bolster your company’s credibility, integrating testimonial advertising into your marketing strategy is essential. So, what …

    Read more …

  • How To Earn $5 Fast Method!
    Looking to boost your income by $25 in less than an hour? This isn’t the start of a clichéd sales pitch; it’s about discovering several quick and simple ways to earn $5 online within minutes. For instance, you can make five bucks by completing tasks such as taking brief surveys, participating in short website usability …

    Read more …

  • What Does BMF Mean On TikTok? Latest Social Media Acronyms
    In the fast-paced world of social media, acronyms are the language of choice, enabling users to communicate swiftly without the need for lengthy phrases. While classics like LOL and OMG are still in use, the younger generation on TikTok has introduced a new acronym into the mix: BMF. So, what exactly does BMF mean, and …

    Read more …

Leave a Comment