|
|
|
|
@ -41,9 +41,6 @@ class _AppBarWidgetState extends State<AppBarWidget> with TickerProviderStateMix
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
// Profile section animation (left to right with fade)
|
|
|
|
|
getUnreadCount();
|
|
|
|
|
|
|
|
|
|
_leftController = AnimationController(
|
|
|
|
|
duration: const Duration(milliseconds: 600),
|
|
|
|
|
vsync: this,
|
|
|
|
|
@ -101,12 +98,6 @@ class _AppBarWidgetState extends State<AppBarWidget> with TickerProviderStateMix
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> getUnreadCount () async{
|
|
|
|
|
NotificationsProvider notificationsProvider = Provider.of<NotificationsProvider>(context,listen: false);
|
|
|
|
|
log('i am initstate');
|
|
|
|
|
await notificationsProvider.getUnreadCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppBar(
|
|
|
|
|
@ -273,21 +264,19 @@ class _AppBarWidgetState extends State<AppBarWidget> with TickerProviderStateMix
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
// Notification icon with unread count badge
|
|
|
|
|
Consumer<NotificationsProvider>(
|
|
|
|
|
builder: (context, notificationsProvider, child) {
|
|
|
|
|
final unreadCount = notificationsProvider.totalNotificationUnread;
|
|
|
|
|
Selector<NotificationsProvider, int>(
|
|
|
|
|
selector: (_, myModel) => myModel.totalNotificationUnread, // Selects only the userName
|
|
|
|
|
builder: (_, totalNotificationUnread, __) {
|
|
|
|
|
return CustomBadge(
|
|
|
|
|
width: 20,
|
|
|
|
|
height: 20,
|
|
|
|
|
width: 16,
|
|
|
|
|
height: 16,
|
|
|
|
|
positionT: -10,
|
|
|
|
|
value: unreadCount,
|
|
|
|
|
value: totalNotificationUnread,
|
|
|
|
|
child: ("dashboard/notification").toSvgAsset(height: 24, width: 24, color: AppColor.icon2Color(context)).paddingOnly(top: 0, end: 0),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
Navigator.of(context).pushNamed(NotificationsPage.id);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
}).paddingOnly(end: 8, start: 4),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|