From bb490849521ecaeba839486d883b938f2efc4b1b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 23 Dec 2020 15:30:41 +0530 Subject: [PATCH] Hide timeStamp and sendingIndicator for a threaded reply message Signed-off-by: Sahil Kumar --- lib/src/message_widget.dart | 38 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index c52e7f63..9d81d679 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -428,23 +428,11 @@ class _MessageWidgetState extends State { ], ), ); - } else { - final showSendingIndicator = - widget.showSendingIndicator == DisplayWidget.show; - final replyCount = widget.message.replyCount; - final msg = showInChannel - ? 'Thread Reply' - : replyCount != 0 - ? '$replyCount ${replyCount > 1 ? 'Thread Replies' : 'Thread Reply'}' - : 'Thread Reply'; - + } else if (showInChannel) { final onThreadTap = () async { try { - var message = widget.message; - if (showInChannel && message.parentId != null) { - final channel = StreamChannel.of(context); - message = await channel.getMessage(widget.message.parentId); - } + final channel = StreamChannel.of(context); + final message = await channel.getMessage(widget.message.parentId); return widget.onThreadTap(message); } catch (e, stk) { print(e); @@ -452,6 +440,24 @@ class _MessageWidgetState extends State { return null; } }; + children.add( + InkWell( + onTap: widget.onThreadTap != null ? onThreadTap : null, + child: Text('Thread Reply', style: widget.messageTheme?.replies), + ), + ); + } else { + final showSendingIndicator = + widget.showSendingIndicator == DisplayWidget.show; + final replyCount = widget.message.replyCount; + final msg = replyCount != 0 + ? '$replyCount ${replyCount > 1 ? 'Thread Replies' : 'Thread Reply'}' + : 'Thread Reply'; + + final onThreadTap = () async { + var message = widget.message; + return widget.onThreadTap(message); + }; children.addAll([ if (showSendingIndicator) _buildSendingIndicator(), @@ -463,7 +469,7 @@ class _MessageWidgetState extends State { child: _buildReadIndicator(), ), ), - if (showThreadReplyIndicator || showInChannel) + if (showThreadReplyIndicator) InkWell( onTap: widget.onThreadTap != null ? onThreadTap : null, child: Text(msg, style: widget.messageTheme?.replies),