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

simple_url_preview 封面
插件详情v3.0.1

simple_url_preview

用于显示网址预览的 Flutter 包。可自定义高度、背景和文本样式,以及行数。

近 30 天下载
103
喜欢数
77
Pub 分数
60

安装插件

flutter pub add simple_url_preview

插件介绍

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

一个 Flutter 包,可显示可自定义高度、背景、文本样式和分隔线的 URL 预览。它使开发者能够轻松地将丰富的媒体预览集成到他们的应用中,从而在分享链接时提升用户体验。该包支持从 URL 动态渲染内容,并提供简洁灵活的界面进行样式设置。非常适合社交应用或消息平台,这些平台通常需要频繁分享链接。

适合场景

  • 在聊天应用中显示链接预览
  • 增强社交媒体帖子流
  • 通过共享链接提升用户参与度
  • 在消息界面中集成丰富的媒体预览

主要特点

  • 可自定义预览高度
  • 可配置的背景和文本样式
  • 可调节的行分隔符
  • 动态URL内容渲染
  • 简单集成,设置最少

适合对象

  • 社交媒体应用
  • 消息和聊天平台
  • 内容共享功能
  • 需要丰富链接预览的应用

使用建议

  • 需要互联网访问以获取预览数据
  • 仅限基本样式选项
  • 可能需要对复杂URL进行额外处理
  • 依赖外部元数据的可用性

原始 README

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

simple_url_preview

likes pub points popularity

Flutter package to show url preview

In Action

Getting Started

This shows url preview of a URL. (Now migrated to null-safety).

Currently only supports Open Graph Protocol

Please use latest version of the package.

How to use ?

Add simple_url_preview to pubspec.yaml, and hit command 'flutter pub get'

dependencies:
  ...
  simple_url_preview: ^3.0.1
1) Simple use:
SimpleUrlPreview(
  url: 'https://pub.dev/',
),
2) Override preview height, padding.(Default and minimum possible height is 130):
SimpleUrlPreview(
  url: 'https://pub.dev/',
  previewHeight: 200,
  previewContainerPadding: EdgeInsets.all(10),
),
3) Override background color:

Default bgColor = Theme.of(context).primaryColor

SimpleUrlPreview(
  url: 'https://pub.dev/',
  bgColor: Colors.red,
),
4) Override title, description, and site style:

Default titleStyle = TextStyle( fontWeight: FontWeight.bold, fontSize: 16, color: Theme.of(context).accentColor )

Default descriptionStyle = TextStyle( fontSize: 14, color: Theme.of(context).accentColor )

Default siteNameStyle = TextStyle( fontSize: 14, color: Theme.of(context).accentColor )

SimpleUrlPreview(
  url: 'https://pub.dev/',
  titleStyle: TextStyle(
    fontSize: 16,
    fontWeight: FontWeight.bold,
    color: Colors.red,
  ),
  descriptionStyle: TextStyle(
    fontSize: 14,
    color: Theme.of(context).primaryColor,
  ),
  siteNameStyle: TextStyle(
    fontSize: 14,
    color: Theme.of(context).primaryColor,
  ),
),
5) If you want closable preview (Click on x to close the preview.):
SimpleUrlPreview(
  url: 'https://pub.dev/',
  isClosable: true,
),
6) Override image loader color and title and description lines:

Default and maximum title lines = 2 and description lines = 3.

SimpleUrlPreview(
  url: 'https://pub.dev/',
  titleLines: 1,
  descriptionLines: 2,
  imageLoaderColor: Colors.white,
),
7) Override onTap callback of the URL preview:

By Default, will open URL in default browser.

SimpleUrlPreview(
  url: 'https://pub.dev/',
  onTap: () => print('Hello Flutter URL Preview'),
),
Contribution:

Would :heart: to see any contributions.

Appreciate:

If you liked my work, show some :heart: by :star: repo.

Also you can appreciate by

Buy Me A Coffee PayPal Logo

所属分类

依赖

依赖清单 6 项

源码仓库

使用此插件的项目

暂无相关数据。