Merge pull request #492 from GetStream/hotfix/messagewidget

fix: message widget not update when message is updated
This commit is contained in:
Salvatore Giordano
2021-06-23 12:48:42 +02:00
committed by GitHub
2 changed files with 17 additions and 19 deletions
@@ -798,7 +798,7 @@ class MessageInputState extends State<MessageInput> {
setState(() { setState(() {
_commandEnabled = true; _commandEnabled = true;
}); });
_commandsOverlay!.remove(); _commandsOverlay?.remove();
_commandsOverlay = null; _commandsOverlay = null;
} else { } else {
_commandsOverlay = _buildCommandsOverlayEntry(); _commandsOverlay = _buildCommandsOverlayEntry();
@@ -413,39 +413,37 @@ class _MessageWidgetState extends State<MessageWidget>
bool get showTimeStamp => widget.showTimestamp; bool get showTimeStamp => widget.showTimestamp;
late final bool isMessageRead = widget.readList?.isNotEmpty == true; bool get isMessageRead => widget.readList?.isNotEmpty == true;
bool get showInChannel => widget.showInChannelIndicator; bool get showInChannel => widget.showInChannelIndicator;
bool get hasQuotedMessage => widget.message.quotedMessage != null; bool get hasQuotedMessage => widget.message.quotedMessage != null;
late final bool isSendFailed = bool get isSendFailed => widget.message.status == MessageSendingStatus.failed;
widget.message.status == MessageSendingStatus.failed;
late final bool isUpdateFailed = bool get isUpdateFailed =>
widget.message.status == MessageSendingStatus.failed_update; widget.message.status == MessageSendingStatus.failed_update;
late final bool isDeleteFailed = bool get isDeleteFailed =>
widget.message.status == MessageSendingStatus.failed_delete; widget.message.status == MessageSendingStatus.failed_delete;
late final bool isFailedState = bool get isFailedState => isSendFailed || isUpdateFailed || isDeleteFailed;
isSendFailed || isUpdateFailed || isDeleteFailed;
late final bool isGiphy = bool get isGiphy =>
widget.message.attachments.any((element) => element.type == 'giphy') == widget.message.attachments.any((element) => element.type == 'giphy') ==
true;
late final bool isOnlyEmoji = widget.message.text?.isOnlyEmoji == true;
late final bool hasNonUrlAttachments = widget.message.attachments
.where((it) => it.ogScrapeUrl == null)
.isNotEmpty ==
true; true;
late final bool hasUrlAttachments = bool get isOnlyEmoji => widget.message.text?.isOnlyEmoji == true;
bool get hasNonUrlAttachments => widget.message.attachments
.where((it) => it.ogScrapeUrl == null)
.isNotEmpty;
bool get hasUrlAttachments =>
widget.message.attachments.any((it) => it.ogScrapeUrl != null) == true; widget.message.attachments.any((it) => it.ogScrapeUrl != null) == true;
late final bool showBottomRow = showThreadReplyIndicator || bool get showBottomRow =>
showThreadReplyIndicator ||
showUsername || showUsername ||
showTimeStamp || showTimeStamp ||
showInChannel || showInChannel ||
@@ -1177,7 +1175,7 @@ class _MessageWidgetState extends State<MessageWidget>
); );
} }
late final bool isPinned = widget.message.pinned; bool get isPinned => widget.message.pinned;
Color? _getBackgroundColor() { Color? _getBackgroundColor() {
if (hasQuotedMessage) { if (hasQuotedMessage) {