You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.8 KiB
Dart
78 lines
2.8 KiB
Dart
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;
|
|
final VoidCallback onTap;
|
|
|
|
const NotificationCardRedesigned({
|
|
Key? key,
|
|
required this.notification,
|
|
required this.onTap,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isUnread = !(notification.readed ?? false);
|
|
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: [
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
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);
|
|
}
|
|
}
|