thumbnailer
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 |
|
application/pdf |
|
application/msword |
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
|
application/vnd.oasis.opendocument.text |
|
application/vnd.ms-excel |
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
|
application/vnd.oasis.opendocument.spreadsheet |
|
application/vnd.ms-powerpoint |
|
application/vnd.openxmlformats-officedocument.presentationml.presentation |
|
application/vnd.oasis.opendocument.presentation |
|
text/plain |
|
text/csv |
|
application/x-archive |
|
application/x-cpio |
|
application/x-shar |
|
application/x-iso9660-image |
|
application/x-sbx |
|
application/x-tar |
|
application/x-bzip2 |
|
application/gzip |
|
application/x-lzip |
|
application/x-lzma |
|
application/x-lzop |
|
application/x-snappy-framed |
|
application/x-xz |
|
application/x-compress |
|
application/zstd |
|
application/java-archive |
|
application/octet-stream |
|
application/vnd.android.package-archive |
|
application/vnd.ms-cab-compressed |
|
application/x-7z-compressed |
|
application/x-ace-compressed |
|
application/x-alz-compressed |
|
application/x-apple-diskimage |
|
application/x-arj |
|
application/x-astrotite-afa |
|
application/x-b1 |
|
application/x-cfs-compressed |
|
application/x-dar |
|
application/x-dgc-compressed |
|
application/x-freearc |
|
application/x-gca-compressed |
|
application/x-gtar |
|
application/x-lzh |
|
application/x-lzx |
|
application/x-ms-wim |
|
application/x-rar-compressed |
|
application/x-stuffit |
|
application/x-stuffitx |
|
application/x-xar |
|
application/x-zoo |
|
application/zip |
|
text/html |
|
text/javascript |
|
text/css |
|
text/x-python |
|
application/x-python-code |
|
text/xml |
|
application/xml |
|
text/x-c |
|
application/java |
|
application/java-byte-code |
|
application/x-java-class |
|
application/x-csh |
|
text/x-script.csh |
|
text/x-fortran |
|
text/x-h |
|
application/x-ksh |
|
text/x-script.ksh |
|
application/x-latex |
|
application/x-lisp |
|
text/x-script.lisp |
|
text/x-m |
|
text/x-pascal |
|
text/x-script.perl |
|
application/postscript |
|
text/x-script.phyton |
|
application/x-bytecode.python |
|
text/x-asm |
|
application/x-bsh |
|
application/x-sh |
|
text/x-script.sh |
|
text/x-script.zsh |
|
default |
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