add docComments

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
xsahil03x
2020-11-27 13:42:10 +05:30
parent ded26db306
commit c6552be540
2 changed files with 82 additions and 17 deletions
+21 -2
View File
@@ -3,22 +3,40 @@ import 'package:jiffy/jiffy.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// It shows the current [Message] preview.
///
/// Usually you don't use this widget as it's the default item used by [MessageSearchListView].
///
/// The widget renders the ui based on the first ancestor of type [StreamChatTheme].
/// Modify it to change the widget appearance.
class MessageSearchItem extends StatelessWidget {
final Message message;
/// Instantiate a new MessageSearchItem
const MessageSearchItem({
Key key,
@required this.message,
this.onTap,
this.showOnlineStatus = true,
}) : super(key: key);
/// [Message] displayed
final Message message;
/// Function called when tapping this widget
final VoidCallback onTap;
/// If true the [MessageSearchItem] will show the current online Status
final bool showOnlineStatus;
@override
Widget build(BuildContext context) {
final data = Message.fromJson(message.extraData['message']);
final user = data.user;
debugPrint(message.toJson().toString());
return ListTile(
onTap: onTap,
leading: UserAvatar(
user: user,
showOnlineStatus: showOnlineStatus,
constraints: BoxConstraints.tightFor(
height: 40,
width: 40,
@@ -31,6 +49,7 @@ class MessageSearchItem extends StatelessWidget {
subtitle: Row(
children: [
Expanded(child: _buildSubtitle(context, data)),
SizedBox(width: 16),
_buildDate(context, data),
],
),