icon_badge 1.0.0 icon_badge: ^1.0.0 copied to clipboard
A simple flutter icon widget with notification badge to show number of items.
import 'package:flutter/material.dart';
import 'package:icon_badge/icon_badge.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: TestApp(),
);
}
}
class TestApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Test App'),
actions: <Widget>[
IconBadge(
icon: Icon(Icons.notifications_none),
itemCount: 100,
badgeColor: Colors.red,
itemColor: Colors.white,
maxCount: 99,
hideZero: true,
onTap: () {
print('test');
},
),
],
),
body: Center(
child: Text('Icon badge test'),
),
);
}
}