Merge branch 'master' into shadowBan

This commit is contained in:
Salvatore Giordano
2020-12-23 12:28:03 +01:00
5 changed files with 82 additions and 40 deletions
+11 -1
View File
@@ -1,7 +1,17 @@
## 0.2.18 ## 0.2.20
- Implement shadowban - Implement shadowban
## 0.2.19
- Updated llc dependency
- Added loading builder in channellistview
- Added sendButtonLocation and animationduration to messageinput
## 0.2.18
- Updated llc dependency
## 0.2.17+2 ## 0.2.17+2
- Expose ChannelsBloc.channelsComparator to sort channels on message.new event - Expose ChannelsBloc.channelsComparator to sort channels on message.new event
+12 -3
View File
@@ -65,6 +65,7 @@ class ChannelListView extends StatefulWidget {
this.errorBuilder, this.errorBuilder,
this.emptyBuilder, this.emptyBuilder,
this.onImageTap, this.onImageTap,
this.loadingBuilder,
this.pullToRefresh = true, this.pullToRefresh = true,
}) : super(key: key); }) : super(key: key);
@@ -79,6 +80,9 @@ class ChannelListView extends StatefulWidget {
/// You can also filter other built-in channel fields. /// You can also filter other built-in channel fields.
final Map<String, dynamic> filter; final Map<String, dynamic> filter;
/// The builder used while loading.
final WidgetBuilder loadingBuilder;
/// Query channels options. /// Query channels options.
/// ///
/// state: if true returns the Channel state /// state: if true returns the Channel state
@@ -224,9 +228,11 @@ class _ChannelListViewState extends State<ChannelListView>
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: viewportConstraints.maxHeight, minHeight: viewportConstraints.maxHeight,
), ),
child: Center( child: widget.loadingBuilder != null
child: CircularProgressIndicator(), ? widget.loadingBuilder(context)
), : Center(
child: CircularProgressIndicator(),
),
), ),
); );
}, },
@@ -339,6 +345,9 @@ class _ChannelListViewState extends State<ChannelListView>
), ),
); );
} else { } else {
if (widget.loadingBuilder != null) {
return widget.loadingBuilder(context);
}
return _buildQueryProgressIndicator(context, channelsProvider); return _buildQueryProgressIndicator(context, channelsProvider);
} }
} }
+12 -17
View File
@@ -89,29 +89,24 @@ class ChannelsBlocState extends State<ChannelsBloc>
paginationParams.offset == null || paginationParams.offset == null ||
paginationParams.offset == 0; paginationParams.offset == 0;
final oldChannels = List<Channel>.from(channels ?? []); final oldChannels = List<Channel>.from(channels ?? []);
client final _channels = await client.queryChannels(
.queryChannels(
filter: filter, filter: filter,
sort: sortOptions, sort: sortOptions,
options: options, options: options,
paginationParams: paginationParams, paginationParams: paginationParams,
onlyOffline: onlyOffline, onlyOffline: onlyOffline,
) );
.listen((channels) {
if (clear) { if (clear) {
_channelsController.add(channels); _channelsController.add(_channels);
} else { } else {
final l = oldChannels + channels; final l = oldChannels + _channels;
_channelsController.add(l); _channelsController.add(l);
} }
}, onDone: () { _queryChannelsLoadingController.sink.add(false);
_queryChannelsLoadingController.sink.add(false);
}, onError: (err, stackTrace) {
print(err);
print(stackTrace);
_queryChannelsLoadingController.addError(err, stackTrace);
});
} catch (err, stackTrace) { } catch (err, stackTrace) {
print(err);
print(stackTrace);
_queryChannelsLoadingController.addError(err, stackTrace); _queryChannelsLoadingController.addError(err, stackTrace);
} }
} }
+45 -17
View File
@@ -27,6 +27,11 @@ enum ActionsLocation {
right, right,
} }
enum SendButtonLocation {
inside,
outside,
}
enum DefaultAttachmentTypes { enum DefaultAttachmentTypes {
image, image,
video, video,
@@ -96,6 +101,8 @@ class MessageInput extends StatefulWidget {
this.inputTextStyle, this.inputTextStyle,
this.attachmentIconColor, this.attachmentIconColor,
this.autofocus = false, this.autofocus = false,
this.sendButtonLocation = SendButtonLocation.inside,
this.animationDuration = const Duration(milliseconds: 300),
}) : super(key: key); }) : super(key: key);
/// Message to edit /// Message to edit
@@ -141,6 +148,9 @@ class MessageInput extends StatefulWidget {
/// The location of the custom actions /// The location of the custom actions
final ActionsLocation actionsLocation; final ActionsLocation actionsLocation;
/// The location of the send button
final SendButtonLocation sendButtonLocation;
/// Map that defines a thumbnail builder for an attachment type /// Map that defines a thumbnail builder for an attachment type
final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilders; final Map<String, AttachmentThumbnailBuilder> attachmentThumbnailBuilders;
@@ -148,6 +158,9 @@ class MessageInput extends StatefulWidget {
/// `Theme.of(context).textTheme.bodyText2`. /// `Theme.of(context).textTheme.bodyText2`.
final TextStyle inputTextStyle; final TextStyle inputTextStyle;
/// The duration of the send button animation
final Duration animationDuration;
/// Color used for attachment icon. /// Color used for attachment icon.
final Color attachmentIconColor; final Color attachmentIconColor;
@@ -194,17 +207,26 @@ class MessageInputState extends State<MessageInput> {
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Stack( child: Row(
clipBehavior: Clip.none, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: [
_buildBorder(context), Expanded(
Column( child: Stack(
crossAxisAlignment: CrossAxisAlignment.start, clipBehavior: Clip.none,
children: [ children: <Widget>[
_buildAttachments(), _buildBorder(context),
_buildTextField(context), Column(
], crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildAttachments(),
_buildTextField(context),
],
),
],
),
), ),
if (widget.sendButtonLocation == SendButtonLocation.outside)
_animateSendButton(context),
], ],
), ),
), ),
@@ -221,14 +243,18 @@ class MessageInputState extends State<MessageInput> {
if (widget.actionsLocation == ActionsLocation.left) if (widget.actionsLocation == ActionsLocation.left)
...widget.actions ?? [], ...widget.actions ?? [],
_buildTextInput(context), _buildTextInput(context),
_animateSendButton(context),
if (widget.actionsLocation == ActionsLocation.right) if (widget.actionsLocation == ActionsLocation.right)
...widget.actions ?? [], ...widget.actions ?? [],
if (widget.sendButtonLocation == SendButtonLocation.inside)
_animateSendButton(context),
], ],
); );
} }
AnimatedCrossFade _animateSendButton(BuildContext context) { Widget _animateSendButton(BuildContext context) {
if (widget.animationDuration == Duration.zero) {
return _buildSendButton(context);
}
return AnimatedCrossFade( return AnimatedCrossFade(
crossFadeState: ((_messageIsPresent || _attachments.isNotEmpty) && crossFadeState: ((_messageIsPresent || _attachments.isNotEmpty) &&
_attachments.every((a) => a.uploaded == true)) _attachments.every((a) => a.uploaded == true))
@@ -236,7 +262,7 @@ class MessageInputState extends State<MessageInput> {
: CrossFadeState.showSecond, : CrossFadeState.showSecond,
firstChild: _buildSendButton(context), firstChild: _buildSendButton(context),
secondChild: SizedBox(), secondChild: SizedBox(),
duration: Duration(milliseconds: 300), duration: widget.animationDuration,
alignment: Alignment.center, alignment: Alignment.center,
); );
} }
@@ -851,12 +877,14 @@ class MessageInputState extends State<MessageInput> {
color: Colors.transparent, color: Colors.transparent,
child: IconButton( child: IconButton(
key: Key('sendButton'), key: Key('sendButton'),
onPressed: () { onPressed: (textEditingController.text.trim().isEmpty &&
sendMessage(); _attachments.isEmpty)
}, ? null
: () {
sendMessage();
},
icon: Icon( icon: Icon(
Icons.send, Icons.send,
color: StreamChatTheme.of(context).accentColor,
), ),
), ),
), ),
+2 -2
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.18 version: 0.2.20
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
@@ -23,7 +23,7 @@ dependencies:
file_picker: ^2.0.12 file_picker: ^2.0.12
image_picker: ^0.6.7+2 image_picker: ^0.6.7+2
flutter_keyboard_visibility: ^4.0.1 flutter_keyboard_visibility: ^4.0.1
stream_chat: ^0.2.19 stream_chat: ^0.2.21
mime: ^0.9.6+3 mime: ^0.9.6+3
visibility_detector: ^0.1.5 visibility_detector: ^0.1.5
http_parser: ^3.1.4 http_parser: ^3.1.4