搜索分类、插件与代码仓

progressive_image 封面
插件详情v2.0.1

progressive_image

一个 Flutter 小部件,使用低质量图像占位符逐步加载较大的图像。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1100
喜欢数
390
Pub 分数
150

安装插件

flutter pub add progressive_image

插件介绍

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

ProgressiveImage 是一个 Flutter 小部件,通过先显示低质量的占位符图像,然后在完整分辨率图像加载时逐步提高质量,从而提升图像加载性能。这种技术可以减少感知加载时间并改善用户体验,尤其是在网络较慢的情况下。该包支持 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,
            ),
        );
    }
}

所属分类

源码仓库

使用此插件的项目

暂无相关数据。