[QuotedMessageWidget, MessageWidget] Fix quoted message padding in case of attachments

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-12 19:36:12 +05:30
parent 069325afc2
commit 16bedf8728
2 changed files with 38 additions and 29 deletions
+16 -1
View File
@@ -272,6 +272,12 @@ class _MessageWidgetState extends State<MessageWidget> {
widget.message.attachments?.any((element) => element.type == 'giphy') ==
true;
bool get hasNonUrlAttachments =>
widget.message.attachments
?.where((it) => it.ogScrapeUrl == null)
?.isNotEmpty ==
true;
bool get showBottomRow =>
showThreadReplyIndicator ||
showUsername ||
@@ -409,6 +415,7 @@ class _MessageWidgetState extends State<MessageWidget> {
children: <Widget>[
if (hasQuotedMessage)
_buildQuotedMessage(),
if (hasNonUrlAttachments)
..._parseAttachments(
context),
if (widget.message.text
@@ -487,13 +494,21 @@ class _MessageWidgetState extends State<MessageWidget> {
widget.onQuotedMessageTap != null
? () => widget.onQuotedMessageTap(widget.message.quotedMessageId)
: null;
return QuotedMessageWidget(
return Padding(
padding: EdgeInsets.only(
right: 8,
left: 8,
top: 8,
bottom: hasNonUrlAttachments ? 8 : 0,
),
child: QuotedMessageWidget(
onTap: onTap,
message: widget.message.quotedMessage,
messageTheme: isMyMessage
? StreamChatTheme.of(context).otherMessageTheme
: StreamChatTheme.of(context).ownMessageTheme,
reverse: widget.reverse,
),
);
}
+1 -7
View File
@@ -109,18 +109,15 @@ class QuotedMessageWidget extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.only(top: 8, right: 4, left: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Flexible(child: _buildMessage(context)),
SizedBox(width: 4),
SizedBox(width: 8),
_buildUserAvatar(),
],
),
),
);
}
@@ -247,8 +244,6 @@ class QuotedMessageWidget extends StatelessWidget {
return Transform(
transform: Matrix4.rotationY(reverse ? pi : 0),
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: UserAvatar(
user: message.user,
constraints: BoxConstraints.tightFor(
@@ -257,7 +252,6 @@ class QuotedMessageWidget extends StatelessWidget {
),
showOnlineStatus: false,
),
),
);
}