[MessageListView] Remove topMessage extra top padding in thread conversation.
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -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) {
|
||||||
@@ -602,37 +598,38 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
? streamChannel.queryTopMessages
|
? streamChannel.queryTopMessages
|
||||||
: streamChannel.queryBottomMessages;
|
: streamChannel.queryBottomMessages;
|
||||||
return StreamBuilder<bool>(
|
return StreamBuilder<bool>(
|
||||||
key: Key('LOADING-INDICATOR'),
|
key: Key('LOADING-INDICATOR'),
|
||||||
stream: stream,
|
stream: stream,
|
||||||
initialData: false,
|
initialData: false,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.hasError) {
|
if (snapshot.hasError) {
|
||||||
return Container(
|
return Container(
|
||||||
color: StreamChatTheme.of(context)
|
color: StreamChatTheme.of(context)
|
||||||
.colorTheme
|
.colorTheme
|
||||||
.accentRed
|
.accentRed
|
||||||
.withOpacity(.2),
|
.withOpacity(.2),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text('Error loading messages'),
|
child: Text('Error loading messages'),
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!snapshot.data) {
|
|
||||||
if (direction == QueryDirection.top) {
|
|
||||||
return Container(
|
|
||||||
height: 52,
|
|
||||||
width: double.infinity,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Offstage();
|
|
||||||
}
|
|
||||||
return Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: const CircularProgressIndicator(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
if (!snapshot.data) {
|
||||||
|
if (!_isThreadConversation && direction == QueryDirection.top) {
|
||||||
|
return Container(
|
||||||
|
height: 52,
|
||||||
|
width: double.infinity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Offstage();
|
||||||
|
}
|
||||||
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTopMessage(
|
Widget _buildTopMessage(
|
||||||
|
|||||||
Reference in New Issue
Block a user