搜尋分類、套件與程式碼儲存庫

progressive_image 封面
套件詳情v2.0.1

progressive_image

一個 Flutter 小部件,使用低品質圖像佔位符逐步載入較大的影像。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1100
喜歡數
390
Pub 分數
150

安裝套件

flutter pub add progressive_image

套件介紹

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

ProgressiveImage 是一個 Flutter widget,透過先顯示低品質的佔位圖像,然後隨著完整解析度圖像載入逐漸提升品質,從而增強圖像載入效能。這種技術可減少感知載入時間並改善使用者體驗,特別是在網路較慢的情況下。該套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,使它適用於跨平台應用程式。它能與現有的影像載入流程無縫整合,並與 NetworkImage 等常見影像提供者搭配良好。

適用情境

  • 提升圖像密集型應用的感知效能
  • 在慢速網路連接上提升使用者體驗
  • 顯示高解析度圖像並實現平滑過渡
  • 在畫廊或資訊流中載入大圖片
  • 優化電子商務應用中的圖像加載

主要特色

  • 低品質圖像佔位符 (LQIP) 支援
  • 平滑漸進式圖像渲染
  • 跨平台相容性
  • 與現有圖像加載器輕鬆整合
  • 支援網路和本機圖像來源

適合對象

  • 包含大量高解析度圖像的應用程式
  • 優先考慮順暢加載體驗的使用者介面
  • 尋求在圖像加載過程中獲得更好視覺反饋的開發者
  • 針對多個平台的專案
  • 注重性能的移動和Web應用程式

使用建議

  • 需要一個合適的低品質佔位符圖像
  • 可能會略微增加初始記憶體使用量
  • 對於非常小的圖像,LQIP 的優勢很小,因此不是理想選擇
  • 依賴於正確的圖像資源管理
  • 最佳搭配預覽與最終版本之間有顯著尺寸差異的影像使用

原始 README

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

Progressive Image

A flutter widget which progressively loads large images using Low Quality Image Placeholders.

Snapshots

Features

  • Displays placeholder and thumbnail image until the target Image loads.
  • Smooth Fade-in animations for preventing immediate image popups on load.
  • Blur effect for low resolution thumbnail to prevent the pixelated view.
  • Effectively resolves thumbnail image before the target image starts to fetch for quick first impression.
  • Placeholder widgets instead of placeholder images can now be added in v2.0.0

Installing

Following steps will help you add this library as a dependency in your flutter project.

  • In the pubspec.yaml file in the root of your project
dependencies:
  progressive_image: ^2.0.0
  • Run the following command to get packages:
$ flutter packages get
  • Import the package in your project file:
import 'package:progressive_image/progressive_image.dart';

Usage

For a more detailed look at how to use this library, there is a sweet project in the example directory and various examples can be found here

A simple example usage of the ProgressiveImage widget is shown below:

import 'package:flutter/material.dart';
import 'package:progressive_image/progressive_image.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Progressive Image Example')),
        body: ProgressiveImageExample(),
      ),
    );
  }
}

class ProgressiveImageExample extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return Container(
            child: ProgressiveImage(
                placeholder: AssetImage('assets/placeholder.jpg'),
                // size: 1.87KB
                thumbnail: NetworkImage('https://i.imgur.com/7XL923M.jpg'),
                // size: 1.29MB
                image: NetworkImage('https://i.imgur.com/xVS07vQ.jpg'),
                height: 300,
                width: 500,
            ),
        );
    }
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。