fix: analysis issues

This commit is contained in:
Deven Joshi
2021-01-26 21:37:20 +05:30
parent 27ee546eb0
commit 29837e23f5
7 changed files with 43 additions and 1 deletions
@@ -4,6 +4,7 @@ void main() {
runApp(MyApp()); runApp(MyApp());
} }
// ignore: public_member_api_docs
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
@@ -31,7 +32,9 @@ class MyApp extends StatelessWidget {
} }
} }
// ignore: public_member_api_docs
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
// ignore: public_member_api_docs
MyHomePage({Key key, this.title}) : super(key: key); MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning // This widget is the home page of your application. It is stateful, meaning
@@ -43,6 +46,7 @@ class MyHomePage extends StatefulWidget {
// used by the build method of the State. Fields in a Widget subclass are // used by the build method of the State. Fields in a Widget subclass are
// always marked "final". // always marked "final".
// ignore: public_member_api_docs
final String title; final String title;
@override @override
@@ -261,6 +261,9 @@ class _ChannelListCoreState extends State<ChannelListCore>
/// Controller used for paginating data in [ChannelListCore] /// Controller used for paginating data in [ChannelListCore]
class ChannelListController { class ChannelListController {
/// Call this function to reload data
VoidCallback loadData; VoidCallback loadData;
/// Call this function to load further data
VoidCallback paginateData; VoidCallback paginateData;
} }
@@ -68,6 +68,7 @@ class MessageListCore extends StatefulWidget {
/// Use [ChannelListController.paginateData] pagination. /// Use [ChannelListController.paginateData] pagination.
final MessageListController messageListController; final MessageListController messageListController;
/// Function called when messages are fetched
final Widget Function(BuildContext, List<Message>) messageListBuilder; final Widget Function(BuildContext, List<Message>) messageListBuilder;
/// Function used to build a loading widget /// Function used to build a loading widget
@@ -168,5 +169,6 @@ class _MessageListCoreState extends State<MessageListCore> {
/// Controller used for paginating data in [ChannelListView] /// Controller used for paginating data in [ChannelListView]
class MessageListController { class MessageListController {
/// Call this function to load further data
Function({QueryDirection direction}) paginateData; Function({QueryDirection direction}) paginateData;
} }
@@ -196,6 +196,9 @@ class _MessageSearchListCoreState extends State<MessageSearchListCore> {
/// Controller used for paginating data in [ChannelListView] /// Controller used for paginating data in [ChannelListView]
class MessageSearchListController { class MessageSearchListController {
/// Call this function to reload data
VoidCallback loadData; VoidCallback loadData;
/// Call this function to load further data
VoidCallback paginateData; VoidCallback paginateData;
} }
@@ -4,12 +4,20 @@ import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat/stream_chat.dart';
enum QueryDirection { top, bottom } /// Specifies query direction for pagination
enum QueryDirection {
/// Query earlier messages
top,
/// Query later messages
bottom,
}
/// Widget used to provide information about the channel to the widget tree /// Widget used to provide information about the channel to the widget tree
/// ///
/// Use [StreamChannel.of] to get the current [StreamChannelState] instance. /// Use [StreamChannel.of] to get the current [StreamChannelState] instance.
class StreamChannel extends StatefulWidget { class StreamChannel extends StatefulWidget {
// ignore: public_member_api_docs
const StreamChannel({ const StreamChannel({
Key key, Key key,
@required this.child, @required this.child,
@@ -20,8 +28,13 @@ class StreamChannel extends StatefulWidget {
assert(channel != null), assert(channel != null),
super(key: key); super(key: key);
// ignore: public_member_api_docs
final Widget child; final Widget child;
/// [channel] specifies the channel with which child should be wrapped
final Channel channel; final Channel channel;
/// Shows a loading indicator
final bool showLoading; final bool showLoading;
/// If passed the channel will load from this particular message. /// If passed the channel will load from this particular message.
@@ -45,6 +58,7 @@ class StreamChannel extends StatefulWidget {
StreamChannelState createState() => StreamChannelState(); StreamChannelState createState() => StreamChannelState();
} }
// ignore: public_member_api_docs
class StreamChannelState extends State<StreamChannel> { class StreamChannelState extends State<StreamChannel> {
/// Current channel /// Current channel
Channel get channel => widget.channel; Channel get channel => widget.channel;
@@ -26,9 +26,12 @@ import 'package:stream_chat/stream_chat.dart';
/// ///
/// Use [StreamChatCore.of] to get the current [StreamChatCoreState] instance. /// Use [StreamChatCore.of] to get the current [StreamChatCoreState] instance.
class StreamChatCore extends StatefulWidget { class StreamChatCore extends StatefulWidget {
// ignore: public_member_api_docs
final Client client; final Client client;
// ignore: public_member_api_docs
final Widget child; final Widget child;
// ignore: public_member_api_docs
StreamChatCore({ StreamChatCore({
Key key, Key key,
@required this.client, @required this.client,
@@ -58,6 +61,7 @@ class StreamChatCore extends StatefulWidget {
/// The current state of the StreamChat widget /// The current state of the StreamChat widget
class StreamChatCoreState extends State<StreamChatCore> class StreamChatCoreState extends State<StreamChatCore>
with WidgetsBindingObserver { with WidgetsBindingObserver {
// ignore: public_member_api_docs
Client get client => widget.client; Client get client => widget.client;
Timer _disconnectTimer; Timer _disconnectTimer;
@@ -249,7 +249,9 @@ class _UserListCoreState extends State<UserListCore>
} }
} }
// ignore: public_member_api_docs
abstract class ListItem { abstract class ListItem {
// ignore: public_member_api_docs
String get key { String get key {
if (this is ListHeaderItem) { if (this is ListHeaderItem) {
final header = (this as ListHeaderItem).heading; final header = (this as ListHeaderItem).heading;
@@ -262,6 +264,7 @@ abstract class ListItem {
return null; return null;
} }
// ignore: public_member_api_docs
Widget when({ Widget when({
@required Widget Function(String heading) headerItem, @required Widget Function(String heading) headerItem,
@required Widget Function(User user) userItem, @required Widget Function(User user) userItem,
@@ -276,20 +279,29 @@ abstract class ListItem {
} }
} }
// ignore: public_member_api_docs
class ListHeaderItem extends ListItem { class ListHeaderItem extends ListItem {
// ignore: public_member_api_docs
final String heading; final String heading;
// ignore: public_member_api_docs
ListHeaderItem(this.heading); ListHeaderItem(this.heading);
} }
// ignore: public_member_api_docs
class ListUserItem extends ListItem { class ListUserItem extends ListItem {
// ignore: public_member_api_docs
final User user; final User user;
// ignore: public_member_api_docs
ListUserItem(this.user); ListUserItem(this.user);
} }
/// Controller used for paginating data in [ChannelListView] /// Controller used for paginating data in [ChannelListView]
class UserListController { class UserListController {
/// Call this function to reload data
VoidCallback loadData; VoidCallback loadData;
/// Call this function to load further data
VoidCallback paginateData; VoidCallback paginateData;
} }