From 88ec33d798dfe3892d2c237f6e9c19643964af42 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Thu, 9 Apr 2020 18:01:44 +0200 Subject: [PATCH] add docs --- analysis_options.yaml | 2 +- example/lib/main.dart | 2 +- lib/src/channel_image.dart | 1 + lib/src/channel_list_view.dart | 2 ++ lib/src/channel_name.dart | 1 + lib/src/channel_preview.dart | 1 + lib/src/channels_bloc.dart | 5 +++++ lib/src/full_screen_image.dart | 3 +++ lib/src/message_input.dart | 15 ++++++++------- lib/src/message_list_view.dart | 1 + lib/src/message_widget.dart | 1 + lib/src/reaction_picker.dart | 2 ++ lib/src/stream_channel.dart | 1 + lib/src/stream_chat.dart | 1 + lib/src/thread_header.dart | 1 + lib/src/typing_indicator.dart | 1 + 16 files changed, 31 insertions(+), 9 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index fedac90d..7feb4342 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -44,7 +44,7 @@ linter: - package_prefixed_library_names - prefer_is_not_empty # - prefer_mixin # https://github.com/dart-lang/language/issues/32 -# - public_member_api_docs + - public_member_api_docs - slash_for_doc_comments # - sort_constructors_first # - sort_unnamed_constructors_first diff --git a/example/lib/main.dart b/example/lib/main.dart index 0fed4c63..75e2388d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -23,7 +23,7 @@ Future _handleAndroidNotification( body: notificationData.message.text, ); - await NotificationService.sendNotification(androidNotificationOptions); + await NotificationService.showNotification(androidNotificationOptions); } void main() async { diff --git a/lib/src/channel_image.dart b/lib/src/channel_image.dart index 8f624bf0..7c07bf3e 100644 --- a/lib/src/channel_image.dart +++ b/lib/src/channel_image.dart @@ -43,6 +43,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; /// The widget renders the ui based on the first ancestor of type [StreamChatTheme]. /// Modify it to change the widget appearance. class ChannelImage extends StatelessWidget { + /// Instantiate a new ChannelImage const ChannelImage({ Key key, this.channel, diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index f9cdc278..9bcccdd5 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -47,6 +47,7 @@ typedef ChannelPreviewBuilder = Widget Function(BuildContext, Channel); /// The widget components render the ui based on the first ancestor of type [StreamChatTheme]. /// Modify it to change the widget appearance. class ChannelListView extends StatefulWidget { + /// Instantiate a new ChannelListView ChannelListView({ Key key, this.filter, @@ -59,6 +60,7 @@ class ChannelListView extends StatefulWidget { this.errorBuilder, }) : super(key: key); + /// The builder that will be used in case of error final Widget Function(Error error) errorBuilder; /// The query filters to use. diff --git a/lib/src/channel_name.dart b/lib/src/channel_name.dart index f2f27244..45193001 100644 --- a/lib/src/channel_name.dart +++ b/lib/src/channel_name.dart @@ -7,6 +7,7 @@ import 'stream_channel.dart'; /// /// The widget uses a [StreamBuilder] to render the channel information image as soon as it updates. class ChannelName extends StatelessWidget { + /// Instantiate a new ChannelName const ChannelName({ Key key, this.channel, diff --git a/lib/src/channel_preview.dart b/lib/src/channel_preview.dart index 0723f338..c4377ebc 100644 --- a/lib/src/channel_preview.dart +++ b/lib/src/channel_preview.dart @@ -25,6 +25,7 @@ class ChannelPreview extends StatelessWidget { /// Channel displayed final Channel channel; + /// Instantiate a new ChannelPreview ChannelPreview({ @required this.channel, Key key, diff --git a/lib/src/channels_bloc.dart b/lib/src/channels_bloc.dart index b7dec76d..7337c24c 100644 --- a/lib/src/channels_bloc.dart +++ b/lib/src/channels_bloc.dart @@ -5,9 +5,12 @@ import 'package:rxdart/rxdart.dart'; import 'package:stream_chat/stream_chat.dart'; import 'package:stream_chat_flutter/src/stream_chat.dart'; +/// Widget dedicated to the management of a channel list with pagination class ChannelsBloc extends StatefulWidget { + /// The widget child final Widget child; + /// Instantiate a new ChannelsBloc const ChannelsBloc({ Key key, this.child, @@ -16,6 +19,7 @@ class ChannelsBloc extends StatefulWidget { @override ChannelsBlocState createState() => ChannelsBlocState(); + /// Use this method to get the current [ChannelsBlocState] instance static ChannelsBlocState of(BuildContext context) { ChannelsBlocState streamChatState; @@ -29,6 +33,7 @@ class ChannelsBloc extends StatefulWidget { } } +/// The current state of the [ChannelsBloc] class ChannelsBlocState extends State with AutomaticKeepAliveClientMixin { @override diff --git a/lib/src/full_screen_image.dart b/lib/src/full_screen_image.dart index 37413322..c6f5804f 100644 --- a/lib/src/full_screen_image.dart +++ b/lib/src/full_screen_image.dart @@ -2,9 +2,12 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:photo_view/photo_view.dart'; +/// A full screen image widget class FullScreenImage extends StatelessWidget { + /// The url of the image final String url; + /// Instantiate a new FullScreenImage const FullScreenImage({ Key key, @required this.url, diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index c2e1feae..d3eff1b6 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -56,13 +56,14 @@ import 'stream_channel.dart'; /// The widget renders the ui based on the first ancestor of type [StreamChatTheme]. /// Modify it to change the widget appearance. class MessageInput extends StatefulWidget { - MessageInput( - {Key key, - this.onMessageSent, - this.parentMessage, - this.editMessage, - this.maxHeight = 150}) - : super(key: key); + /// Instantiate a new MessageInput + MessageInput({ + Key key, + this.onMessageSent, + this.parentMessage, + this.editMessage, + this.maxHeight = 150, + }) : super(key: key); /// Message to edit final Message editMessage; diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index 9119cbaf..96853632 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -55,6 +55,7 @@ typedef ThreadTapCallback = void Function(Message, Widget); /// The widget components render the ui based on the first ancestor of type [StreamChatTheme]. /// Modify it to change the widget appearance. class MessageListView extends StatefulWidget { + /// Instantiate a new MessageListView MessageListView({ Key key, this.messageBuilder, diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index f7ffbad2..e3fe6f92 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -32,6 +32,7 @@ import 'stream_chat.dart'; /// The widget components render the ui based on the first ancestor of type [StreamChatTheme]. /// Modify it to change the widget appearance. class MessageWidget extends StatefulWidget { + /// Instantiate a new MessageWidget const MessageWidget({ Key key, @required this.previousMessage, diff --git a/lib/src/reaction_picker.dart b/lib/src/reaction_picker.dart index 221dd3d8..da32857f 100644 --- a/lib/src/reaction_picker.dart +++ b/lib/src/reaction_picker.dart @@ -67,11 +67,13 @@ class ReactionPicker extends StatelessWidget { ); } + /// Add a reaction to the message void sendReaction(BuildContext context, String reactionType) { channel.sendReaction(message.id, reactionType); Navigator.of(context).pop(); } + /// Remove a reaction from the message void removeReaction(BuildContext context, String reactionType) { channel.deleteReaction(message.id, reactionType); Navigator.of(context).pop(); diff --git a/lib/src/stream_channel.dart b/lib/src/stream_channel.dart index 70357b65..eb7f4aea 100644 --- a/lib/src/stream_channel.dart +++ b/lib/src/stream_channel.dart @@ -101,6 +101,7 @@ class StreamChannelState extends State { }); } + /// Query the channel members and watchers Future queryMembersAndWatchers() async { await widget.channel.query( membersPagination: PaginationParams( diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index 842a0699..876f76ee 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -59,6 +59,7 @@ class StreamChat extends StatefulWidget { } } +/// The current state of the StreamChat widget class StreamChatState extends State with WidgetsBindingObserver { Client get client => widget.client; final GlobalKey _navigatorKey = GlobalKey(); diff --git a/lib/src/thread_header.dart b/lib/src/thread_header.dart index 07f10e60..19a576c8 100644 --- a/lib/src/thread_header.dart +++ b/lib/src/thread_header.dart @@ -62,6 +62,7 @@ class ThreadHeader extends StatelessWidget implements PreferredSizeWidget { /// The message parent of this thread final Message parent; + /// Instantiate a new ThreadHeader ThreadHeader({ Key key, @required this.parent, diff --git a/lib/src/typing_indicator.dart b/lib/src/typing_indicator.dart index a759ecde..57427da6 100644 --- a/lib/src/typing_indicator.dart +++ b/lib/src/typing_indicator.dart @@ -4,6 +4,7 @@ import 'package:stream_chat_flutter/src/stream_channel.dart'; /// Widget to show the current list of typing users class TypingIndicator extends StatelessWidget { + /// Instantiate a new TypingIndicator const TypingIndicator({ Key key, this.channel,