搜尋套件、儲存庫與 APP 分類

any_image_view 封面
套件詳情v2.5.0

any_image_view

一個功能強大的Flutter影像檢視器,支援PNG、JPG、WebP、GIF、TIFF、RAW、SVG、Lottie、XFile及網路圖片,並提供最佳解析度——所有功能整合於一個無縫的套件中。

AndroidiOSmacOSWindowsLinux
近 30 天下載
649
喜歡數
100
Pub 分數
160

安裝套件

flutter pub add any_image_view

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

AnyImageView 是一個全面的 Flutter 套件,可簡化顯示各種影像格式,包括 PNG、JPG、WebP、GIF、TIFF、RAW、SVG 和 Lottie,以及網路和 XFile 影像。它會自動處理解析度優化和跨平台渲染,確保高品質顯示而無需額外設定。設計用於順暢整合,支援 Android、iOS、macOS、Windows 和 Linux,非常適合需要彈性且可靠影像處理的應用程式。

適用情境

  • 在單個組件中顯示多種圖像格式
  • 從URL和本地檔案加載影像
  • 支援 GIF 和 Lottie 等動畫圖像
  • 渲染向量圖形,例如 SVG
  • 處理原始和高解析度影像
  • 建構媒體相簿或圖像密集型應用

主要特色

  • 支援多種圖像格式(PNG、JPG、WebP、GIF、TIFF、RAW、SVG、Lottie)
  • 自動解析度優化
  • 處理網路和 XFile 源
  • 跨平台相容性
  • 簡單的 API,設定簡單
  • 內建快取和錯誤處理

適合對象

  • 開發媒體豐富應用程式的開發者
  • 需要支援動畫或向量圖像的應用程式
  • 需要跨平台一致圖像渲染的項目
  • 希望獲得統一圖像顯示解決方案的團隊
  • 具有不同圖像來源的原型或生產應用程式

使用建議

  • 由於包含格式解碼器,可能會增加應用大小
  • 性能可能因大型或複雜的動畫而有所不同
  • 對於長圖像列表,需要仔細的記憶體管理
  • 高級圖像處理的自訂功能有限
  • 不適用於影像編輯或轉換

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

any_image_view

Pub Version License

Any Image View

Show any image with one widget. Network, asset, file, XFile, SVG or Lottie: hand it to AnyImageView and it takes care of loading, caching, retries and errors. Zero dependencies.

Install

dependencies:
  any_image_view: ^2.5.0
import 'package:any_image_view/any_image_view.dart';

Usage

// Network (cached on disk after the first load)
AnyImageView(imagePath: 'https://example.com/photo.jpg', height: 200, width: 200)

// Asset
AnyImageView(imagePath: 'assets/photo.png', height: 200, width: 200)

// SVG, asset or network, optionally tinted
AnyImageView(imagePath: 'assets/icon.svg', height: 40, width: 40, svgColor: Colors.blue)

// Lottie, loops automatically
AnyImageView(imagePath: 'assets/loader.json', height: 120, width: 120)

// Local file or image_picker result
AnyImageView(imagePath: '/path/to/photo.jpg', height: 200, width: 200)
AnyImageView(imagePath: pickedXFile, height: 200, width: 200)

// Circular avatar
AnyImageView(imagePath: url, height: 80, width: 80, shape: BoxShape.circle)

// Tap for a fullscreen viewer with pan, pinch and double-tap zoom
AnyImageView(imagePath: url, height: 200, width: 200, enableFullscreen: true)

// Styling and custom states
AnyImageView(
  imagePath: url,
  height: 200,
  width: 300,
  fit: BoxFit.cover,
  borderRadius: BorderRadius.circular(16),
  placeholderWidget: const CircularProgressIndicator(),
  errorWidget: const Icon(Icons.broken_image),
)

Supported formats

Type Formats
Raster PNG, JPG, WebP, GIF, BMP, ICO
Platform-decoded AVIF, HEIC on Android 12+, iOS 16+, macOS 13+ and web
Vector SVG
Animation Lottie .json, .zip, .lottie
Sources Network URL, asset, file path, file:// URI, XFile, File

The source is detected from the path. Matching is case-insensitive and ignores query strings and fragments.

Parameters

Parameter Type Default Purpose
imagePath Object? URL, asset path, file path, XFile or File
height, width double? Size
fit BoxFit? cover How the image fills the box (contain for SVG and Lottie)
alignment Alignment? Alignment inside the container
shape BoxShape rectangle rectangle or circle
borderRadius BorderRadius? Rounded corners
border BoxBorder? Border
boxShadow List<BoxShadow>? Shadows
margin, padding EdgeInsetsGeometry? Outer and inner spacing
placeholderWidget Widget? shimmer Shown while loading
errorWidget Widget? broken-image icon Shown on failure
fadeDuration Duration 400 ms Fade-in
maxRetryAttempts int 3 Retries after a failed network load; 0 disables
httpHeaders Map<String, String>? Headers for network requests
enableZoom bool false Inline pinch-to-zoom
enableFullscreen bool false Tap opens a fullscreen viewer
onTap VoidCallback? Custom tap handler
svgColor Color? Tint for SVGs
svgColorFilter ColorFilter? Custom SVG color filter

Screenshots

Network, PNG, SVG AVIF Lottie, avatar, error Fullscreen
Network image, PNG and SVG AVIF asset and network AVIF Lottie, circular avatar and error widget Fullscreen viewer

所屬分類

原始碼儲存庫

使用此套件的專案