Skip to main content

LMChatLinkPreview

File location
link_preview.dart

LMChatLinkPreview displays a preview of a link in the chat interface using Open Graph tags, with support for custom builders and style configurations.

Properties

  1. ogTags (LMChatOGTagsViewData)
    Open Graph tags used to display link data.

  2. onTap (VoidCallback?)
    Callback for handling tap events on the link preview.

  3. style (LMChatLinkPreviewStyle?)
    Customizes the appearance of the link preview.

Note: These properties are only a subset. More can be found inside the widget class.


Styling

LMChatLinkPreviewStyle

File location
link_preview.dart

LMChatLinkPreviewStyle defines the appearance of the link preview, including padding, size, and text styles.

PropertyTypeDescriptionRequiredDefault
marginEdgeInsets?Margin around the previewNoEdgeInsets.only(bottom: 8)
widthdouble?Width of the preview containerNodouble.infinity
titleStyleLMChatTextStyle?Text style for the titleNoDefined default style

Note: These properties are only a subset. More can be found inside the style class.


Example Usage

final linkPreview = LMChatLinkPreview(
ogTags: ogTagsData,
onTap: () => launch(ogTagsData.url),
style: LMChatLinkPreviewStyle(
margin: EdgeInsets.only(bottom: 8),
width: double.infinity,
titleStyle: LMChatTextStyle(
textStyle: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
),
);