Merge branch 'develop' into hotfix/messagePagination

This commit is contained in:
Salvatore Giordano
2022-05-16 15:53:18 +02:00
183 changed files with 666 additions and 762 deletions
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'
dependencies:
# The following adds the Cupertino Icons font to your application.
@@ -15,8 +15,8 @@ class BetterStreamBuilder<T extends Object> extends StatefulWidget {
this.noDataBuilder,
this.errorBuilder,
this.comparator,
Key? key,
}) : super(key: key);
super.key,
});
/// The stream to listen to
final Stream<T?>? stream;
@@ -64,7 +64,7 @@ More details here https://getstream.io/chat/docs/sdk/flutter/stream_chat_flutter
class ChannelListCore extends StatefulWidget {
/// Instantiate a new ChannelListView
const ChannelListCore({
Key? key,
super.key,
required this.errorBuilder,
required this.emptyBuilder,
required this.loadingBuilder,
@@ -78,7 +78,7 @@ class ChannelListCore extends StatefulWidget {
this.sort,
this.channelListController,
this.limit = 25,
}) : super(key: key);
});
/// A [ChannelListController] allows reloading and pagination.
/// Use [ChannelListController.loadData] and
@@ -23,12 +23,12 @@ class ChannelsBloc extends StatefulWidget {
/// Creates a new [ChannelsBloc]. The parameter [child] must be supplied and
/// not null.
const ChannelsBloc({
Key? key,
super.key,
required this.child,
this.lockChannelsOrder = false,
this.channelsComparator,
this.shouldAddChannel,
}) : super(key: key);
});
/// The widget child
final Widget child;
@@ -9,7 +9,7 @@ class LazyLoadScrollView extends StatefulWidget {
/// Creates a new instance of [LazyLoadScrollView]. The parameter [child]
/// must be supplied and not null.
const LazyLoadScrollView({
Key? key,
super.key,
required this.child,
this.onStartOfPage,
this.onEndOfPage,
@@ -17,7 +17,7 @@ class LazyLoadScrollView extends StatefulWidget {
this.onPageScrollEnd,
this.onInBetweenOfPage,
this.scrollOffset = 100,
}) : super(key: key);
});
/// The [Widget] that this widget watches for changes on
final Widget child;
@@ -70,7 +70,7 @@ bool Function(Message) defaultMessageFilter(String currentUserId) =>
class MessageListCore extends StatefulWidget {
/// Instantiate a new [MessageListView].
const MessageListCore({
Key? key,
super.key,
required this.loadingBuilder,
required this.emptyBuilder,
required this.messageListBuilder,
@@ -79,7 +79,7 @@ class MessageListCore extends StatefulWidget {
this.messageListController,
this.messageFilter,
this.paginationLimit = 20,
}) : super(key: key);
});
/// A [MessageListController] allows pagination.
/// Use [ChannelListController.paginateData] pagination.
@@ -17,9 +17,9 @@ import 'package:stream_chat_flutter_core/src/stream_controller_extension.dart';
class MessageSearchBloc extends StatefulWidget {
/// Instantiate a new MessageSearchBloc
const MessageSearchBloc({
Key? key,
super.key,
required this.child,
}) : super(key: key);
});
/// The widget child
final Widget child;
@@ -46,7 +46,7 @@ class MessageSearchListCore extends StatefulWidget {
/// * [loadingBuilder]
/// * [childBuilder]
MessageSearchListCore({
Key? key,
super.key,
required this.emptyBuilder,
required this.errorBuilder,
required this.loadingBuilder,
@@ -76,8 +76,7 @@ class MessageSearchListCore extends StatefulWidget {
sortOptions == null,
'Cannot specify `offset` with `sortOptions` parameter',
),
limit = limit ?? paginationParams?.limit ?? 30,
super(key: key);
limit = limit ?? paginationParams?.limit ?? 30;
/// A [MessageSearchListController] allows reloading and pagination.
/// Use [MessageSearchListController.loadData] and
@@ -10,15 +10,15 @@ typedef TextStyleBuilder = TextStyle? Function(
class MessageTextFieldController extends TextEditingController {
/// Returns a new MessageTextFieldController
MessageTextFieldController({
String? text,
super.text,
this.textPatternStyle,
}) : super(text: text);
});
/// Returns a new MessageTextFieldController with the given text [value].
MessageTextFieldController.fromValue(
TextEditingValue? value, {
super.value, {
this.textPatternStyle,
}) : super.fromValue(value);
}) : super.fromValue();
/// A map of style to apply to the text matching the RegExp patterns.
final Map<RegExp, TextStyleBuilder>? textPatternStyle;
@@ -26,7 +26,7 @@ typedef PagedValueScrollViewLoadMoreErrorBuilder = Widget Function(
class PagedValueListView<K, V> extends StatefulWidget {
/// Creates a new instance of [PagedValueListView] widget.
const PagedValueListView({
Key? key,
super.key,
required this.controller,
required this.itemBuilder,
required this.separatorBuilder,
@@ -51,7 +51,7 @@ class PagedValueListView<K, V> extends StatefulWidget {
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.restorationId,
this.clipBehavior = Clip.hardEdge,
}) : super(key: key);
});
/// The [PagedValueNotifier] used to control the list of items.
final PagedValueNotifier<K, V> controller;
@@ -357,7 +357,7 @@ class _PagedValueListViewState<K, V> extends State<PagedValueListView<K, V>> {
class PagedValueGridView<K, V> extends StatefulWidget {
/// Creates a new instance of [PagedValueGridView] widget.
const PagedValueGridView({
Key? key,
super.key,
required this.controller,
required this.gridDelegate,
required this.itemBuilder,
@@ -383,7 +383,7 @@ class PagedValueGridView<K, V> extends StatefulWidget {
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.restorationId,
this.clipBehavior = Clip.hardEdge,
}) : super(key: key);
});
/// The [PagedValueNotifier] used to control the list of items.
final PagedValueNotifier<K, V> controller;
@@ -22,12 +22,12 @@ class StreamChannel extends StatefulWidget {
/// Creates a new instance of [StreamChannel]. Both [child] and [client] must
/// be supplied and not null.
const StreamChannel({
Key? key,
super.key,
required this.child,
required this.channel,
this.showLoading = true,
this.initialMessageId,
}) : super(key: key);
});
/// The child of the widget
final Widget child;
@@ -55,7 +55,7 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
/// Creates a [StreamChannelListController] from the passed [value].
StreamChannelListController.fromValue(
PagedValue<int, Channel> value, {
super.value, {
required this.client,
StreamChannelListEventHandler? eventHandler,
this.filter,
@@ -64,8 +64,7 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
this.limit = defaultChannelPagedLimit,
this.messageLimit,
this.memberLimit,
}) : _eventHandler = eventHandler ?? StreamChannelListEventHandler(),
super(value);
}) : _eventHandler = eventHandler ?? StreamChannelListEventHandler();
/// The client to use for the channels list.
final StreamChatClient client;
@@ -38,13 +38,13 @@ class StreamChatCore extends StatefulWidget {
/// [StreamChatCore] is a stateful widget which reacts to system events and
/// updates Stream's connection status accordingly.
const StreamChatCore({
Key? key,
super.key,
required this.client,
required this.child,
this.onBackgroundEventReceived,
this.backgroundKeepAlive = const Duration(minutes: 1),
this.connectivityStream,
}) : super(key: key);
});
/// Instance of Stream Chat Client containing information about the current
/// application.
@@ -52,7 +52,7 @@ class StreamMessageInputController extends ValueNotifier<Message> {
Map<RegExp, TextStyleBuilder>? textPatternStyle,
}) : _textEditingController = MessageTextFieldController.fromValue(
initialMessage.text == null
? const TextEditingValue()
? TextEditingValue.empty
: TextEditingValue(
text: initialMessage.text!,
composing: TextRange.collapsed(initialMessage.text!.length),
@@ -52,7 +52,7 @@ class StreamMessageSearchListController
/// Creates a [StreamUserListController] from the passed [value].
StreamMessageSearchListController.fromValue(
PagedValue<String, GetMessageResponse> value, {
super.value, {
required this.client,
required this.filter,
this.messageFilter,
@@ -70,8 +70,7 @@ class StreamMessageSearchListController
_activeFilter = filter,
_activeMessageFilter = messageFilter,
_activeSearchQuery = searchQuery,
_activeSort = sort,
super(value);
_activeSort = sort;
/// The client to use for the channels list.
final StreamChatClient client;
@@ -40,15 +40,14 @@ class StreamUserListController extends PagedValueNotifier<int, User> {
/// Creates a [StreamUserListController] from the passed [value].
StreamUserListController.fromValue(
PagedValue<int, User> value, {
super.value, {
required this.client,
this.filter,
this.sort,
this.presence = true,
this.limit = defaultUserPagedLimit,
}) : _activeFilter = filter,
_activeSort = sort,
super(value);
_activeSort = sort;
/// The client to use for the channels list.
final StreamChatClient client;
@@ -67,14 +67,14 @@ class UserListCore extends StatefulWidget {
required this.emptyBuilder,
required this.loadingBuilder,
required this.listBuilder,
Key? key,
super.key,
this.filter = const Filter.empty(),
this.sort,
this.presence,
this.groupAlphabetically = false,
this.userListController,
this.limit = 30,
}) : super(key: key);
});
/// A [UserListController] allows reloading and pagination.
/// Use [UserListController.loadData] and [UserListController.paginateData]
@@ -170,11 +170,11 @@ class UserListCoreState extends State<UserListCore>
for (final key in groupedUsers.keys) {
items
..add(ListHeaderItem(key))
..addAll(groupedUsers[key]!.map((e) => ListUserItem(e)));
..addAll(groupedUsers[key]!.map(ListUserItem.new));
}
return items;
}
return users.map((e) => ListUserItem(e)).toList();
return users.map(ListUserItem.new).toList();
},
);
@@ -17,8 +17,8 @@ class UsersBloc extends StatefulWidget {
/// not null.
const UsersBloc({
required this.child,
Key? key,
}) : super(key: key);
super.key,
});
/// The widget child
final Widget child;
@@ -6,7 +6,7 @@ repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'
flutter: ">=1.17.0"
dependencies:
@@ -14,7 +14,7 @@ dependencies:
connectivity_plus: ^2.1.0
flutter:
sdk: flutter
freezed_annotation: ^1.0.0
freezed_annotation: ^2.0.3
meta: ^1.3.0
rxdart: ^0.27.0
stream_chat: ^4.1.0
@@ -25,6 +25,6 @@ dev_dependencies:
fake_async: ^1.2.0
flutter_test:
sdk: flutter
freezed: ^1.0.0
freezed: ^2.0.3
mocktail: ^0.3.0
@@ -265,7 +265,7 @@ void main() {
.map((e) => Container(
key: Key(e.key ?? ''),
child: e.when(
headerItem: (heading) => Text(heading),
headerItem: Text.new,
userItem: (user) => Text(user.id),
),
))
@@ -333,7 +333,7 @@ void main() {
.map((e) => Container(
key: Key(e.key ?? ''),
child: e.when(
headerItem: (heading) => Text(heading),
headerItem: Text.new,
userItem: (user) => Text(user.id),
),
))
@@ -438,7 +438,7 @@ void main() {
.map((e) => Container(
key: Key(e.key ?? ''),
child: e.when(
headerItem: (heading) => Text(heading),
headerItem: Text.new,
userItem: (user) => Text(user.id),
),
))