mirror of
https://github.com/JideGuru/FlutterTravel.git
synced 2025-05-19 07:06:22 +08:00
58 lines
1.3 KiB
Dart
58 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class IconBadge extends StatefulWidget {
|
|
final IconData icon;
|
|
final double size;
|
|
final Color color;
|
|
|
|
IconBadge({Key key, @required this.icon, this.size, this.color})
|
|
: super(key: key);
|
|
|
|
@override
|
|
_IconBadgeState createState() => _IconBadgeState();
|
|
}
|
|
|
|
class _IconBadgeState extends State<IconBadge> {
|
|
int counter = 0;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: <Widget>[
|
|
Icon(
|
|
widget.icon,
|
|
size: widget.size,
|
|
color: widget.color ?? null,
|
|
),
|
|
Positioned(
|
|
right: 0.0,
|
|
top: 0.0,
|
|
child: Container(
|
|
padding: EdgeInsets.all(1),
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).primaryColor,
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
height: 12.0,
|
|
width: 12.0,
|
|
child: Container(
|
|
padding: EdgeInsets.all(1),
|
|
decoration: BoxDecoration(
|
|
color: Colors.red[300],
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
height: 7.0,
|
|
width: 7.0,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|