From 18d76f505cb83e7d84efcde6156a5ff1056dcbf7 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 16:13:37 +0200 Subject: [PATCH 1/9] Update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c1c6b4a..125f0021 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,19 @@ The example is available under the [example](https://github.com/GetStream/stream ```yaml dependencies: - stream_chat_flutter: ^0.1.19 + stream_chat_flutter: ^0.1.20 ``` You should then run `flutter packages get` +### Alpha version + +Use version `^0.2.0-alpha` 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 ✅ From fefcc50280df750b007b7089261b74870cb633aa Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 17:13:16 +0200 Subject: [PATCH 2/9] fix video loading and error --- lib/src/message_widget.dart | 47 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 43104bd6..73d080d2 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -952,8 +952,12 @@ class _MessageWidgetState extends State future: videoController.initialize(), builder: (_, snapshot) { if (snapshot.connectionState != ConnectionState.done) { - return Center( - child: CircularProgressIndicator(), + return Container( + height: 100, + width: 100, + child: Center( + child: CircularProgressIndicator(), + ), ); } ChewieController chewieController; @@ -966,26 +970,31 @@ class _MessageWidgetState extends State autoInitialize: false, aspectRatio: videoController.value.aspectRatio, errorBuilder: (_, e) { - return Stack( - children: [ - Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: CachedNetworkImageProvider( - attachment.thumbUrl, + if (attachment.thumbUrl != null) { + return Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.cover, + image: CachedNetworkImageProvider( + attachment.thumbUrl, + ), ), ), ), - ), - Material( - color: Colors.transparent, - child: InkWell( - onTap: () => _launchURL(attachment.titleLink), - ), - ), - ], - ); + if (attachment.titleLink != null) + Material( + color: Colors.transparent, + child: InkWell( + onTap: () => _launchURL(attachment.titleLink), + ), + ), + ], + ); + } + + return _buildErrorImage(attachment); }); _chuwieControllers[attachment.assetUrl] = chewieController; } From 3306a32db78d182d0fe689d3a99c4902c3ad2faf Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 17:17:01 +0200 Subject: [PATCH 3/9] v --- CHANGELOG.md | 4 ++++ README.md | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3354e42..0cc637c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.21 + +- Fix video loading and error + ## 0.1.20 - Add message configuration properties to MessageListView diff --git a/README.md b/README.md index 125f0021..073e2bee 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ The example is available under the [example](https://github.com/GetStream/stream ```yaml dependencies: - stream_chat_flutter: ^0.1.20 + stream_chat_flutter: ^0.1.21 ``` You should then run `flutter packages get` ### Alpha version -Use version `^0.2.0-alpha` to use the latest available version. +Use version `^0.2.0-alpha+1` 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. diff --git a/pubspec.yaml b/pubspec.yaml index 772bda77..68745af2 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.1.20 +version: 0.1.21 environment: sdk: ">=2.3.0 <3.0.0" From 7d62912300f619bb01555cef9431b0595ca5e850 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 18:09:36 +0200 Subject: [PATCH 4/9] add better mime detection --- lib/src/message_input.dart | 31 ++++++++++++++++++++++++------- lib/src/message_widget.dart | 4 +++- pubspec.yaml | 1 + 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 7049c68b..d4ff148a 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:mime/mime.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat_flutter/src/message_list_view.dart'; import 'package:stream_chat_flutter/src/stream_chat_theme.dart'; @@ -634,14 +635,30 @@ class _MessageInputState extends State { _attachments.add(attachment); }); - final res = await channel.sendFile( - MultipartFile.fromBytes( - bytes, - filename: file.path.split('/').last, - ), - ); + String url; + final filename = file.path.split('/').last; - attachment.url = res.file; + if (type == FileType.image) { + final res = await channel.sendImage( + MultipartFile.fromBytes( + bytes, + filename: filename, + contentType: MediaType.parse(lookupMimeType(filename)), + ), + ); + url = res.file; + } else { + final res = await channel.sendFile( + MultipartFile.fromBytes( + bytes, + filename: filename, + contentType: MediaType.parse(lookupMimeType(filename)), + ), + ); + url = res.file; + } + + attachment.url = url; setState(() { attachment.uploaded = true; diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 73d080d2..1e909033 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -949,7 +949,9 @@ class _MessageWidgetState extends State } return FutureBuilder( - future: videoController.initialize(), + future: videoController.value.initialized + ? Future.value(true) + : videoController.initialize(), builder: (_, snapshot) { if (snapshot.connectionState != ConnectionState.done) { return Container( diff --git a/pubspec.yaml b/pubspec.yaml index 68745af2..28ec8190 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: image_picker: ^0.6.4 flutter_keyboard_visibility: ^0.8.0 stream_chat: ^0.1.21 + mime: ^0.9.6+3 visibility_detector: ^0.1.4 dev_dependencies: From f76ed94e9fc6cb26ebc9d3d1d168819e6e2c2dde Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 10 Apr 2020 18:30:27 +0200 Subject: [PATCH 5/9] version bump --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc637c5..1f41dc0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.22 + +- Better mime type detection + ## 0.1.21 - Fix video loading and error diff --git a/pubspec.yaml b/pubspec.yaml index 28ec8190..944e36bc 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.1.21 +version: 0.1.22 environment: sdk: ">=2.3.0 <3.0.0" From 6db0b209d4ba36bb2c10ee6451f3a671040c62b4 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Sat, 11 Apr 2020 13:25:55 +0200 Subject: [PATCH 6/9] update dependencies --- pubspec.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 944e36bc..f15f3e4e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,13 +11,13 @@ dependencies: sdk: flutter rxdart: ^0.23.1 jiffy: ^3.0.1 - cached_network_image: ^2.0.0 + cached_network_image: ^2.1.0+1 flutter_markdown: ^0.3.4 url_launcher: ^5.4.2 video_player: ^0.10.8+1 chewie: ^0.9.10 - file_picker: ^1.6.0 - image_picker: ^0.6.4 + file_picker: ^1.6.2 + image_picker: ^0.6.5 flutter_keyboard_visibility: ^0.8.0 stream_chat: ^0.1.21 mime: ^0.9.6+3 From 3c02dfb3ab6a31b3cac46529b452a28dfc922afe Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Sat, 11 Apr 2020 13:32:59 +0200 Subject: [PATCH 7/9] bump version --- CHANGELOG.md | 4 ++++ lib/src/message_widget.dart | 16 ++++++++++++++++ pubspec.yaml | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f41dc0e..39c5cbdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.23 + +- Hotfix + ## 0.1.22 - Better mime type detection diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 1e909033..acd1ff58 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -937,6 +937,22 @@ class _MessageWidgetState extends State ); } + Widget _buildErrorImage(Attachment attachment) { + return Center( + child: Container( + width: 200, + height: 140, + color: Color(0xffd0021B).withOpacity(.1), + child: Center( + child: Icon( + Icons.error_outline, + color: Colors.white, + ), + ), + ), + ); + } + Widget _buildVideo( Attachment attachment, ) { diff --git a/pubspec.yaml b/pubspec.yaml index f15f3e4e..a32fddd2 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.1.22 +version: 0.1.23 environment: sdk: ">=2.3.0 <3.0.0" From 5204715a37638e4597292b657ffd044017840441 Mon Sep 17 00:00:00 2001 From: Luis Pulido Date: Wed, 15 Apr 2020 15:34:13 -0400 Subject: [PATCH 8/9] removed the Flex causing the widget to overflow --- lib/src/message_input.dart | 114 +++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 62 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index d4ff148a..8d3f4f1d 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -279,37 +279,33 @@ class _MessageInputState extends State { ], color: StreamChatTheme.of(context).primaryColor, ), - child: Flex( - mainAxisSize: MainAxisSize.min, - direction: Axis.vertical, - children: [ - ListView( - padding: const EdgeInsets.all(0), - shrinkWrap: true, - children: commands - .map((c) => ListTile( - title: Text.rich( - TextSpan( - text: '${c.name}', - style: TextStyle(fontWeight: FontWeight.bold), - children: [ - TextSpan( - text: ' ${c.args}', - style: TextStyle( - fontWeight: FontWeight.w300, - ), - ), - ], + child: ListView( + padding: const EdgeInsets.all(0), + shrinkWrap: true, + children: commands + .map( + (c) => ListTile( + title: Text.rich( + TextSpan( + text: '${c.name}', + style: TextStyle(fontWeight: FontWeight.bold), + children: [ + TextSpan( + text: ' ${c.args}', + style: TextStyle( + fontWeight: FontWeight.w300, ), ), - subtitle: Text(c.description), - onTap: () { - _setCommand(c); - }, - )) - .toList(), - ), - ], + ], + ), + ), + subtitle: Text(c.description), + onTap: () { + _setCommand(c); + }, + ), + ) + .toList(), ), ), ), @@ -350,41 +346,35 @@ class _MessageInputState extends State { ], color: StreamChatTheme.of(context).primaryColor, ), - child: Flex( - mainAxisSize: MainAxisSize.min, - direction: Axis.vertical, - children: [ - ListView( - padding: const EdgeInsets.all(0), - shrinkWrap: true, - children: members - .map((m) => ListTile( - leading: UserAvatar( - user: m.user, + child: ListView( + padding: const EdgeInsets.all(0), + shrinkWrap: true, + children: members + .map((m) => ListTile( + leading: UserAvatar( + user: m.user, + ), + title: Text('${m.user.name}'), + onTap: () { + _mentionedUsers.add(m.user); + + splits[splits.length - 1] = m.user.name; + final rejoin = splits.join('@'); + + _textController.value = TextEditingValue( + text: rejoin + + _textController.text + .substring(_textController.selection.start), + selection: TextSelection.collapsed( + offset: rejoin.length, ), - title: Text('${m.user.name}'), - onTap: () { - _mentionedUsers.add(m.user); + ); - splits[splits.length - 1] = m.user.name; - final rejoin = splits.join('@'); - - _textController.value = TextEditingValue( - text: rejoin + - _textController.text.substring( - _textController.selection.start), - selection: TextSelection.collapsed( - offset: rejoin.length, - ), - ); - - _mentionsOverlay?.remove(); - _mentionsOverlay = null; - }, - )) - .toList(), - ), - ], + _mentionsOverlay?.remove(); + _mentionsOverlay = null; + }, + )) + .toList(), ), ), ), From a46935ec803dbed1d37d62fc2f34eb157b578b92 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 16 Apr 2020 09:34:51 +0200 Subject: [PATCH 9/9] version bump --- CHANGELOG.md | 4 ++++ pubspec.yaml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39c5cbdc..445788e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.24 + +- Fx overflow in mentions overlay + ## 0.1.23 - Hotfix diff --git a/pubspec.yaml b/pubspec.yaml index a32fddd2..20f3a29c 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.1.23 +version: 0.1.24 environment: sdk: ">=2.3.0 <3.0.0" @@ -22,6 +22,7 @@ dependencies: stream_chat: ^0.1.21 mime: ^0.9.6+3 visibility_detector: ^0.1.4 + http_parser: ^3.1.4 dev_dependencies: pedantic: ^1.9.0