Merge pull request 'fixed notification update fixed' (#164) from fix_notification into main

Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/164
This commit is contained in:
a.ghabeli
2025-09-25 12:22:27 +03:30
3 changed files with 14 additions and 6 deletions
+6 -3
View File
@@ -131,10 +131,13 @@ class NotificationViewModel with ChangeNotifier {
notifications: updatedNotifications, notifications: updatedNotifications,
), ),
); );
}
await getNotifications(page: currentPage); _unreadNotificationResponse = _unreadNotificationResponse?.copyWith(
await getUnreadNotifications(); data: _unreadNotificationResponse?.data?.copyWith(
notifications: [],
),
);
}
if (context.mounted) { if (context.mounted) {
AppToast.success( AppToast.success(
@@ -11,7 +11,8 @@ class NotificationStrings {
static const String currentPage = 'currentPage'; static const String currentPage = 'currentPage';
static const String of = 'of'; static const String of = 'of';
static const String totalPages = 'totalPages'; static const String totalPages = 'totalPages';
static const String allNotificationMarkedAsRead = 'All notifications marked as read.'; static const String allNotificationMarkedAsRead =
'All notifications marked as read.';
static const String unknownResponse = 'Unknown response'; static const String unknownResponse = 'Unknown response';
static const String now = 'Now'; static const String now = 'Now';
static const String min = 'Min'; static const String min = 'Min';
@@ -7,6 +7,8 @@ import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/notification_data/notification_data.dart'; import 'package:tm_app/data/services/model/notification_data/notification_data.dart';
import 'package:tm_app/view_models/notification_view_model.dart'; import 'package:tm_app/view_models/notification_view_model.dart';
import '../strings/notification_strings.dart';
class NotificationCard extends StatelessWidget { class NotificationCard extends StatelessWidget {
final NotificationItem notification; final NotificationItem notification;
const NotificationCard({required this.notification, super.key}); const NotificationCard({required this.notification, super.key});
@@ -49,7 +51,9 @@ class NotificationCard extends StatelessWidget {
), ),
const Spacer(), const Spacer(),
Visibility( Visibility(
visible: notification.priority == 'important', visible:
notification.priority ==
NotificationStrings.important,
child: Container( child: Container(
width: 86.0.w(), width: 86.0.w(),
height: 24.0.h(), height: 24.0.h(),
@@ -59,7 +63,7 @@ class NotificationCard extends StatelessWidget {
), ),
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
'Important', NotificationStrings.important,
style: TextStyle( style: TextStyle(
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,