From ca78b76abd1d14a5e6e0efc4a0132ef7db49822e Mon Sep 17 00:00:00 2001 From: llsajjad Date: Sun, 28 Sep 2025 11:32:29 +0330 Subject: [PATCH] Fixed showing notification circular alert --- lib/view_models/home_view_model.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/view_models/home_view_model.dart b/lib/view_models/home_view_model.dart index cfdf3fc..d9a3481 100644 --- a/lib/view_models/home_view_model.dart +++ b/lib/view_models/home_view_model.dart @@ -213,21 +213,29 @@ class HomeViewModel with ChangeNotifier { Future checkUnreadNotifications() async { final result = await _homeRepository.checkUnreadNotifications(); + switch (result) { case Ok>(): final response = result.value; - _hasUnreadNotification = response['success'] == true; + + final data = response['data']; + if (data is List && data.isNotEmpty) { + _hasUnreadNotification = true; + } else { + _hasUnreadNotification = false; + } break; + case Error>(): _hasUnreadNotification = false; - break; + break; } + notifyListeners(); } - void serUnreadNotificationFalse(){ + void serUnreadNotificationFalse() { _hasUnreadNotification = false; notifyListeners(); - } }