Merge branch 'master' into feature/new-ui
This commit is contained in:
@@ -157,6 +157,9 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 15,
|
||||
color: Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -172,11 +172,7 @@ class ChannelPreview extends StatelessWidget {
|
||||
stream: channel.state.messagesStream,
|
||||
initialData: channel.state.messages,
|
||||
builder: (context, snapshot) {
|
||||
final messages = snapshot.data;
|
||||
final lastMessage = messages?.isNotEmpty == true
|
||||
? messages.lastWhere((m) =>
|
||||
!(m.isDeleted && m.status == MessageSendingStatus.FAILED))
|
||||
: null;
|
||||
final lastMessage = channel.state.lastMessage;
|
||||
if (lastMessage == null) {
|
||||
return SizedBox();
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ class MessageInputState extends State<MessageInput> {
|
||||
final _focusNode = FocusNode();
|
||||
final List<User> _mentionedUsers = [];
|
||||
|
||||
final _imagePicker = ImagePicker();
|
||||
bool _inputEnabled = true;
|
||||
bool _messageIsPresent = false;
|
||||
bool _typingStarted = false;
|
||||
@@ -721,11 +722,13 @@ class MessageInputState extends State<MessageInput> {
|
||||
}
|
||||
|
||||
if (camera) {
|
||||
PickedFile pickedFile;
|
||||
if (fileType == DefaultAttachmentTypes.image) {
|
||||
file = await ImagePicker.pickImage(source: ImageSource.camera);
|
||||
pickedFile = await _imagePicker.getImage(source: ImageSource.camera);
|
||||
} else if (fileType == DefaultAttachmentTypes.video) {
|
||||
file = await ImagePicker.pickVideo(source: ImageSource.camera);
|
||||
pickedFile = await _imagePicker.getVideo(source: ImageSource.camera);
|
||||
}
|
||||
file = File(pickedFile.path);
|
||||
} else {
|
||||
FileType type;
|
||||
if (fileType == DefaultAttachmentTypes.image) {
|
||||
|
||||
@@ -424,14 +424,14 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
final isNextUser =
|
||||
index - 1 >= 0 && message.user.id == messages[index - 1]?.user?.id;
|
||||
|
||||
var channel = StreamChannel.of(context).channel;
|
||||
final readList = channel.state.read
|
||||
.where((element) => element.user.id != userId)
|
||||
.where((read) =>
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
final readList = channel.state?.read
|
||||
?.where((element) => element.user.id != userId)
|
||||
?.where((read) =>
|
||||
read.lastRead.isAfter(message.createdAt) &&
|
||||
(index == 0 ||
|
||||
read.lastRead.isBefore(messages[index - 1].createdAt)))
|
||||
.toList();
|
||||
?.toList();
|
||||
|
||||
final allRead = readList.length == channel.memberCount - 1;
|
||||
|
||||
@@ -449,7 +449,7 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
(index == 0 || message.status != MessageSendingStatus.SENT)
|
||||
? DisplayWidget.show
|
||||
: DisplayWidget.hide,
|
||||
showTimestamp: !isNextUser || readList.isNotEmpty,
|
||||
showTimestamp: !isNextUser || readList?.isNotEmpty == true,
|
||||
showEditMessage: isMyMessage,
|
||||
showDeleteMessage: isMyMessage,
|
||||
borderSide: isMyMessage ? BorderSide.none : null,
|
||||
|
||||
Reference in New Issue
Block a user