[MessageListView] Remove topMessage extra top padding in thread conversation.

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-12 12:52:52 +05:30
parent bc1761867d
commit 4a7350530e
+25 -28
View File
@@ -338,9 +338,28 @@ class _MessageListViewState extends State<MessageListView> {
messages.length + 2 + (_isThreadConversation ? 1 : 0), messages.length + 2 + (_isThreadConversation ? 1 : 0),
separatorBuilder: (context, i) { separatorBuilder: (context, i) {
if (i == messages.length) return Offstage(); if (i == messages.length) return Offstage();
if (i == messages.length + 2) return Offstage();
if (i == messages.length + 1) return Offstage();
if (i == 0) return SizedBox(height: 30); if (i == 0) return SizedBox(height: 30);
if (i == messages.length + 1) {
final replyCount = widget.parentMessage.replyCount;
return Container(
decoration: BoxDecoration(
gradient:
StreamChatTheme.of(context).colorTheme.bgGradient,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'$replyCount ${replyCount == 1 ? 'Reply' : 'Replies'}',
textAlign: TextAlign.center,
style: StreamChatTheme.of(context)
.channelTheme
.channelHeaderTheme
.lastMessageAt,
),
),
);
}
final message = messages[i]; final message = messages[i];
final nextMessage = messages[i - 1]; final nextMessage = messages[i - 1];
if (!Jiffy(message.createdAt.toLocal()).isSame( if (!Jiffy(message.createdAt.toLocal()).isSame(
@@ -385,30 +404,7 @@ class _MessageListViewState extends State<MessageListView> {
widget.parentMessage, widget.parentMessage,
); );
} else { } else {
return Column( return buildParentMessage(widget.parentMessage);
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
buildParentMessage(widget.parentMessage),
Container(
decoration: BoxDecoration(
gradient: StreamChatTheme.of(context)
.colorTheme
.bgGradient,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'${widget.parentMessage.replyCount} ${widget.parentMessage.replyCount == 1 ? 'Reply' : 'Replies'}',
textAlign: TextAlign.center,
style: StreamChatTheme.of(context)
.channelTheme
.channelHeaderTheme
.lastMessageAt,
),
),
),
],
);
} }
} }
if (i == messages.length + 1) { if (i == messages.length + 1) {
@@ -618,7 +614,7 @@ class _MessageListViewState extends State<MessageListView> {
); );
} }
if (!snapshot.data) { if (!snapshot.data) {
if (direction == QueryDirection.top) { if (!_isThreadConversation && direction == QueryDirection.top) {
return Container( return Container(
height: 52, height: 52,
width: double.infinity, width: double.infinity,
@@ -632,7 +628,8 @@ class _MessageListViewState extends State<MessageListView> {
child: const CircularProgressIndicator(), child: const CircularProgressIndicator(),
), ),
); );
}); },
);
} }
Widget _buildTopMessage( Widget _buildTopMessage(