fixing conflict

This commit is contained in:
amirrezaghabeli
2025-09-28 07:23:25 +03:30
parent 26a29003d9
commit fd19e8c66c
9 changed files with 92 additions and 77 deletions
@@ -13,22 +13,18 @@ class NotificationImportantTab extends StatelessWidget {
Widget build(BuildContext context) {
final viewModel = context.watch<NotificationViewModel>();
if (viewModel.isLoadingImportant) {
if (viewModel.isLoadingImportant &&
(viewModel.importantNotificationResponse?.data?.isEmpty ?? true)) {
return const Center(child: CircularProgressIndicator());
}
final importantFromApi = viewModel.importantNotificationResponse?.data ?? [];
final allNotifications = viewModel.allNotificationResponse?.data ?? [];
final source = importantFromApi.isNotEmpty ? importantFromApi : allNotifications;
final importantNotifications = source
.where((n) => (n.priority ?? '').toLowerCase() == 'important')
.toList();
final importantNotifications =
viewModel.importantNotificationResponse?.data ?? [];
if (importantNotifications.isEmpty) {
return const Center(child: Text(NotificationStrings.noImportantNotifications));
return const Center(
child: Text(NotificationStrings.noImportantNotifications),
);
}
return ListView.builder(
@@ -38,9 +34,7 @@ class NotificationImportantTab extends StatelessWidget {
final notification = importantNotifications[index];
return Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: NotificationCard(
notification: notification,
),
child: NotificationCard(notification: notification),
);
},
);