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 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),
),
)
);
}
}
- Boost WooCommerce Security: Set Up OTP Login in WordPressPasswords, while essential for security, can be vulnerable to hacking and breaches. To add an extra layer of protection for your WooCommerce store, consider implementing an OTP (One-Time Password) login. This guide walks you through the process of setting up an OTP login in WordPress for enhanced security. Why Use OTP Login? Enhanced Security: OTPs …
- How to Create Woocommerce Flutter App for WordPress freeAbsolutely! Let’s break down how to create a WooCommerce Flutter app for your WordPress store. Here’s a comprehensive outline of the process and essential considerations: 1. Setup Your Development Environment 2. Project Structure 3. Dependencies 4. Core Functionality 5. User Interface (UI) and User Experience 6. Additional Features (Optional) Example Code Snippet (Fetching Products) Important …
- How to Add a Link to Your Facebook Story in 2024Facebook Stories have become an integral part of our social media experience, allowing us to share moments and updates with our friends and followers. But did you know that you can also add links to your Facebook Stories? Adding a link to your story can be a powerful way to drive traffic to your website, …
- Troubleshooting “Failed to download Laravel from dist” ErrorIf you encounter the “Failed to download Laravel from dist” error while working with Laravel 10, it is likely due to the absence of the zip extension and unzip/7z commands on your system. This error prevents the successful download of Laravel from the distribution (dist) repository. What causes this error? The error occurs when the …
- Solutions for “The file is too large for the destination file system” Error on PendriveIf you have ever encountered the frustrating error message “The file is too large for the destination file system” when trying to transfer files to your pendrive, don’t worry! There are a few solutions you can try to resolve this issue. 1. Format the Pendrive: One of the easiest ways to fix this error is …