From 14b4c3f1ba241846b85de7f976d1d796a113a57d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Sun, 10 May 2026 16:02:22 +0300 Subject: [PATCH] improvements. --- lib/extensions/widget_extensions.dart | 2 +- .../notifications/notifications_list.dart | 2 +- .../widgets/item_views/info_text_widget.dart | 8 +++-- .../notifications/notification_item.dart | 29 +++++-------------- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index ff457b1d..63c90ebb 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -202,5 +202,5 @@ extension WidgetExtensions on Widget { } extension DividerExtension on Divider { - Divider defaultStyle(BuildContext context) => Divider(thickness: 1, color: context.isDarkNotListen ? AppColor.neutral20 : AppColor.neutral30); + Divider defaultStyle(BuildContext context) => Divider(thickness: 1, color: AppColor.borderColor(context)); } diff --git a/lib/views/pages/user/notifications/notifications_list.dart b/lib/views/pages/user/notifications/notifications_list.dart index e82a2fb5..db311261 100644 --- a/lib/views/pages/user/notifications/notifications_list.dart +++ b/lib/views/pages/user/notifications/notifications_list.dart @@ -29,7 +29,7 @@ class NotificationsList extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.all(0), itemCount: notifications.length, - separatorBuilder: (context, itemIndex) => const Divider().defaultStyle(context).paddingOnly(top: 16, bottom: 16), + separatorBuilder: (context, itemIndex) => const Divider().defaultStyle(context).paddingOnly(top: 4, bottom: 4), itemBuilder: (context, itemIndex) { return NotificationItem( notification: notifications[itemIndex], diff --git a/lib/views/widgets/item_views/info_text_widget.dart b/lib/views/widgets/item_views/info_text_widget.dart index 846b1052..ecf71002 100644 --- a/lib/views/widgets/item_views/info_text_widget.dart +++ b/lib/views/widgets/item_views/info_text_widget.dart @@ -8,16 +8,18 @@ class InfoTextWidget extends StatelessWidget { final String label; final bool showEmptyValue; final bool showArrow; + final bool isMsg; - InfoTextWidget({required this.label, this.value, this.showEmptyValue = false, this.showArrow = false, Key? key}) : super(key: key); + InfoTextWidget({required this.label, this.value, this.showEmptyValue = false, this.showArrow = false, this.isMsg = false, Key? key}) : super(key: key); @override Widget build(BuildContext context) { Widget text; + String aLabel = label + (isMsg ? "" : ":"); if (showEmptyValue) { - text = Text('$label: ${value ?? ""}', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context))); + text = Text('$aLabel ${value ?? ""}', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context))); } else if (value?.isNotEmpty ?? false) { - text = Text('$label: $value', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context))); + text = Text('$aLabel $value', style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context))); } else { text = const SizedBox(); } diff --git a/lib/views/widgets/notifications/notification_item.dart b/lib/views/widgets/notifications/notification_item.dart index 71135557..ba6c6cb2 100644 --- a/lib/views/widgets/notifications/notification_item.dart +++ b/lib/views/widgets/notifications/notification_item.dart @@ -6,15 +6,18 @@ 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 NotificationItem extends StatelessWidget { final SystemNotificationModel notification; final Function(SystemNotificationModel) onPressed; - final bool isLoading; + bool isLoading; - const NotificationItem({Key? key, required this.notification, required this.onPressed, this.isLoading = false}) : super(key: key); + NotificationItem({Key? key, required this.notification, required this.onPressed, this.isLoading = false}) : super(key: key); @override Widget build(BuildContext context) { @@ -42,28 +45,12 @@ class NotificationItem extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - notification.title ?? "", - style: AppTextStyles.heading6.copyWith( - color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, - ), - ).toShimmer(isShow: isLoading, context: context).expanded, + InfoHeaderWidget(notification.title ?? "").toShimmer(isShow: isLoading, context: context).expanded, 8.width, - Text( - notification.createdOn?.toServiceRequestCardFormat ?? "", - textAlign: TextAlign.right, - style: AppTextStyles.tinyFont.copyWith( - color: context.isDark ? AppColor.neutral20 : AppColor.neutral50, - ), - ).toShimmer(isShow: isLoading, context: context), + if (notification.createdOn?.isNotEmpty ?? false) InfoDateWidget(notification.createdOn!).toShimmer(isShow: isLoading, context: context), ], ), - Text( - notification.text ?? "", - style: AppTextStyles.bodyText2.copyWith( - color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575), - ), - ).toShimmer(isShow: isLoading, context: context), + InfoTextWidget(label: notification.text ?? "", isMsg: true, showEmptyValue: true).toShimmer(isShow: isLoading, context: context), ], ).onPress(() { onPressed(notification);