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
ogTags(LMChatOGTagsViewData)
Open Graph tags used to display link data.onTap(VoidCallback?)
Callback for handling tap events on the link preview.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.
| Property | Type | Description | Required | Default |
|---|---|---|---|---|
margin | EdgeInsets? | Margin around the preview | No | EdgeInsets.only(bottom: 8) |
width | double? | Width of the preview container | No | double.infinity |
titleStyle | LMChatTextStyle? | Text style for the title | No | Defined 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,
),
),
),
);