Merge remote-tracking branch 'origin/develop' into feat/localization

# Conflicts:
#	packages/stream_chat_flutter/lib/src/message_list_view.dart
#	packages/stream_chat_flutter/lib/src/message_search_list_view.dart
This commit is contained in:
xsahil03x
2021-07-21 17:54:32 +05:30
7 changed files with 316 additions and 278 deletions
+1
View File
@@ -19,6 +19,7 @@ jobs:
persistence persistence
core core
ui ui
doc
repo repo
localization localization
requireScope: true requireScope: true
@@ -289,6 +289,7 @@ class ChannelApi {
) async { ) async {
final response = await _client.post( final response = await _client.post(
'${_getChannelUrl(channelId, channelType)}/stop-watching', '${_getChannelUrl(channelId, channelType)}/stop-watching',
data: {},
); );
return EmptyResponse.fromJson(response.data); return EmptyResponse.fromJson(response.data);
} }
@@ -595,14 +595,14 @@ void main() {
final path = '${_getChannelUrl(channelId, channelType)}/stop-watching'; final path = '${_getChannelUrl(channelId, channelType)}/stop-watching';
when(() => client.post(path)).thenAnswer( when(() => client.post(path, data: {})).thenAnswer(
(_) async => successResponse(path, data: <String, dynamic>{})); (_) async => successResponse(path, data: <String, dynamic>{}));
final res = await channelApi.stopWatching(channelId, channelType); final res = await channelApi.stopWatching(channelId, channelType);
expect(res, isNotNull); expect(res, isNotNull);
verify(() => client.post(path)).called(1); verify(() => client.post(path, data: {})).called(1);
verifyNoMoreInteractions(client); verifyNoMoreInteractions(client);
}); });
} }
@@ -232,13 +232,21 @@ class _ChannelListViewState extends State<ChannelListView> {
); );
} }
return ColoredBox( child = LazyLoadScrollView(
color: ChannelListViewTheme.of(context).backgroundColor!,
child: LazyLoadScrollView(
onEndOfPage: () => _channelListController.paginateData!(), onEndOfPage: () => _channelListController.paginateData!(),
child: child, child: child,
),
); );
final backgroundColor = ChannelListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
} }
Widget _buildListView(BuildContext context, List<Channel> channels) { Widget _buildListView(BuildContext context, List<Channel> channels) {
@@ -387,9 +387,7 @@ class _MessageListViewState extends State<MessageListView> {
1 // parent message 1 // parent message
; ;
return ColoredBox( final child = Stack(
color: MessageListViewTheme.of(context).backgroundColor!,
child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ConnectionStatusBuilder( ConnectionStatusBuilder(
@@ -561,8 +559,7 @@ class _MessageListViewState extends State<MessageListView> {
const Offstage(); const Offstage();
} }
const bottomMessageIndex = const bottomMessageIndex = 2; // 1 -> loader // 0 -> footer
2; // 1 -> loader // 0 -> footer
final message = messages[i - 2]; final message = messages[i - 2];
Widget messageWidget; Widget messageWidget;
@@ -589,8 +586,18 @@ class _MessageListViewState extends State<MessageListView> {
if (widget.showFloatingDateDivider) if (widget.showFloatingDateDivider)
_buildFloatingDateDivider(itemCount), _buildFloatingDateDivider(itemCount),
], ],
),
); );
final backgroundColor = MessageListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: child,
);
}
return child;
} }
Widget _buildThreadSeparator() { Widget _buildThreadSeparator() {
@@ -146,9 +146,8 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
widget.messageSearchListController ?? _defaultController; widget.messageSearchListController ?? _defaultController;
@override @override
Widget build(BuildContext context) => ColoredBox( Widget build(BuildContext context) {
color: MessageSearchListViewTheme.of(context).backgroundColor!, final messageSearchListCore = MessageSearchListCore(
child: MessageSearchListCore(
filters: widget.filters, filters: widget.filters,
sortOptions: widget.sortOptions, sortOptions: widget.sortOptions,
messageQuery: widget.messageQuery, messageQuery: widget.messageQuery,
@@ -199,9 +198,21 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
), ),
), ),
childBuilder: widget.childBuilder ?? _buildListView, childBuilder: widget.childBuilder ?? _buildListView,
),
); );
final backgroundColor =
MessageSearchListViewTheme.of(context).backgroundColor;
if (backgroundColor != null) {
return ColoredBox(
color: backgroundColor,
child: messageSearchListCore,
);
}
return messageSearchListCore;
}
Widget _separatorBuilder(BuildContext context, int index) => Container( Widget _separatorBuilder(BuildContext context, int index) => Container(
height: 1, height: 1,
color: StreamChatTheme.of(context).colorTheme.borders, color: StreamChatTheme.of(context).colorTheme.borders,
@@ -162,9 +162,7 @@ class _UserListViewState extends State<UserListView>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final child = ColoredBox( final userListCore = UserListCore(
color: UserListViewTheme.of(context).backgroundColor!,
child: UserListCore(
errorBuilder: widget.errorBuilder ?? errorBuilder: widget.errorBuilder ??
(BuildContext context, Object err) => _buildError(err), (BuildContext context, Object err) => _buildError(err),
emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(), emptyBuilder: widget.emptyBuilder ?? (context) => _buildEmpty(),
@@ -191,9 +189,21 @@ class _UserListViewState extends State<UserListView>
presence: widget.presence, presence: widget.presence,
groupAlphabetically: widget.groupAlphabetically, groupAlphabetically: widget.groupAlphabetically,
userListController: _userListController, userListController: _userListController,
),
); );
final backgroundColor = UserListViewTheme.of(context).backgroundColor;
Widget child;
if (backgroundColor != null) {
child = ColoredBox(
color: backgroundColor,
child: userListCore,
);
} else {
child = userListCore;
}
if (!widget.pullToRefresh) { if (!widget.pullToRefresh) {
return child; return child;
} else { } else {