From d55b937364b43f64c5868dfc5d50269406f269b0 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Wed, 5 May 2021 16:38:05 +0530 Subject: [PATCH] lint --- .../lib/src/sending_indicator.dart | 16 +++++--- .../lib/src/stream_chat.dart | 38 +++++++++++-------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/sending_indicator.dart b/packages/stream_chat_flutter/lib/src/sending_indicator.dart index 68fc5a0d..88560432 100644 --- a/packages/stream_chat_flutter/lib/src/sending_indicator.dart +++ b/packages/stream_chat_flutter/lib/src/sending_indicator.dart @@ -3,10 +3,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; /// Used to show the sending status of the message class SendingIndicator extends StatelessWidget { - final Message message; - final bool isMessageRead; - final double? size; - + /// Constructor for creating a [SendingIndicator] widget const SendingIndicator({ Key? key, required this.message, @@ -14,6 +11,15 @@ class SendingIndicator extends StatelessWidget { this.size = 12, }) : super(key: key); + /// Message for sending indicator + final Message message; + + /// Flag if message is read + final bool isMessageRead; + + /// Size for message + final double? size; + @override Widget build(BuildContext context) { if (isMessageRead) { @@ -35,6 +41,6 @@ class SendingIndicator extends StatelessWidget { size: size, ); } - return SizedBox(); + return const SizedBox(); } } diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index 2c22dde3..424d4bcf 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -31,18 +31,7 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'; /// /// Use [StreamChat.of] to get the current [StreamChatState] instance. class StreamChat extends StatefulWidget { - final StreamChatClient client; - final Widget? child; - final StreamChatThemeData? streamChatThemeData; - - /// The amount of time that will pass before disconnecting the client in the background - final Duration backgroundKeepAlive; - - /// Handler called whenever the [client] receives a new [Event] while the app - /// is in background. Can be used to display various notifications depending - /// upon the [Event.type] - final EventHandler? onBackgroundEventReceived; - + /// Constructor for creating a [StreamChat] widget const StreamChat({ Key? key, required this.client, @@ -50,9 +39,25 @@ class StreamChat extends StatefulWidget { this.streamChatThemeData, this.onBackgroundEventReceived, this.backgroundKeepAlive = const Duration(minutes: 1), - }) : super( - key: key, - ); + }) : super(key: key); + + /// Client to do chat ops with + final StreamChatClient client; + + /// Child which inherits details + final Widget? child; + + /// Theme to pass on + final StreamChatThemeData? streamChatThemeData; + + /// The amount of time that will pass before disconnecting the client + /// in the background + final Duration backgroundKeepAlive; + + /// Handler called whenever the [client] receives a new [Event] while the app + /// is in background. Can be used to display various notifications depending + /// upon the [Event.type] + final EventHandler? onBackgroundEventReceived; @override StreamChatState createState() => StreamChatState(); @@ -74,6 +79,7 @@ class StreamChat extends StatefulWidget { /// The current state of the StreamChat widget class StreamChatState extends State { + /// Gets client from widget StreamChatClient get client => widget.client; @override @@ -96,7 +102,7 @@ class StreamChatState extends State { client: client, onBackgroundEventReceived: widget.onBackgroundEventReceived, backgroundKeepAlive: widget.backgroundKeepAlive, - child: widget.child ?? Offstage(), + child: widget.child ?? const Offstage(), ), ); },