搜索插件、代码仓与 APP 分类

插件详情v1.2.1

link_previewer

一个全新的 Flutter 包。它旨在让链接看起来比普通的内联链接或默认超链接更美观。

近 30 天下载
59
喜欢数
14
Pub 分数
40

安装插件

flutter pub add link_previewer

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Link Previewer 是一个 Flutter 包,旨在增强应用程序中链接的视觉呈现效果。它将普通 URL 转换为包含缩略图、标题、描述和从链接内容中获取的元数据的丰富交互式预览。适用于社交媒体应用、消息平台或任何用户分享网页链接的应用程序,通过使链接更具信息量和视觉吸引力来提升用户参与度。该包支持动态渲染,并可无缝集成到现有的文本小部件中。

适合场景

  • 社交媒体应用
  • 消息接口
  • 内容共享功能
  • 博客或新闻源显示
  • 用户生成内容平台

主要特点

  • 自动获取链接元数据
  • 显示缩略图和描述
  • 支持动态预览渲染
  • 与文本小部件的轻松集成
  • 简洁、可自定义的用户界面

适合对象

  • 开发社交应用的开发者
  • 用户分享的链接的应用
  • 需要丰富链接可视化的项目
  • 专注于用户体验改进的团队

使用建议

  • 需要互联网访问以获取元数据
  • 可能会影响大量预览时的性能
  • 仅限 HTTP/HTTPS URL
  • 不支持离线预览
  • 依赖外部网站的元标签

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

link_previewer

A new Flutter package. Build container with image, title, description from web-site (link) will be provided.

Getting Started

alt text

Installing

Use this package as a library

  1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  link_previewer: ^1.2.1
  1. Install it

You can install packages from the command line: with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

  1. Import it

Now in your Dart code, you can use:

import 'package:link_previewer/link_previewer.dart';

Usage

Widget build() {
  return Column(
    mainAxisAlignment: MainAxisAlignment.center,
    children: <Widget>[
      LinkPreviewer(
        link: "https://www.linkedin.com/feed/",
        direction: ContentDirection.horizontal,
      ),
      LinkPreviewer(
        link: "https://www.linkedin.com/feed/",
        direction: ContentDirection.vertical,
      ),
    ],
  );
}

Properties (Constructor props)

PropName Value Definition
link String value (Ex: "http://...") Link to website will be shown as LinkPreviewer
titleFontSize double (default: 15, but it's auto resizable depends on layout(parent) width or hight) Title font size
bodyFontSize double (default: 14, but it's auto resizable depends on layout(parent) width or hight) Body font size
backgroundColor Color (default: Colors.white) Background color in case there will be not much text and will be whitespace
borderColor Color (default: Colors.deepOrangeAccent) Border color of the previewer
borderRadius double (default: 3.0) Border radius
direction ContentDirection from the package (default: ContentDirection.horizontal) Options: 1. ContentDirection.horizontal 2. ContentDirection.vertical Content direction (image -> title -> body)
From version 1.1.0
PropName Value Definition
placeholder Widget Custom placeholder while data is loading
defaultPlaceholderColor Color (default: light-grey) If placeholder is not set, will be used the default one and its color can be set using this prop (empty container with background)
showTitle bool (default: true) Title can be hiden using this prop, if it set to false
showBody bool (default: true) Body can be hiden using this prop, if it set to false
From version 1.2.0
PropName Value Definition
bodyTextOverflow TextOverflow (default: TextOverflow.ellipsis or TextOverflow.fade) Text overflow prop
bodyMaxLines int (default: depends on hight) Max Lines that will be shown in the body

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目

暂无相关数据。