update llc dependency and hotfixes
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
name: example
|
||||
description: A new Flutter project.
|
||||
|
||||
version: 1.0.12+13
|
||||
version: 1.0.20+21
|
||||
|
||||
environment:
|
||||
sdk: ">=2.2.2 <3.0.0"
|
||||
|
||||
@@ -135,7 +135,8 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
||||
newChannels.insert(0, _hiddenChannels[hiddenIndex]);
|
||||
_hiddenChannels.removeAt(hiddenIndex);
|
||||
} else {
|
||||
if (client.state.channels[e.cid] != null) {
|
||||
if (client.state?.channels != null &&
|
||||
client.state?.channels[e.cid] != null) {
|
||||
newChannels.insert(0, client.state.channels[e.cid]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class MessageListView extends StatefulWidget {
|
||||
class _MessageListViewState extends State<MessageListView> {
|
||||
static const _newMessageLoadingOffset = 100;
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
bool _isBottom = true;
|
||||
bool _bottomWasVisible = true;
|
||||
bool _topWasVisible = false;
|
||||
List<Message> _messages = [];
|
||||
List<Message> _newMessageList = [];
|
||||
@@ -333,7 +333,11 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
onVisibilityChanged: (visibility) {
|
||||
final topIsVisible = visibility.visibleBounds != Rect.zero;
|
||||
if (topIsVisible && !_topWasVisible) {
|
||||
streamChannel.queryMessages();
|
||||
if (widget.parentMessage == null) {
|
||||
streamChannel.queryMessages();
|
||||
} else {
|
||||
streamChannel.getReplies(widget.parentMessage.id);
|
||||
}
|
||||
}
|
||||
_topWasVisible = topIsVisible;
|
||||
},
|
||||
@@ -368,12 +372,15 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
return VisibilityDetector(
|
||||
key: ValueKey<String>('BOTTOM-MESSAGE'),
|
||||
onVisibilityChanged: (visibility) {
|
||||
_isBottom = visibility.visibleBounds != Rect.zero;
|
||||
if (_isBottom && streamChannel.channel.config?.readEvents == true) {
|
||||
final isVisible = visibility.visibleBounds != Rect.zero;
|
||||
if (isVisible &&
|
||||
!_bottomWasVisible &&
|
||||
streamChannel.channel.config?.readEvents == true) {
|
||||
if (streamChannel.channel.state.unreadCount > 0) {
|
||||
streamChannel.channel.markRead();
|
||||
}
|
||||
}
|
||||
_bottomWasVisible = isVisible;
|
||||
},
|
||||
child: messageWidget,
|
||||
);
|
||||
@@ -437,7 +444,8 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
?.read
|
||||
?.where((element) => element.user.id != userId)
|
||||
?.where((read) =>
|
||||
read.lastRead.isAfter(message.createdAt) &&
|
||||
(read.lastRead.isAfter(message.createdAt) ||
|
||||
read.lastRead.isAtSameMomentAs(message.createdAt)) &&
|
||||
(index == 0 ||
|
||||
read.lastRead.isBefore(messages[index - 1].createdAt)))
|
||||
?.toList();
|
||||
@@ -483,9 +491,6 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
super.initState();
|
||||
|
||||
final streamChannel = StreamChannel.of(context);
|
||||
if (streamChannel.channel.state.unreadCount > 0) {
|
||||
streamChannel.channel.markRead();
|
||||
}
|
||||
|
||||
Stream<List<Message>> stream;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
|
||||
/// Calls [channel.query] updating [queryMessage] stream
|
||||
void queryMessages() {
|
||||
if (_paginationEnded) {
|
||||
if (_queryMessageController.value == true || _paginationEnded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,15 +65,18 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
firstId = channel.state.messages.first.id;
|
||||
}
|
||||
|
||||
final messageLimit = 50;
|
||||
|
||||
widget.channel
|
||||
.query(
|
||||
messagesPagination: PaginationParams(
|
||||
lessThan: firstId,
|
||||
limit: 100,
|
||||
limit: messageLimit,
|
||||
),
|
||||
preferOffline: true,
|
||||
)
|
||||
.then((res) {
|
||||
if (res.messages.isEmpty) {
|
||||
if (res.messages.isEmpty || res.messages.length < messageLimit) {
|
||||
_paginationEnded = true;
|
||||
}
|
||||
_queryMessageController.add(false);
|
||||
@@ -84,7 +87,7 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
|
||||
/// Calls [channel.getReplies] updating [queryMessage] stream
|
||||
Future<void> getReplies(String parentId) async {
|
||||
if (_paginationEnded) {
|
||||
if (_queryMessageController.value == true || _paginationEnded) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,16 +102,18 @@ class StreamChannelState extends State<StreamChannel> {
|
||||
}
|
||||
}
|
||||
|
||||
final messageLimit = 50;
|
||||
return widget.channel
|
||||
.getReplies(
|
||||
parentId,
|
||||
PaginationParams(
|
||||
lessThan: firstId,
|
||||
limit: 100,
|
||||
limit: messageLimit,
|
||||
),
|
||||
preferOffline: true,
|
||||
)
|
||||
.then((res) {
|
||||
if (res.messages.isEmpty) {
|
||||
if (res.messages.isEmpty || res.messages.length < messageLimit) {
|
||||
_paginationEnded = true;
|
||||
}
|
||||
_queryMessageController.add(false);
|
||||
|
||||
@@ -82,9 +82,12 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
actions: <Widget>[
|
||||
Container(
|
||||
child: showBackButton
|
||||
? StreamBackButton(
|
||||
onPressed: onBackPressed,
|
||||
icon: Icons.close,
|
||||
? AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: StreamBackButton(
|
||||
onPressed: onBackPressed,
|
||||
icon: Icons.close,
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
),
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ dependencies:
|
||||
file_picker: ^2.0.0
|
||||
image_picker: ^0.6.7+2
|
||||
flutter_keyboard_visibility: ^3.2.1
|
||||
stream_chat: ^0.2.6
|
||||
stream_chat: ^0.2.7+1
|
||||
mime: ^0.9.6+3
|
||||
visibility_detector: ^0.1.5
|
||||
http_parser: ^3.1.4
|
||||
|
||||
Reference in New Issue
Block a user