搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。