Merge branch 'master' into feature/offline

This commit is contained in:
Salvatore Giordano
2020-03-15 13:58:10 +01:00
7 changed files with 28 additions and 21 deletions
+4
View File
@@ -1,3 +1,7 @@
## 0.1.11
- Fix bug in ChannelPreview when list of messages is empty
## 0.1.10 ## 0.1.10
- Do not automatically dispose Client object when disposing StreamChat widget - Do not automatically dispose Client object when disposing StreamChat widget
+1 -1
View File
@@ -30,7 +30,7 @@ The example is available under the [example](https://github.com/GetStream/stream
```yaml ```yaml
dependencies: dependencies:
stream_chat_flutter: ^0.1.10 stream_chat_flutter: ^0.1.11
``` ```
You should then run `flutter packages get` You should then run `flutter packages get`
+3
View File
@@ -68,6 +68,9 @@ class ChannelPreview extends StatelessWidget {
stream: channel.lastMessageAtStream, stream: channel.lastMessageAtStream,
initialData: channel.lastMessageAt, initialData: channel.lastMessageAt,
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) {
return SizedBox();
}
final lastMessageAt = snapshot.data.toLocal(); final lastMessageAt = snapshot.data.toLocal();
String stringDate; String stringDate;
+15 -15
View File
@@ -449,7 +449,7 @@ class _MessageInputState extends State<MessageInput> {
Widget _buildAttachment(_SendingAttachment attachment) { Widget _buildAttachment(_SendingAttachment attachment) {
switch (attachment.type) { switch (attachment.type) {
case FileType.IMAGE: case FileType.image:
return attachment.file != null return attachment.file != null
? Image.file( ? Image.file(
attachment.file, attachment.file,
@@ -460,7 +460,7 @@ class _MessageInputState extends State<MessageInput> {
fit: BoxFit.cover, fit: BoxFit.cover,
); );
break; break;
case FileType.VIDEO: case FileType.video:
return Container( return Container(
child: Icon(Icons.videocam), child: Icon(Icons.videocam),
color: Colors.black26, color: Colors.black26,
@@ -519,7 +519,7 @@ class _MessageInputState extends State<MessageInput> {
leading: Icon(Icons.image), leading: Icon(Icons.image),
title: Text('Upload a photo'), title: Text('Upload a photo'),
onTap: () { onTap: () {
_pickFile(FileType.IMAGE, false); _pickFile(FileType.image, false);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@@ -527,7 +527,7 @@ class _MessageInputState extends State<MessageInput> {
leading: Icon(Icons.video_library), leading: Icon(Icons.video_library),
title: Text('Upload a video'), title: Text('Upload a video'),
onTap: () { onTap: () {
_pickFile(FileType.VIDEO, false); _pickFile(FileType.video, false);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@@ -536,7 +536,7 @@ class _MessageInputState extends State<MessageInput> {
title: Text('Photo from camera'), title: Text('Photo from camera'),
onTap: () { onTap: () {
ImagePicker.pickImage(source: ImageSource.camera); ImagePicker.pickImage(source: ImageSource.camera);
_pickFile(FileType.IMAGE, true); _pickFile(FileType.image, true);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@@ -544,7 +544,7 @@ class _MessageInputState extends State<MessageInput> {
leading: Icon(Icons.videocam), leading: Icon(Icons.videocam),
title: Text('Video from camera'), title: Text('Video from camera'),
onTap: () { onTap: () {
_pickFile(FileType.VIDEO, true); _pickFile(FileType.video, true);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@@ -552,7 +552,7 @@ class _MessageInputState extends State<MessageInput> {
leading: Icon(Icons.insert_drive_file), leading: Icon(Icons.insert_drive_file),
title: Text('Upload a file'), title: Text('Upload a file'),
onTap: () { onTap: () {
_pickFile(FileType.ANY, false); _pickFile(FileType.any, false);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@@ -565,9 +565,9 @@ class _MessageInputState extends State<MessageInput> {
File file; File file;
if (camera) { if (camera) {
if (type == FileType.IMAGE) { if (type == FileType.image) {
file = await ImagePicker.pickImage(source: ImageSource.camera); file = await ImagePicker.pickImage(source: ImageSource.camera);
} else if (type == FileType.VIDEO) { } else if (type == FileType.video) {
file = await ImagePicker.pickVideo(source: ImageSource.camera); file = await ImagePicker.pickVideo(source: ImageSource.camera);
} }
} else { } else {
@@ -709,17 +709,17 @@ class _MessageInputState extends State<MessageInput> {
return attachments.map((attachment) { return attachments.map((attachment) {
String type; String type;
switch (attachment.type) { switch (attachment.type) {
case FileType.IMAGE: case FileType.image:
type = 'image'; type = 'image';
break; break;
case FileType.VIDEO: case FileType.video:
type = 'video'; type = 'video';
break; break;
default: default:
type = 'file'; type = 'file';
} }
return Attachment( return Attachment(
imageUrl: attachment.type == FileType.IMAGE ? attachment.url : null, imageUrl: attachment.type == FileType.image ? attachment.url : null,
assetUrl: attachment.url, assetUrl: attachment.url,
type: type, type: type,
localUri: attachment.file.uri, localUri: attachment.file.uri,
@@ -774,19 +774,19 @@ class _MessageInputState extends State<MessageInput> {
widget.editMessage.attachments.forEach((attachment) { widget.editMessage.attachments.forEach((attachment) {
if (attachment.type == 'image') { if (attachment.type == 'image') {
_attachments.add(_SendingAttachment( _attachments.add(_SendingAttachment(
type: FileType.IMAGE, type: FileType.image,
url: attachment.imageUrl, url: attachment.imageUrl,
uploaded: true, uploaded: true,
)); ));
} else if (attachment.type == 'video') { } else if (attachment.type == 'video') {
_attachments.add(_SendingAttachment( _attachments.add(_SendingAttachment(
type: FileType.VIDEO, type: FileType.video,
url: attachment.assetUrl, url: attachment.assetUrl,
uploaded: true, uploaded: true,
)); ));
} else if (attachment.type != 'giphy') { } else if (attachment.type != 'giphy') {
_attachments.add(_SendingAttachment( _attachments.add(_SendingAttachment(
type: FileType.ANY, type: FileType.any,
url: attachment.assetUrl, url: attachment.assetUrl,
uploaded: true, uploaded: true,
)); ));
+1 -1
View File
@@ -1,8 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_widgets/flutter_widgets.dart';
import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat/stream_chat.dart';
import 'package:visibility_detector/visibility_detector.dart';
import '../stream_chat_flutter.dart'; import '../stream_chat_flutter.dart';
import 'message_widget.dart'; import 'message_widget.dart';
+1 -1
View File
@@ -96,7 +96,7 @@ class _MessageWidgetState extends State<MessageWidget>
final alignment = final alignment =
_isMyMessage ? Alignment.centerRight : Alignment.centerLeft; _isMyMessage ? Alignment.centerRight : Alignment.centerLeft;
var row = List<Widget>.from([ var row = <Widget>[
Column( Column(
crossAxisAlignment: crossAxisAlignment:
_isMyMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start, _isMyMessage ? CrossAxisAlignment.end : CrossAxisAlignment.start,
+3 -3
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.1.10 version: 0.1.11
environment: environment:
sdk: ">=2.3.0 <3.0.0" sdk: ">=2.3.0 <3.0.0"
@@ -11,18 +11,18 @@ dependencies:
sdk: flutter sdk: flutter
photo_view: ^0.9.2 photo_view: ^0.9.2
rxdart: ^0.23.1 rxdart: ^0.23.1
flutter_widgets: ^0.1.11
jiffy: ^3.0.1 jiffy: ^3.0.1
cached_network_image: ^2.0.0 cached_network_image: ^2.0.0
flutter_markdown: ^0.3.4 flutter_markdown: ^0.3.4
url_launcher: ^5.4.2 url_launcher: ^5.4.2
video_player: ^0.10.8+1 video_player: ^0.10.8+1
chewie: ^0.9.10 chewie: ^0.9.10
file_picker: ^1.4.3+2 file_picker: ^1.5.0
image_picker: ^0.6.3+4 image_picker: ^0.6.3+4
keyboard_visibility: ^0.5.6 keyboard_visibility: ^0.5.6
stream_chat: stream_chat:
path: ../stream_chat_dart path: ../stream_chat_dart
visibility_detector: ^0.1.4
dev_dependencies: dev_dependencies:
pedantic: ^1.9.0 pedantic: ^1.9.0