Major UI overhaul
This commit is contained in:
@@ -6,6 +6,7 @@ import '../../providers/notifications_provider.dart';
|
||||
import '../../providers/profile_provider.dart';
|
||||
import '../../providers/tasks_provider.dart';
|
||||
import '../../providers/tickets_provider.dart';
|
||||
import '../../widgets/mono_text.dart';
|
||||
import '../../widgets/responsive_body.dart';
|
||||
|
||||
class NotificationsScreen extends ConsumerWidget {
|
||||
@@ -73,40 +74,52 @@ class NotificationsScreen extends ConsumerWidget {
|
||||
final title = _notificationTitle(item.type, actorName);
|
||||
final icon = _notificationIcon(item.type);
|
||||
|
||||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(title),
|
||||
subtitle: Text(subtitle),
|
||||
trailing: item.isUnread
|
||||
? const Icon(
|
||||
Icons.circle,
|
||||
size: 10,
|
||||
color: Colors.red,
|
||||
)
|
||||
: null,
|
||||
onTap: () async {
|
||||
final ticketId = item.ticketId;
|
||||
final taskId = item.taskId;
|
||||
if (ticketId != null) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markReadForTicket(ticketId);
|
||||
} else if (taskId != null) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markReadForTask(taskId);
|
||||
} else if (item.isUnread) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markRead(item.id);
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
if (taskId != null) {
|
||||
context.go('/tasks/$taskId');
|
||||
} else if (ticketId != null) {
|
||||
context.go('/tickets/$ticketId');
|
||||
}
|
||||
},
|
||||
return Card(
|
||||
child: ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(title),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(subtitle),
|
||||
const SizedBox(height: 4),
|
||||
if (item.ticketId != null)
|
||||
MonoText('Ticket ${item.ticketId}')
|
||||
else if (item.taskId != null)
|
||||
MonoText('Task ${item.taskId}'),
|
||||
],
|
||||
),
|
||||
trailing: item.isUnread
|
||||
? const Icon(
|
||||
Icons.circle,
|
||||
size: 10,
|
||||
color: Colors.red,
|
||||
)
|
||||
: null,
|
||||
onTap: () async {
|
||||
final ticketId = item.ticketId;
|
||||
final taskId = item.taskId;
|
||||
if (ticketId != null) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markReadForTicket(ticketId);
|
||||
} else if (taskId != null) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markReadForTask(taskId);
|
||||
} else if (item.isUnread) {
|
||||
await ref
|
||||
.read(notificationsControllerProvider)
|
||||
.markRead(item.id);
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
if (taskId != null) {
|
||||
context.go('/tasks/$taskId');
|
||||
} else if (ticketId != null) {
|
||||
context.go('/tickets/$ticketId');
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user