fix analysis and update examples

This commit is contained in:
Salvatore Giordano
2022-02-01 10:52:59 +01:00
parent d959131bbd
commit f53ee0b4f1
15 changed files with 223 additions and 164 deletions
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:math';
import 'package:stream_chat/stream_chat.dart' hide Success;
import 'package:stream_chat_flutter/src/paged_value_notifier.dart';
@@ -7,6 +8,8 @@ import 'package:stream_chat_flutter/src/v4/channel_list_view/stream_channel_list
/// The default channel page limit to load.
const defaultChannelPagedLimit = 10;
const _kDefaultBackendPaginationLimit = 30;
/// A controller for a Channel list.
///
/// This class lets you perform tasks such as:
@@ -102,7 +105,10 @@ class StreamChannelListController extends PagedValueNotifier<int, Channel> {
@override
Future<void> doInitialLoad() async {
final limit = this.limit * defaultInitialPagedLimitMultiplier;
final limit = min(
this.limit * defaultInitialPagedLimitMultiplier,
_kDefaultBackendPaginationLimit,
);
try {
await for (final channels in client.queryChannels(
filter: filter,
@@ -146,8 +146,8 @@ class StreamChannelListEventHandler {
/// Function which gets called for the event
/// [EventType.notificationMessageNew].
///
/// This event is fired when a new message is created in a channel which we are
/// not currently watching.
/// This event is fired when a new message is created in a channel
/// which we are not currently watching.
///
/// By default, this adds the channel and moves it to the top of list.
void onNotificationMessageNew(
@@ -68,7 +68,8 @@ class StreamChannelListTile extends StatelessWidget {
/// {@template flutter.material.ListTile.tileColor}
/// Defines the background color of `ListTile`.
///
/// When the value is null, the `tileColor` is set to [ListTileTheme.tileColor]
/// When the value is null,
/// the `tileColor` is set to [ListTileTheme.tileColor]
/// if it's not null and to [Colors.transparent] if it's null.
/// {@endtemplate}
final Color? tileColor;
@@ -143,9 +143,9 @@ class StreamChannelListView extends StatefulWidget {
/// only scroll the view if it has sufficient content. See [physics].
///
/// Also when true, the scroll view is used for default [ScrollAction]s. If a
/// ScrollAction is not handled by an otherwise focused part of the application,
/// the ScrollAction will be evaluated using this scroll view, for example,
/// when executing [Shortcuts] key events like page up and down.
/// ScrollAction is not handled by an otherwise focused part of the
/// application, the ScrollAction will be evaluated using this scroll view,
/// for example, when executing [Shortcuts] key events like page up and down.
///
/// On iOS, this also identifies the scroll view that will scroll to top in
/// response to a tap in the status bar.
@@ -229,8 +229,9 @@ const _kDefaultChannelInfoBottomSheetShape = RoundedRectangleBorder(
/// The [transitionAnimationController] controls the bottom sheet's entrance and
/// exit animations if provided.
///
/// The optional `routeSettings` parameter sets the [RouteSettings] of the modal bottom sheet
/// sheet. This is particularly useful in the case that a user wants to observe
/// The optional `routeSettings` parameter sets the [RouteSettings]
/// of the modal bottom sheet sheet.
/// This is particularly useful in the case that a user wants to observe
/// [PopupRoute]s within a [NavigatorObserver].
///
/// Returns a `Future` that resolves to the value (if any) that was passed to