[QuotedMessageWidget, MessageWidget] Fix quoted message padding in case of attachments
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -272,6 +272,12 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
widget.message.attachments?.any((element) => element.type == 'giphy') ==
|
widget.message.attachments?.any((element) => element.type == 'giphy') ==
|
||||||
true;
|
true;
|
||||||
|
|
||||||
|
bool get hasNonUrlAttachments =>
|
||||||
|
widget.message.attachments
|
||||||
|
?.where((it) => it.ogScrapeUrl == null)
|
||||||
|
?.isNotEmpty ==
|
||||||
|
true;
|
||||||
|
|
||||||
bool get showBottomRow =>
|
bool get showBottomRow =>
|
||||||
showThreadReplyIndicator ||
|
showThreadReplyIndicator ||
|
||||||
showUsername ||
|
showUsername ||
|
||||||
@@ -409,8 +415,9 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (hasQuotedMessage)
|
if (hasQuotedMessage)
|
||||||
_buildQuotedMessage(),
|
_buildQuotedMessage(),
|
||||||
..._parseAttachments(
|
if (hasNonUrlAttachments)
|
||||||
context),
|
..._parseAttachments(
|
||||||
|
context),
|
||||||
if (widget.message.text
|
if (widget.message.text
|
||||||
.trim()
|
.trim()
|
||||||
.isNotEmpty &&
|
.isNotEmpty &&
|
||||||
@@ -487,13 +494,21 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
widget.onQuotedMessageTap != null
|
widget.onQuotedMessageTap != null
|
||||||
? () => widget.onQuotedMessageTap(widget.message.quotedMessageId)
|
? () => widget.onQuotedMessageTap(widget.message.quotedMessageId)
|
||||||
: null;
|
: null;
|
||||||
return QuotedMessageWidget(
|
return Padding(
|
||||||
onTap: onTap,
|
padding: EdgeInsets.only(
|
||||||
message: widget.message.quotedMessage,
|
right: 8,
|
||||||
messageTheme: isMyMessage
|
left: 8,
|
||||||
? StreamChatTheme.of(context).otherMessageTheme
|
top: 8,
|
||||||
: StreamChatTheme.of(context).ownMessageTheme,
|
bottom: hasNonUrlAttachments ? 8 : 0,
|
||||||
reverse: widget.reverse,
|
),
|
||||||
|
child: QuotedMessageWidget(
|
||||||
|
onTap: onTap,
|
||||||
|
message: widget.message.quotedMessage,
|
||||||
|
messageTheme: isMyMessage
|
||||||
|
? StreamChatTheme.of(context).otherMessageTheme
|
||||||
|
: StreamChatTheme.of(context).ownMessageTheme,
|
||||||
|
reverse: widget.reverse,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,17 +109,14 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Padding(
|
child: Row(
|
||||||
padding: const EdgeInsets.only(top: 8, right: 4, left: 8),
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
child: Row(
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
children: [
|
||||||
mainAxisSize: MainAxisSize.min,
|
Flexible(child: _buildMessage(context)),
|
||||||
children: [
|
SizedBox(width: 8),
|
||||||
Flexible(child: _buildMessage(context)),
|
_buildUserAvatar(),
|
||||||
SizedBox(width: 4),
|
],
|
||||||
_buildUserAvatar(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -247,16 +244,13 @@ class QuotedMessageWidget extends StatelessWidget {
|
|||||||
return Transform(
|
return Transform(
|
||||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
transform: Matrix4.rotationY(reverse ? pi : 0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Padding(
|
child: UserAvatar(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
user: message.user,
|
||||||
child: UserAvatar(
|
constraints: BoxConstraints.tightFor(
|
||||||
user: message.user,
|
height: 24,
|
||||||
constraints: BoxConstraints.tightFor(
|
width: 24,
|
||||||
height: 24,
|
|
||||||
width: 24,
|
|
||||||
),
|
|
||||||
showOnlineStatus: false,
|
|
||||||
),
|
),
|
||||||
|
showOnlineStatus: false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user