Fixed seen item in notifications
This commit is contained in:
@@ -234,7 +234,7 @@ class HomeViewModel with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void serUnreadNotificationFalse() {
|
void setUnreadNotificationFalse() {
|
||||||
_hasUnreadNotification = false;
|
_hasUnreadNotification = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,8 +300,7 @@ class NotificationViewModel with ChangeNotifier {
|
|||||||
NotificationStrings.allNotificationMarkedAsRead,
|
NotificationStrings.allNotificationMarkedAsRead,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final homeViewModel = context.read<HomeViewModel>();
|
setNotificationFalse(context);
|
||||||
homeViewModel.serUnreadNotificationFalse();
|
|
||||||
} else {
|
} else {
|
||||||
_errorMessage = message;
|
_errorMessage = message;
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
@@ -340,4 +339,14 @@ class NotificationViewModel with ChangeNotifier {
|
|||||||
return '${difference.inDays} ${NotificationStrings.daysAgo}';
|
return '${difference.inDays} ${NotificationStrings.daysAgo}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setNotificationFalse(BuildContext context) {
|
||||||
|
final homeViewModel = context.read<HomeViewModel>();
|
||||||
|
homeViewModel.setUnreadNotificationFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkNotifications(BuildContext context) {
|
||||||
|
final homeViewModel = context.read<HomeViewModel>();
|
||||||
|
homeViewModel.checkUnreadNotifications();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,11 @@ class NotificationCard extends StatelessWidget {
|
|||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
).then((value) {
|
||||||
|
if (context.mounted) {
|
||||||
|
viewModel.checkNotifications(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user