|
|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/system_notification_model.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_date_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
|
|
|
|
|
|
|
|
|
class NotificationCardRedesigned extends StatelessWidget {
|
|
|
|
|
final SystemNotificationModel notification;
|
|
|
|
|
@ -20,112 +23,55 @@ class NotificationCardRedesigned extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final isUnread = !(notification.readed ?? false);
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.background(context),
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
border: Border.all(color: AppColor.borderColor(context)),
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
child: Column(
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 4.toScreenHeight,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
if (notification.priorityName != null && notification.priorityValue != null)
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: notification.priorityName!,
|
|
|
|
|
radius: 4,
|
|
|
|
|
textColor: AppColor.getNotificationPriorityStatusTextColor(context, notification.priorityValue!),
|
|
|
|
|
backgroundColor: AppColor.getNotificationPriorityStatusColor(context, notification.priorityValue!),
|
|
|
|
|
),
|
|
|
|
|
if (notification.createdOn?.isNotEmpty ?? false) InfoDateWidget(notification.createdOn ?? ""),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// Priority Badge & Date Row
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// Priority Badge
|
|
|
|
|
if (notification.priorityName != null && notification.priorityName!.isNotEmpty)
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.getRequestStatusColorByName(
|
|
|
|
|
context,
|
|
|
|
|
notification.priorityName!,
|
|
|
|
|
),
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
notification.priorityName!,
|
|
|
|
|
style: AppTextStyles.tinyFont2.copyWith(
|
|
|
|
|
color: AppColor.getRequestStatusTextColorByName(
|
|
|
|
|
context,
|
|
|
|
|
notification.priorityName!,
|
|
|
|
|
),
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
|
|
|
|
|
// Date & Time - Top Right
|
|
|
|
|
if (notification.createdOn?.isNotEmpty ?? false)
|
|
|
|
|
InfoDateWidget(notification.createdOn ?? ""),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
|
|
// Title with Unread Dot
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
// Unread indicator (blue dot) - aligned with title
|
|
|
|
|
if (isUnread)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 6, right: 8),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 8,
|
|
|
|
|
height: 8,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: AppColor.primary10,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InfoHeader16Widget(
|
|
|
|
|
notification.title ?? '',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
if (notification.sourceName?.isNotEmpty ?? false)
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.primary10.withValues(alpha: 0.1),
|
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
notification.sourceName!,
|
|
|
|
|
style: AppTextStyles.tinyFont2.copyWith(
|
|
|
|
|
if (isUnread)
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 6, right: 8),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 8,
|
|
|
|
|
height: 8,
|
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
|
color: AppColor.primary10,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (notification.sourceName?.isNotEmpty ?? false) 8.height,
|
|
|
|
|
|
|
|
|
|
// Message Preview
|
|
|
|
|
if (notification.text?.isNotEmpty ?? false)
|
|
|
|
|
InfoTextLabelWidget(
|
|
|
|
|
label: notification.text!,
|
|
|
|
|
// style: AppTextStyles.bodyText2.copyWith(
|
|
|
|
|
// color: AppColor.textColor(context),
|
|
|
|
|
// height: 1.4,
|
|
|
|
|
// ),
|
|
|
|
|
// maxLines: 3,
|
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InfoHeader16Widget(
|
|
|
|
|
notification.title ?? '',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
if (notification.sourceName?.isNotEmpty ?? false)
|
|
|
|
|
InfoTextWidget(
|
|
|
|
|
label: 'Source'.addTranslation,
|
|
|
|
|
value: notification.sourceName ?? '',
|
|
|
|
|
),
|
|
|
|
|
if (notification.text?.isNotEmpty ?? false)
|
|
|
|
|
InfoTextLabelWidget(
|
|
|
|
|
label: notification.text!,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context).onPress(onTap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|