mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
feat: notification style
This commit is contained in:
parent
c24fd4600c
commit
1eafcff124
@ -37,21 +37,22 @@ class _HomeState extends State<Home> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNotificationIcon(BuildContext context) {
|
Widget _buildNotificationIcon(BuildContext context, bool isActive) {
|
||||||
|
final iconData = isActive ? Icons.notifications : Icons.notifications_none;
|
||||||
int count = Provider.of<NotificationModel>(context).count;
|
int count = Provider.of<NotificationModel>(context).count;
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return Icon(Icons.notifications_none);
|
return Icon(iconData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// String text = count > 99 ? '99+' : count.toString();
|
// String text = count > 99 ? '99+' : count.toString();
|
||||||
return Stack(
|
return Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.notifications_none),
|
Icon(iconData),
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: -2,
|
||||||
top: 0,
|
top: -2,
|
||||||
child: Icon(Octicons.primitive_dot,
|
child: Icon(Octicons.primitive_dot,
|
||||||
color: PrimerColors.red500, size: 12))
|
color: PrimerColors.red500, size: 14))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -63,8 +64,8 @@ class _HomeState extends State<Home> {
|
|||||||
title: Text('News'),
|
title: Text('News'),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: _buildNotificationIcon(context),
|
icon: _buildNotificationIcon(context, false),
|
||||||
activeIcon: Icon(Icons.notifications),
|
activeIcon: _buildNotificationIcon(context, true),
|
||||||
title: Text('Notification'),
|
title: Text('Notification'),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
|
Loading…
Reference in New Issue
Block a user