From 539e94fc99ce5a61de5ada8b8c9578d4b17741e0 Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Tue, 30 Sep 2025 13:25:31 +0530 Subject: [PATCH] feat: Rename "Comment" to "Note" in relevant UI components and dialogs --- .../comment_task_bottom_sheet.dart | 2 +- .../directory/add_comment_bottom_sheet.dart | 2 +- lib/view/directory/contact_detail_screen.dart | 193 ++++++++++-------- 3 files changed, 110 insertions(+), 87 deletions(-) diff --git a/lib/model/dailyTaskPlanning/comment_task_bottom_sheet.dart b/lib/model/dailyTaskPlanning/comment_task_bottom_sheet.dart index f3235bc..4184d49 100644 --- a/lib/model/dailyTaskPlanning/comment_task_bottom_sheet.dart +++ b/lib/model/dailyTaskPlanning/comment_task_bottom_sheet.dart @@ -249,7 +249,7 @@ class _CommentTaskBottomSheetState extends State return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildSectionHeader("Add Comment", Icons.comment_outlined), + _buildSectionHeader("Add Note", Icons.comment_outlined), MySpacing.height(8), TextFormField( validator: diff --git a/lib/model/directory/add_comment_bottom_sheet.dart b/lib/model/directory/add_comment_bottom_sheet.dart index c208d4c..bcae2a9 100644 --- a/lib/model/directory/add_comment_bottom_sheet.dart +++ b/lib/model/directory/add_comment_bottom_sheet.dart @@ -65,7 +65,7 @@ class _AddCommentBottomSheetState extends State { ), ), MySpacing.height(12), - Center(child: MyText.titleMedium("Add Comment", fontWeight: 700)), + Center(child: MyText.titleMedium("Add Note", fontWeight: 700)), MySpacing.height(24), CommentEditorCard( controller: quillController, diff --git a/lib/view/directory/contact_detail_screen.dart b/lib/view/directory/contact_detail_screen.dart index bf17677..e77c747 100644 --- a/lib/view/directory/contact_detail_screen.dart +++ b/lib/view/directory/contact_detail_screen.dart @@ -173,10 +173,10 @@ class _ContactDetailScreenState extends State { children: [ Row(children: [ Avatar( - firstName: firstName, - lastName: lastName, - size: 35, - backgroundColor: Colors.indigo), + firstName: firstName, + lastName: lastName, + size: 35, + ), MySpacing.width(12), Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -202,7 +202,7 @@ class _ContactDetailScreenState extends State { ), tabs: const [ Tab(text: "Details"), - Tab(text: "Comments"), + Tab(text: "Notes"), ], ), ], @@ -362,7 +362,7 @@ class _ContactDetailScreenState extends State { if (comments.isEmpty) { return Center( - child: MyText.bodyLarge("No comments yet.", color: Colors.grey), + child: MyText.bodyLarge("No notes yet.", color: Colors.grey), ); } @@ -406,7 +406,7 @@ class _ContactDetailScreenState extends State { } }, icon: const Icon(Icons.add_comment, color: Colors.white), - label: const Text("Add Comment", + label: const Text("Add Note", style: TextStyle(color: Colors.white)), ), ), @@ -420,6 +420,7 @@ class _ContactDetailScreenState extends State { final initials = comment.createdBy.firstName.isNotEmpty ? comment.createdBy.firstName[0].toUpperCase() : "?"; + final decodedDelta = HtmlToDelta().convert(comment.note); final quillController = isEditing ? quill.QuillController( @@ -428,63 +429,91 @@ class _ContactDetailScreenState extends State { ) : null; - return AnimatedContainer( - duration: const Duration(milliseconds: 300), - padding: MySpacing.xy(12, 12), + return Container( + margin: const EdgeInsets.symmetric(vertical: 6), + padding: const EdgeInsets.all(12), decoration: BoxDecoration( - color: isEditing ? Colors.indigo[50] : Colors.white, - borderRadius: BorderRadius.circular(5), - border: Border.all( - color: isEditing ? Colors.indigo : Colors.grey.shade300, - width: 1.2, - ), - + color: Colors.white, + borderRadius: BorderRadius.circular(14), + border: Border.all(color: Colors.grey.shade200), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.03), + blurRadius: 6, + offset: const Offset(0, 2), + ), + ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + // 🧑 Header Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Avatar(firstName: initials, lastName: '', size: 36), - MySpacing.width(12), + Avatar( + firstName: initials, + lastName: '', + size: 40, + ), + const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - MyText.bodyMedium("By: ${comment.createdBy.firstName}", - fontWeight: 600, color: Colors.indigo[800]), - MySpacing.height(4), - MyText.bodySmall( + // Full name on top + Text( + "${comment.createdBy.firstName} ${comment.createdBy.lastName}", + style: const TextStyle( + fontWeight: FontWeight.w700, + fontSize: 15, + color: Colors.black87, + ), + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 2), + // Job Role + if (comment.createdBy.jobRoleName?.isNotEmpty ?? false) + Text( + comment.createdBy.jobRoleName, + style: TextStyle( + fontSize: 13, + color: Colors.indigo[600], + fontWeight: FontWeight.w500, + ), + ), + const SizedBox(height: 2), + // Timestamp + Text( DateTimeUtils.convertUtcToLocal( comment.createdAt.toString(), format: 'dd MMM yyyy, hh:mm a', ), - color: Colors.grey[600], + style: TextStyle( + fontSize: 12, + color: Colors.grey[600], + ), ), ], ), ), - // Action buttons - // Action buttons (reduced spacing between delete & edit) + + // ⚡ Action buttons Row( mainAxisSize: MainAxisSize.min, children: [ - // 🔹 Restore button for inactive comments if (!comment.isActive) IconButton( - visualDensity: VisualDensity.compact, - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), icon: const Icon(Icons.restore, - color: Colors.green, size: 20), + size: 18, color: Colors.green), tooltip: "Restore", + splashRadius: 18, onPressed: () async { await Get.dialog( ConfirmDialog( - title: "Restore Comment", + title: "Restore Note", message: - "Are you sure you want to restore this comment?", + "Are you sure you want to restore this note?", confirmText: "Restore", confirmColor: Colors.green, icon: Icons.restore, @@ -493,65 +522,51 @@ class _ContactDetailScreenState extends State { comment.id, contactId); }, ), - barrierDismissible: false, ); }, ), - - // 🔹 Delete + Edit icons for active comments (tightened spacing) - if (comment.isActive) - Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - visualDensity: VisualDensity.compact, - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), - icon: const Icon(Icons.delete, - color: Colors.red, size: 20), - tooltip: "Delete", - onPressed: () async { - await Get.dialog( - ConfirmDialog( - title: "Delete Comment", - message: - "Are you sure you want to delete this comment?", - confirmText: "Delete", - confirmColor: Colors.red, - icon: Icons.delete_forever, - onConfirm: () async { - await directoryController.deleteComment( - comment.id, contactId); - }, - ), - barrierDismissible: false, - ); - }, - ), - const SizedBox( - width: - 4), // 👈 reduce icon gap here (was ~12 by default) - IconButton( - visualDensity: VisualDensity.compact, - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), - icon: Icon( - isEditing ? Icons.close : Icons.edit, - size: 20, - color: Colors.indigo, - ), - tooltip: isEditing ? "Cancel Edit" : "Edit", - onPressed: () { - directoryController.editingCommentId.value = - isEditing ? null : comment.id; - }, - ), - ], + if (comment.isActive) ...[ + IconButton( + icon: const Icon(Icons.edit_outlined, + size: 18, color: Colors.indigo), + tooltip: "Edit", + splashRadius: 18, + onPressed: () { + directoryController.editingCommentId.value = + isEditing ? null : comment.id; + }, ), + IconButton( + icon: const Icon(Icons.delete_outline, + size: 18, color: Colors.red), + tooltip: "Delete", + splashRadius: 18, + onPressed: () async { + await Get.dialog( + ConfirmDialog( + title: "Delete Note", + message: + "Are you sure you want to delete this note?", + confirmText: "Delete", + confirmColor: Colors.red, + icon: Icons.delete_forever, + onConfirm: () async { + await directoryController.deleteComment( + comment.id, contactId); + }, + ), + ); + }, + ), + ], ], ), ], ), + + const SizedBox(height: 8), + + // 📝 Comment Content if (isEditing && quillController != null) CommentEditorCard( controller: quillController, @@ -572,7 +587,15 @@ class _ContactDetailScreenState extends State { "body": html.Style( margin: html.Margins.zero, padding: html.HtmlPaddings.zero, - fontSize: html.FontSize.medium, + fontSize: html.FontSize(14), + color: Colors.black87, + ), + "p": html.Style( + margin: html.Margins.only(bottom: 6), + lineHeight: const html.LineHeight(1.4), + ), + "strong": html.Style( + fontWeight: FontWeight.w700, color: Colors.black87, ), },