Skip to main content

LMFeedCommentWidget

LMFeedCommentWidget is a widget that represents a comment in a feed. It displays information about the user who posted the comment, the comment text, and provides options for liking, replying, and showing replies to the comment. The widget is highly customizable, allowing you to modify its appearance and behavior.


LMFeedCommentWidget

The LMFeedCommentWidget is a part of the likeminds_feed_flutter_ui package. It is designed to be used within a feed or comment section to display individual comments and their associated actions.

Properties

  • user (LMUserViewData) - Required

The user data associated with the comment. This is a required parameter.

  • comment (LMCommentViewData) - Required

The comment data to be displayed. This is a required parameter.

  • lmFeedMenuAction (LMFeedMenuAction) - Required

The menu actions associated with the comment. This is a required parameter.

  • onTagTap (Function(String)) - Required

A callback function that is called when a tag in the comment text is tapped. It takes the tapped tag as a parameter. This is a required parameter.

  • profilePicture (LMFeedProfilePicture?)

A custom profile picture widget for the user. If not provided, the default profile picture will be used. This is an optional parameter.

  • titleText (LMFeedText?)

A custom title text widget for the comment. If not provided, the user's name will be displayed as the title. This is an optional parameter.

  • subtitleText (LMFeedText?)

A custom subtitle text widget for the comment. This is an optional parameter.

  • menu (Widget Function(LMFeedMenu)?)

A builder function that takes an LMFeedMenu and returns a custom menu widget for the comment. This is an optional parameter.

  • likeButtonBuilder (Widget Function(LMFeedButton)?)

A builder function that takes an LMFeedButton and returns a custom like button widget for the comment. This is an optional parameter.

  • replyButtonBuilder (Widget Function(LMFeedButton)?)

A builder function that takes an LMFeedButton and returns a custom reply button widget for the comment. This is an optional parameter.

  • showRepliesButtonBuilder (Widget Function(LMFeedButton)?)

A builder function that takes an LMFeedButton and returns a custom "show replies" button widget for the comment. This is an optional parameter.

  • likeButton (LMFeedButton?)

A custom like button widget for the comment. If not provided, the default like button will be used. This is an optional parameter.

  • replyButton (LMFeedButton?)

A custom reply button widget for the comment. If not provided, the default reply button will be used. This is an optional parameter.

  • showRepliesButton (LMFeedButton?)

A custom "show replies" button widget for the comment. If not provided, the default "show replies" button will be used. This is an optional parameter.

  • buttonSeparator (Widget?)

A custom separator widget between the action buttons. If not provided, a default separator will be used. This is an optional parameter.

  • style (LMFeedCommentStyle?)

The style configuration for the comment widget. It allows customization of various aspects of the comment's appearance. This is an optional parameter.

Styling

The LMFeedCommentStyle class allows you to customize the appearance of the LMFeedCommentWidget.

Customization variables

PropertyTypeDescriptionRequiredDefault
textStyleTextStyleThe text style for the comment text.
linkStyleTextStyleThe text style for links within the comment text.
actionsPaddingEdgeInsetsThe padding for the action buttons.
backgroundColorColorThe background color of the comment widget.
contentBackgroundColorColorThe background color of the comment text content.
marginEdgeInsetsThe margin around the comment widget.
borderRadiusBorderRadiusThe border radius of the comment widget.
widthdoubleThe width of the comment widget.
boxShadowList\<BoxShadow>The box shadow for the comment widget.
paddingEdgeInsetsThe padding of the comment widget.
likeButtonStyleLMFeedButtonStyleThe style for the like button.
replyButtonStyleLMFeedButtonStyleThe style for the reply button.
showRepliesButtonStyleLMFeedButtonStyleThe style for the "show replies" button.
showReplyButtonboolWhether to show the reply button.true
showRepliesButtonboolWhether to show the "show replies" button.true
showProfilePictureboolWhether to show the profile picture.true
profilePicturePaddingEdgeInsetsThe padding for the profile picture.
titlePaddingEdgeInsetsThe padding for the title text.
subtitlePaddingEdgeInsetsThe padding for the subtitle text.
showTimestampboolWhether to show the timestamp of the comment.true

You can create an instance of LMFeedCommentStyle and pass it to the LMFeedCommentWidget to customize its appearance.

Usage Example

LMFeedCommentWidget(
user: LMUserViewData(
id: 'your-user-id',
...
),
comment: LMCommentViewData(
id: 'your-comment-id',
...
),
lmFeedMenuAction: LMFeedMenuAction(
onCommentEdit: () {
// Handle comment edit action
},
onCommentDelete: () {
// Handle comment delete action
},
),
onTagTap: (tag) {
// Handle tag tap
print('Tapped tag: $tag');
},
// change the user profile
profilePicture: LMFeedProfilePicture(
fallbackText: userViewData.name, // replace with user name
imageUrl: userViewData.imageUrl, // replace with user image url
),
style: LMFeedCommentStyle(
backgroundColor: Colors.white,
padding: EdgeInsets.all(16),
textStyle: TextStyle(fontSize: 16),
linkStyle: TextStyle(color: Colors.blue),
showReplyButton: true,
showRepliesButton: true,
),
)

In this example, an LMFeedCommentWidget is created with the required user and comment data. The lmFeedMenuAction property is used to specify the actions for editing and deleting the comment. The onTagTap callback is provided to handle taps on tags within the comment text. The appearance of the comment widget is customized using the LMFeedCommentStyle class, specifying the background color, padding, text styles, and visibility of reply and "show replies" buttons.