Merge pull request #134 from GetStream/develop

- Fixes null user image
This commit is contained in:
Neevash Ramdial (Nash)
2020-11-10 13:10:42 -04:00
committed by GitHub
4 changed files with 20 additions and 8 deletions
+5
View File
@@ -1,3 +1,8 @@
## 0.2.12
- Upgrade dependencies
- Check if user.extraData['image'] is not null before using it
## 0.2.11+1 ## 0.2.11+1
- Fix error with channel query while handling background notifications - Fix error with channel query while handling background notifications
+5 -1
View File
@@ -24,7 +24,11 @@ class MessageText extends StatelessWidget {
final text = _replaceMentions(message.text); final text = _replaceMentions(message.text);
return MarkdownBody( return MarkdownBody(
data: text, data: text,
onTapLink: (link) { onTapLink: (
String link,
String href,
String title,
) {
if (link.startsWith('@')) { if (link.startsWith('@')) {
final mentionedUser = message.mentionedUsers.firstWhere( final mentionedUser = message.mentionedUsers.firstWhere(
(u) => '@${u.name.replaceAll(' ', '')}' == link, (u) => '@${u.name.replaceAll(' ', '')}' == link,
+4 -1
View File
@@ -18,6 +18,9 @@ class UserAvatar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final hasImage = user.extraData?.containsKey('image') == true &&
user.extraData['image'] != null &&
user.extraData['image'] != '';
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (onTap != null) { if (onTap != null) {
@@ -38,7 +41,7 @@ class UserAvatar extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: StreamChatTheme.of(context).accentColor, color: StreamChatTheme.of(context).accentColor,
), ),
child: user.extraData?.containsKey('image') ?? false child: hasImage
? CachedNetworkImage( ? CachedNetworkImage(
imageUrl: user.extraData['image'], imageUrl: user.extraData['image'],
errorWidget: (_, __, ___) { errorWidget: (_, __, ___) {
+6 -6
View File
@@ -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.11+1 version: 0.2.12
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
@@ -16,13 +16,13 @@ dependencies:
jiffy: ^3.0.1 jiffy: ^3.0.1
flutter_portal: ^0.3.0 flutter_portal: ^0.3.0
cached_network_image: ^2.2.0+1 cached_network_image: ^2.2.0+1
flutter_markdown: ^0.4.2 flutter_markdown: ^0.5.0
url_launcher: ^5.4.11 url_launcher: ^5.4.11
video_player: ^0.10.11+1 video_player: ^1.0.0
chewie: ^0.9.10 chewie: ^0.10.4
file_picker: ^2.0.0 file_picker: ^2.0.12
image_picker: ^0.6.7+2 image_picker: ^0.6.7+2
flutter_keyboard_visibility: ^3.2.1 flutter_keyboard_visibility: ^3.3.0
stream_chat: ^0.2.10 stream_chat: ^0.2.10
mime: ^0.9.6+3 mime: ^0.9.6+3
visibility_detector: ^0.1.5 visibility_detector: ^0.1.5