From f35321a7d9c377b5148eaf66d0b6990941fd8c45 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 22 Jun 2020 15:18:03 +0200 Subject: [PATCH 01/11] fix message list when readlist is null --- lib/src/message_list_view.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index c4b5a390..a48fee83 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -429,13 +429,13 @@ class _MessageListViewState extends State { final readList = StreamChannel.of(context) .channel .state - .read - .where((element) => element.user.id != userId) - .where((read) => + ?.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(); return MessageWidget( message: message, @@ -451,7 +451,7 @@ class _MessageListViewState extends State { (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, From b5b844e16fa67e75c183bd3259ffa24d6ae1b712 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 22 Jun 2020 17:05:33 +0200 Subject: [PATCH 02/11] version bump --- CHANGELOG.md | 4 ++++ example/lib/customize_message_widget.dart | 3 +++ pubspec.yaml | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0c72144..eaa92c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1-alpha+10 + +- Update llc dependency + ## 0.2.1-alpha+9 - Add read indicators diff --git a/example/lib/customize_message_widget.dart b/example/lib/customize_message_widget.dart index c963f7ba..fc614125 100644 --- a/example/lib/customize_message_widget.dart +++ b/example/lib/customize_message_widget.dart @@ -98,6 +98,9 @@ class ChannelPage extends StatelessWidget { ) { final message = details.message; final color = details.isMyMessage ? Colors.blueGrey : Colors.blue; + if (message.isSystem) { + return SizedBox(); + } return MessageWidget( message: message, messageTheme: details.isMyMessage diff --git a/pubspec.yaml b/pubspec.yaml index 0a55458d..3ba95c17 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: 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. -version: 0.2.1-alpha+9 +version: 0.2.1-alpha+10 environment: sdk: ">=2.3.0 <3.0.0" @@ -21,7 +21,7 @@ dependencies: file_picker: ^1.9.0+1 image_picker: ^0.6.7 flutter_keyboard_visibility: ^3.0.0 - stream_chat: ^0.2.0-alpha+20 + stream_chat: ^0.2.0-alpha+22 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4 From a5bb7072b346db8f6b3d8d38bdf8b7f9b79828ff Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 23 Jun 2020 13:03:23 +0200 Subject: [PATCH 03/11] update deprecated dependency --- lib/src/message_input.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 9926aa8e..6358e39e 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -161,6 +161,7 @@ class MessageInputState extends State { final _focusNode = FocusNode(); final List _mentionedUsers = []; + final _imagePicker = ImagePicker(); bool _inputEnabled = true; bool _messageIsPresent = false; bool _typingStarted = false; @@ -721,11 +722,13 @@ class MessageInputState extends State { } 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) { From 73aab693c74570e9101b9c11811724c34f2e628e Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 24 Jun 2020 10:34:03 +0200 Subject: [PATCH 04/11] use last message getter --- lib/src/channel_preview.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/src/channel_preview.dart b/lib/src/channel_preview.dart index 1e86f4fb..5a3432aa 100644 --- a/lib/src/channel_preview.dart +++ b/lib/src/channel_preview.dart @@ -122,11 +122,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(); } From 1d2ad50b93a2a1780941bef75e3d8089bd192fdf Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 24 Jun 2020 11:54:57 +0200 Subject: [PATCH 05/11] update dependencies --- pubspec.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 3ba95c17..12531197 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,13 +14,13 @@ dependencies: jiffy: ^3.0.1 flutter_portal: ^0.1.0 cached_network_image: ^2.2.0+1 - flutter_markdown: ^0.4.1 - url_launcher: ^5.4.10 + flutter_markdown: ^0.4.2 + url_launcher: ^5.4.11 video_player: ^0.10.11+1 chewie: ^0.9.10 - file_picker: ^1.9.0+1 - image_picker: ^0.6.7 - flutter_keyboard_visibility: ^3.0.0 + file_picker: ^1.12.0 + image_picker: ^0.6.7+2 + flutter_keyboard_visibility: ^3.2.1 stream_chat: ^0.2.0-alpha+22 mime: ^0.9.6+3 visibility_detector: ^0.1.5 From 90ff138dece578eadf20144b88bce0ffa7fff3c5 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 24 Jun 2020 15:54:00 +0200 Subject: [PATCH 06/11] version bump --- CHANGELOG.md | 4 ++++ pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaa92c3f..d0054b2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1-alpha+11 + +- Update llc dependency + ## 0.2.1-alpha+10 - Update llc dependency diff --git a/pubspec.yaml b/pubspec.yaml index 12531197..77840411 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: 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. -version: 0.2.1-alpha+10 +version: 0.2.1-alpha+11 environment: sdk: ">=2.3.0 <3.0.0" @@ -21,7 +21,7 @@ dependencies: file_picker: ^1.12.0 image_picker: ^0.6.7+2 flutter_keyboard_visibility: ^3.2.1 - stream_chat: ^0.2.0-alpha+22 + stream_chat: ^0.2.0-alpha+23 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4 From 57d4638b154288acf4866e1b3e6f7e2338434f8c Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 1 Jul 2020 10:00:29 +0200 Subject: [PATCH 07/11] update examples --- example/lib/multiple_conversation.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/example/lib/multiple_conversation.dart b/example/lib/multiple_conversation.dart index 17646bd3..647ae7dd 100644 --- a/example/lib/multiple_conversation.dart +++ b/example/lib/multiple_conversation.dart @@ -44,9 +44,7 @@ class MyApp extends StatelessWidget { client: client, child: child, ), - home: Container( - child: ChannelListPage(), - ), + home: ChannelListPage(), ); } } From 9830bb50748969fad391b2f636ce2e65895c7f9f Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 6 Jul 2020 15:36:20 +0200 Subject: [PATCH 08/11] version bump --- CHANGELOG.md | 8 ++++ README.md | 55 +++++++++------------- example/lib/customize_channel_preview.dart | 15 +++--- lib/src/channel_header.dart | 3 ++ pubspec.yaml | 6 ++- 5 files changed, 46 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0054b2b..4844b83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.2.1 + +- Better ui components +- Add read indicators +- Add system messages +- Use llc 0.2 +- Add `ChannelsBloc` widget to manage a list of channels with pagination + ## 0.2.1-alpha+11 - Update llc dependency diff --git a/README.md b/README.md index 9049b4c0..16af889f 100644 --- a/README.md +++ b/README.md @@ -33,19 +33,11 @@ The example is available under the [example](https://github.com/GetStream/stream ```yaml dependencies: - stream_chat_flutter: ^0.1.19 + stream_chat_flutter: ^0.2.0 ``` You should then run `flutter packages get` -### Alpha version - -Use version `^0.2.0-alpha+2` to use the latest available version. - -Note that this is still an alpha version. There may be some bugs, and the API can change in breaking ways. - -Thanks to whoever tries these versions and reports bugs or suggestions. - ### Android All set ✅ @@ -86,6 +78,7 @@ Every widget uses the `StreamChat` or `StreamChannel` widgets to manage the stat - [MessageWidget](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/MessageWidget-class.html) - [StreamChatTheme](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/StreamChatTheme-class.html) - [ThreadHeader](https://pub.dev/documentation/stream_chat_flutter/latest/stream_chat_flutter/ThreadHeader-class.html) +- ... ### Customizing styles @@ -109,14 +102,13 @@ Out of the box, all chat widgets use their default styling, and there are two wa return MaterialApp( theme: theme, - home: Container( - child: StreamChat( - streamChatThemeData: StreamChatThemeData.fromTheme(theme), - client: client, - child: ChannelListPage(), - ), + builder: (context, child) => StreamChat( + child: child, + client: client, + streamChatThemeData: StreamChatThemeData.fromTheme(theme), ), - ); + home: ChannelListPage(), + ); } } ``` @@ -136,24 +128,23 @@ Out of the box, all chat widgets use their default styling, and there are two wa return MaterialApp( theme: theme, - home: Container( - child: StreamChat( - streamChatThemeData: StreamChatThemeData.fromTheme(theme).copyWith( - ownMessageTheme: MessageTheme( - messageBackgroundColor: Colors.black, - messageText: TextStyle( - color: Colors.white, - ), - avatarTheme: AvatarTheme( - borderRadius: BorderRadius.circular(8), - ), - ), + builder: (context, child) => StreamChat( + child: child, + client: client, + streamChatThemeData: StreamChatThemeData.fromTheme(theme).copyWith( + ownMessageTheme: MessageTheme( + messageBackgroundColor: Colors.black, + messageText: TextStyle( + color: Colors.white, ), - client: client, - child: ChannelListPage(), - ), + avatarTheme: AvatarTheme( + borderRadius: BorderRadius.circular(8), + ), + ), + ), ), - ); + home: ChannelListPage(), + ); } } ``` diff --git a/example/lib/customize_channel_preview.dart b/example/lib/customize_channel_preview.dart index 55da346c..3809f780 100644 --- a/example/lib/customize_channel_preview.dart +++ b/example/lib/customize_channel_preview.dart @@ -59,7 +59,7 @@ class ChannelListPage extends StatelessWidget { filter: { 'members': { '\$in': [StreamChat.of(context).user.id], - }, + } }, channelPreviewBuilder: _channelPreviewBuilder, sort: [SortOption('last_message_at')], @@ -73,17 +73,18 @@ class ChannelListPage extends StatelessWidget { } Widget _channelPreviewBuilder(BuildContext context, Channel channel) { - final lastMessage = channel.state.messages.reversed.firstWhere( - (message) => message.type != 'deleted', - orElse: () => null, - ); + final lastMessage = channel.state.messages.reversed + .firstWhere((message) => !message.isDeleted); - final subtitle = (lastMessage == null ? 'nothing yet' : lastMessage.text); + final subtitle = (lastMessage == null ? "nothing yet" : lastMessage.text); final opacity = channel.state.unreadCount > .0 ? 1.0 : 0.5; return ListTile( - leading: ChannelImage(), + leading: ChannelImage( + channel: channel, + ), title: ChannelName( + channel: channel, textStyle: StreamChatTheme.of(context).channelPreviewTheme.title.copyWith( color: Colors.black.withOpacity(opacity), diff --git a/lib/src/channel_header.dart b/lib/src/channel_header.dart index 26668697..5a7a146c 100644 --- a/lib/src/channel_header.dart +++ b/lib/src/channel_header.dart @@ -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, ), ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 77840411..249d83b3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,9 @@ name: 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. -version: 0.2.1-alpha+11 +version: 0.2.1 +repository: https://github.com/GetStream/stream-chat-flutter +issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: sdk: ">=2.3.0 <3.0.0" @@ -21,7 +23,7 @@ dependencies: file_picker: ^1.12.0 image_picker: ^0.6.7+2 flutter_keyboard_visibility: ^3.2.1 - stream_chat: ^0.2.0-alpha+23 + stream_chat: ^0.2.0 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4 From a4e548279b27e1cb82bd26894af0d34bb2d1e193 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 6 Jul 2020 15:37:27 +0200 Subject: [PATCH 09/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16af889f..d2bd5dd6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The example is available under the [example](https://github.com/GetStream/stream ```yaml dependencies: - stream_chat_flutter: ^0.2.0 + stream_chat_flutter: ^0.2.1 ``` You should then run `flutter packages get` From 981bce3d21c21693dd6b1699febc76808620e4b1 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 9 Jul 2020 17:37:34 +0200 Subject: [PATCH 10/11] bump version --- CHANGELOG.md | 4 ++++ pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4844b83b..68c78d58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1+1 + +- Update llc dependency + ## 0.2.1 - Better ui components diff --git a/pubspec.yaml b/pubspec.yaml index 249d83b3..5ad715c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: 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. -version: 0.2.1 +version: 0.2.1+1 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -23,7 +23,7 @@ dependencies: file_picker: ^1.12.0 image_picker: ^0.6.7+2 flutter_keyboard_visibility: ^3.2.1 - stream_chat: ^0.2.0 + stream_chat: ^0.2.0+1 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4 From d116c0537f82ca321fb593402b5e5612c4b247e4 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 14 Jul 2020 16:32:44 +0200 Subject: [PATCH 11/11] bump version --- CHANGELOG.md | 4 ++++ pubspec.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68c78d58..eb83c19a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1+2 + +- Update llc dependency + ## 0.2.1+1 - Update llc dependency diff --git a/pubspec.yaml b/pubspec.yaml index 5ad715c7..d3c026c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: 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. -version: 0.2.1+1 +version: 0.2.1+2 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -23,7 +23,7 @@ dependencies: file_picker: ^1.12.0 image_picker: ^0.6.7+2 flutter_keyboard_visibility: ^3.2.1 - stream_chat: ^0.2.0+1 + stream_chat: ^0.2.0+2 mime: ^0.9.6+3 visibility_detector: ^0.1.5 http_parser: ^3.1.4