1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Automatically change the number of unread conversations

This commit is contained in:
2020-04-18 14:33:07 +02:00
parent a8c358fd58
commit 526f698bf4
4 changed files with 30 additions and 8 deletions

View File

@ -114,7 +114,8 @@ class ComunicAppBar extends StatefulWidget implements PreferredSizeWidget {
final OnSelectMenuAction onTap;
final BarCallbackActions selectedAction;
const ComunicAppBar({Key key, @required this.onTap, @required this.selectedAction})
const ComunicAppBar(
{Key key, @required this.onTap, @required this.selectedAction})
: assert(onTap != null),
super(key: key);
@ -137,6 +138,8 @@ class _ComunicAppBarState extends SafeState<ComunicAppBar> {
// Listen to notifications number update
this.listenChangeState<NewNumberNotifsEvent>(
(d) => _unreadNotifications.notifications = d.newNum);
this.listenChangeState<NewNumberUnreadConversations>(
(d) => _unreadNotifications.conversations = d.newNum);
}
void _refreshCountUnread() async {
@ -176,7 +179,8 @@ class _ComunicAppBarState extends SafeState<ComunicAppBar> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: List.generate(
_menuItems.length,
(i) => _MenuItemWidget(
(i) =>
_MenuItemWidget(
item: _menuItems[i],
onTap: widget.onTap,
isSelected: _menuItems[i].action == widget.selectedAction,