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

插件详情v3.3.0

thumbnailer

一个能够从各种 MIME 类型的文件生成缩略图的插件。如果特定 MIME 类型不支持缩略图生成,则返回备用图标

AndroidiOSWebmacOSWindows
近 30 天下载
5540
喜欢数
106
Pub 分数
150

安装插件

flutter pub add thumbnailer

插件介绍

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

Thumbnailer 是一个 Flutter 插件,可从各种 MIME 类型的文件(如图像、文档和视频)生成缩略图。当文件的 MIME 类型不支持生成缩略图时,它会返回一个备用图标。该插件支持 Android、iOS、Web、macOS 和 Windows 等多个平台,非常适合跨平台应用中的文件浏览和预览功能。它简化了显示视觉预览的过程,无需为每种文件类型进行自定义实现。

适合场景

  • 文件资源管理器界面
  • 文档预览屏幕
  • 媒体画廊应用
  • 资产管理工具
  • 用户上传预览

主要特点

  • 支持多种MIME类型
  • 不支持类型的备用图标
  • 跨平台兼容性
  • 简单 API 集成
  • 自动缩略图生成

适合对象

  • 开发文件管理器的开发者
  • 需要视觉文件预览的应用程序
  • 支持多种文件类型的项目
  • 跨平台桌面和移动应用
  • 需要快速资产可视化的UI

使用建议

  • 仅限支持的 MIME 类型
  • 备用图标可能无法自定义
  • 性能取决于文件大小
  • 需要移动平台特定的权限
  • 不适合高分辨率输出需求

原始 README

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

thumbnailer

pub package

A Flutter plugin that is able to generate thumbnails for images, pdf and xlsx files

  • if thumbnail generation is not supported for specific mime type, then a fallback icon from FontAwesome is returned
  • supports registering custom mime type handlers for dynamic extendability
  • resulting thumbnail (or fallback icon) is flutter widget
  • supports custom resizing/styling of the resulting thumbnail

Why

In time of creation of this plugin, there was no available solution on pub.dev

Usage

To use this plugin, add thumbnailer as a dependency in your pubspec.yaml file.

Icons

By default, plugin provides following icons based on mimetype

MIME Type Icon
image image
application/pdf pdf
application/msword doc
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.oasis.opendocument.text odt
application/vnd.ms-excel xls
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/vnd.oasis.opendocument.spreadsheet ods
application/vnd.ms-powerpoint ppt
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.oasis.opendocument.presentation odp
text/plain txt
text/csv csv
application/x-archive archive
application/x-cpio cpio
application/x-shar shar
application/x-iso9660-image iso9660
application/x-sbx sbx
application/x-tar tar
application/x-bzip2 bzip2
application/gzip gzip
application/x-lzip lzip
application/x-lzma lzma
application/x-lzop lzop
application/x-snappy-framed snappy
application/x-xz xz
application/x-compress compress
application/zstd zstd
application/java-archive jar
application/octet-stream octet-stream
application/vnd.android.package-archive apk
application/vnd.ms-cab-compressed cab
application/x-7z-compressed 7z
application/x-ace-compressed ace
application/x-alz-compressed alz
application/x-apple-diskimage dmg
application/x-arj arj
application/x-astrotite-afa afa
application/x-b1 b1
application/x-cfs-compressed cfs
application/x-dar dar
application/x-dgc-compressed dgc
application/x-freearc arc
application/x-gca-compressed gca
application/x-gtar gtar
application/x-lzh lzh
application/x-lzx lzx
application/x-ms-wim wim
application/x-rar-compressed rar
application/x-stuffit sit
application/x-stuffitx sitx
application/x-xar xar
application/x-zoo zoo
application/zip zip
text/html html
text/javascript js
text/css css
text/x-python py
application/x-python-code pyo
text/xml xml
application/xml xml
text/x-c c
application/java java
application/java-byte-code class
application/x-java-class class
application/x-csh csh
text/x-script.csh csh
text/x-fortran f90
text/x-h h
application/x-ksh ksh
text/x-script.ksh ksh
application/x-latex tex
application/x-lisp lisp
text/x-script.lisp lisp
text/x-m m
text/x-pascal pas
text/x-script.perl pl
application/postscript ps
text/x-script.phyton py
application/x-bytecode.python pyc
text/x-asm asm
application/x-bsh bsh
application/x-sh sh
text/x-script.sh sh
text/x-script.zsh zsh
default file

You can override these, or add custom one using Thumbnailer.addCustomMimeTypesToIconDataMappings

Generation strategies

Thunbnailer allows you to provide custom thumbnail based on dynamic variables like content of file. Basic implementacion have following generation strategies:

  • Images — show inlined image
  • PDF — Show highlight of first page
  • XLS / ODT — Show highlight of first sheet.

You can extend these using Thumbnailer.addCustomGenerationStrategies

Example

Check the example tab here in pub.dev or example project on GitHub

Contribution and Support

  • Contributions are welcome!
  • If you want to contribute code please create a PR
  • If you find a bug or want a feature, please fill an issue

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目