merge master
This commit is contained in:
@@ -1,3 +1,17 @@
|
|||||||
|
## 0.2.3
|
||||||
|
|
||||||
|
- Add `lockChannelsOrder` parameter to `ChannelsBloc`
|
||||||
|
|
||||||
|
## 0.2.2+3
|
||||||
|
|
||||||
|
- Fix `ChannelListView` channel hidden behaviour
|
||||||
|
|
||||||
|
- Refresh `ChannelListView` on new message from hidden channel
|
||||||
|
|
||||||
|
## 0.2.2+1
|
||||||
|
|
||||||
|
- Fix some components to implement a splitview example
|
||||||
|
|
||||||
## 0.2.2
|
## 0.2.2
|
||||||
|
|
||||||
- Add `messageLinks` property to `MessageTheme` to customize links color
|
- Add `messageLinks` property to `MessageTheme` to customize links color
|
||||||
|
|||||||
@@ -107,10 +107,8 @@ class ChannelBottomSheet extends StatelessWidget {
|
|||||||
'Do you want to leave the group?',
|
'Do you want to leave the group?',
|
||||||
);
|
);
|
||||||
if (confirm == true) {
|
if (confirm == true) {
|
||||||
await channel.removeMembers(channel.state.members
|
await channel
|
||||||
.where((element) =>
|
.removeMembers([StreamChat.of(context).user.id]);
|
||||||
element.userId == StreamChat.of(context).user.id)
|
|
||||||
.toList());
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,10 +131,8 @@ class ChannelBottomSheet extends StatelessWidget {
|
|||||||
'Do you want to delete the chat?',
|
'Do you want to delete the chat?',
|
||||||
);
|
);
|
||||||
if (confirm == true) {
|
if (confirm == true) {
|
||||||
await channel.removeMembers(channel.state.members
|
await channel
|
||||||
.where((element) =>
|
.removeMembers([StreamChat.of(context).user.id]);
|
||||||
element.userId == StreamChat.of(context).user.id)
|
|
||||||
.toList());
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -339,11 +339,8 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
'Do you want to leave the group?',
|
'Do you want to leave the group?',
|
||||||
);
|
);
|
||||||
if (confirm == true) {
|
if (confirm == true) {
|
||||||
await channel.removeMembers(channel.state.members
|
await channel
|
||||||
.where((element) =>
|
.removeMembers([StreamChat.of(context).user.id]);
|
||||||
element.userId ==
|
|
||||||
StreamChat.of(context).user.id)
|
|
||||||
.toList());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -357,11 +354,8 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
'Do you want to delete the chat?',
|
'Do you want to delete the chat?',
|
||||||
);
|
);
|
||||||
if (confirm == true) {
|
if (confirm == true) {
|
||||||
await channel.removeMembers(channel.state.members
|
await channel
|
||||||
.where((element) =>
|
.removeMembers([StreamChat.of(context).user.id]);
|
||||||
element.userId ==
|
|
||||||
StreamChat.of(context).user.id)
|
|
||||||
.toList());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -472,6 +466,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
.on(
|
.on(
|
||||||
EventType.connectionRecovered,
|
EventType.connectionRecovered,
|
||||||
EventType.notificationAddedToChannel,
|
EventType.notificationAddedToChannel,
|
||||||
|
EventType.notificationMessageNew,
|
||||||
EventType.channelVisible,
|
EventType.channelVisible,
|
||||||
)
|
)
|
||||||
.listen((event) {
|
.listen((event) {
|
||||||
|
|||||||
@@ -4,16 +4,21 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'package:stream_chat_flutter/src/stream_chat.dart';
|
import 'package:stream_chat_flutter/src/stream_chat.dart';
|
||||||
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
|
||||||
/// Widget dedicated to the management of a channel list with pagination
|
/// Widget dedicated to the management of a channel list with pagination
|
||||||
class ChannelsBloc extends StatefulWidget {
|
class ChannelsBloc extends StatefulWidget {
|
||||||
/// The widget child
|
/// The widget child
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
|
/// Set this to false to prevent channels to be brought to the top of the list when a new message arrives
|
||||||
|
final bool lockChannelsOrder;
|
||||||
|
|
||||||
/// Instantiate a new ChannelsBloc
|
/// Instantiate a new ChannelsBloc
|
||||||
const ChannelsBloc({
|
const ChannelsBloc({
|
||||||
Key key,
|
Key key,
|
||||||
this.child,
|
this.child,
|
||||||
|
this.lockChannelsOrder = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -58,6 +63,8 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
|||||||
Stream<bool> get queryChannelsLoading =>
|
Stream<bool> get queryChannelsLoading =>
|
||||||
_queryChannelsLoadingController.stream;
|
_queryChannelsLoadingController.stream;
|
||||||
|
|
||||||
|
final List<Channel> _hiddenChannels = [];
|
||||||
|
|
||||||
/// Calls [client.queryChannels] updating [queryChannelsLoading] stream
|
/// Calls [client.queryChannels] updating [queryChannelsLoading] stream
|
||||||
Future<void> queryChannels({
|
Future<void> queryChannels({
|
||||||
Map<String, dynamic> filter,
|
Map<String, dynamic> filter,
|
||||||
@@ -112,12 +119,31 @@ class ChannelsBlocState extends State<ChannelsBloc>
|
|||||||
|
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChat.of(context).client;
|
||||||
|
|
||||||
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
|
if (!widget.lockChannelsOrder) {
|
||||||
final newChannels = List<Channel>.from(channels ?? []);
|
_subscriptions.add(client.on(EventType.messageNew).listen((e) {
|
||||||
final index = newChannels.indexWhere((c) => c.cid == e.cid);
|
final newChannels = List<Channel>.from(channels ?? []);
|
||||||
if (index > 0) {
|
final index = newChannels.indexWhere((c) => c.cid == e.cid);
|
||||||
final channel = newChannels.removeAt(index);
|
if (index > 0) {
|
||||||
newChannels.insert(0, channel);
|
final channel = newChannels.removeAt(index);
|
||||||
|
newChannels.insert(0, channel);
|
||||||
|
_channelsController.add(newChannels);
|
||||||
|
} else {
|
||||||
|
final hiddenIndex = _hiddenChannels.indexWhere((c) => c.cid == e.cid);
|
||||||
|
if (hiddenIndex > -1) {
|
||||||
|
newChannels.insert(0, _hiddenChannels[hiddenIndex]);
|
||||||
|
_hiddenChannels.removeAt(hiddenIndex);
|
||||||
|
_channelsController.add(newChannels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
_subscriptions.add(client.on(EventType.channelHidden).listen((event) async {
|
||||||
|
final newChannels = List<Channel>.from(channels);
|
||||||
|
final channelIndex = newChannels.indexWhere((c) => c.cid == event.cid);
|
||||||
|
if (channelIndex > -1) {
|
||||||
|
final channel = newChannels.removeAt(channelIndex);
|
||||||
|
_hiddenChannels.add(channel);
|
||||||
_channelsController.add(newChannels);
|
_channelsController.add(newChannels);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -208,8 +208,8 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var leftPadding = widget.showUserAvatar != DisplayWidget.gone
|
var leftPadding = widget.showUserAvatar != DisplayWidget.gone
|
||||||
? widget.messageTheme.avatarTheme.constraints.maxWidth + 16.0
|
? widget.messageTheme.avatarTheme.constraints.maxWidth + 24.0
|
||||||
: 6.0;
|
: 16.0;
|
||||||
return Portal(
|
return Portal(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.padding ?? EdgeInsets.all(8),
|
padding: widget.padding ?? EdgeInsets.all(8),
|
||||||
@@ -232,6 +232,15 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
if (widget.showSendingIndicator == DisplayWidget.show)
|
||||||
|
_buildSendingIndicator(),
|
||||||
|
SizedBox(
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
if (widget.showSendingIndicator == DisplayWidget.hide)
|
||||||
|
SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
if (widget.showUserAvatar == DisplayWidget.show)
|
if (widget.showUserAvatar == DisplayWidget.show)
|
||||||
_buildUserAvatar(),
|
_buildUserAvatar(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat_flutter
|
name: stream_chat_flutter
|
||||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||||
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
||||||
version: 0.2.2
|
version: 0.2.3
|
||||||
repository: https://github.com/GetStream/stream-chat-flutter
|
repository: https://github.com/GetStream/stream-chat-flutter
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ dependencies:
|
|||||||
file_picker: ^1.12.0
|
file_picker: ^1.12.0
|
||||||
image_picker: ^0.6.7+2
|
image_picker: ^0.6.7+2
|
||||||
flutter_keyboard_visibility: ^3.2.1
|
flutter_keyboard_visibility: ^3.2.1
|
||||||
stream_chat: ^0.2.1
|
flutter_svg: ^0.18.0
|
||||||
flutter_svg: ^0.17.0
|
stream_chat: ^0.2.2
|
||||||
mime: ^0.9.6+3
|
mime: ^0.9.6+3
|
||||||
visibility_detector: ^0.1.5
|
visibility_detector: ^0.1.5
|
||||||
line_awesome_icons: ^1.0.4+2
|
line_awesome_icons: ^1.0.4+2
|
||||||
|
|||||||
Reference in New Issue
Block a user