Fixed warning context and hard code strings in notificationModelView and some widgets

This commit is contained in:
llsajjad
2025-09-24 12:15:53 +03:30
parent a8e65f3cb5
commit 7456418ea2
5 changed files with 185 additions and 160 deletions
@@ -6,6 +6,7 @@ import 'package:tm_app/core/theme/colors.dart';
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/view_models/notification_view_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
class NotificationCard extends StatelessWidget {
final NotificationItem notification;
@@ -20,17 +21,17 @@ class NotificationCard extends StatelessWidget {
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color:
notification.type == 'reject'
notification.type == NotificationStrings.reject
? AppColors.orange10
: notification.type == 'info'
: notification.type == NotificationStrings.info
? AppColors.primary10Light
: AppColors.green0,
borderRadius: BorderRadius.circular(4),
border: Border.all(
color:
notification.type! == 'reject'
notification.type! == NotificationStrings.reject
? AppColors.warningColor
: notification.type == 'info' ? AppColors.primary20 : AppColors.green20,
: notification.type == NotificationStrings.info ? AppColors.primary20 : AppColors.green20,
),
),
child: Row(
@@ -39,9 +40,9 @@ class NotificationCard extends StatelessWidget {
Padding(
padding: EdgeInsets.only(top: 3.0.h()),
child: SvgPicture.asset(
notification.type! == 'info'
notification.type! == NotificationStrings.info
? AssetsManager.notification
: notification.type! == 'reject'
: notification.type! == NotificationStrings.reject
? AssetsManager.danger
: AssetsManager.tickCircle,
),
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/view_models/notification_view_model.dart';
import 'package:tm_app/views/notification/strings/notification_strings.dart';
import 'notification_card.dart';
@@ -21,7 +22,7 @@ class NotificationUnreadTab extends StatelessWidget {
viewModel.unreadNotificationResponse?.data?.notifications ?? [];
if (notifications.isEmpty) {
return const Center(child: Text('No unread notifications'));
return const Center(child: Text(NotificationStrings.noUnreadNotifications,));
}
return ListView.builder(