flet-image-viewer
flet-image-viewer is a Flet extension for displaying zoomable images and
swipeable image galleries in Flet applications.
The package provides FletImageViewer for a single image and FletMultiViewer
for a swipeable gallery. Both controls support pinch-to-zoom, configurable
image fitting, overlays, and long-press or double-tap events.
Demo
Want to see it in action? Watch the sample demo video.
Installation
Install the published package from PyPI:
pip install flet-image-viewer
Or add it to your application's pyproject.toml:
[project]
dependencies = [
"flet>=0.86.5",
"flet-image-viewer",
]
To install the latest version directly from GitHub instead, use:
[project]
dependencies = [
"flet>=0.86.5",
"flet-image-viewer @ git+https://github.com/zaim-tech/flet-image-viewer.git",
]
Usage
import flet as ft
from flet_image_viewer import FletImageViewer
def main(page: ft.Page):
page.title = "Image viewer example"
page.add(
FletImageViewer(
src="https://picsum.photos/900/600",
show_close_button=True,
BoxFit=ft.BoxFit.CONTAIN,
min_scale=1.0,
max_scale=4.0,
expand=True,
)
)
ft.run(main)
The src property accepts an image URL or a local file path. For example:
base = os.path.dirname(os.path.abspath(__file__))
image = os.path.join(base, "assets/photo.jpg")
FletImageViewer(src=image)
Swipeable gallery
Use FletMultiViewer to display multiple images. The index property selects
the image shown first, starting at 0.
import flet as ft
from flet_image_viewer import FletMultiViewer
def main(page: ft.Page):
page.add(
FletMultiViewer(
src=[
"https://picsum.photos/id/10/900/600",
"https://picsum.photos/id/20/900/600",
"https://picsum.photos/id/30/900/600",
],
viewer_id="photo-gallery",
index=0,
BoxFit=ft.BoxFit.CONTAIN,
overlay=ft.Container(
content=ft.Text("Swipe to view more"),
bgcolor=ft.Colors.with_opacity(0.75, ft.Colors.BLACK),
padding=10,
),
on_long_press=lambda event: print("Image long-pressed"),
on_double_tap=lambda event: print("Image double-tapped"),
expand=True,
)
)
ft.run(main)
Control properties
| Property | Type | Default | Description |
|---|---|---|---|
src |
str / list |
required | Image URL or local path, or a list of URLs and paths for FletMultiViewer. |
viewer_id |
str |
required for FletMultiViewer |
Identifier for the multi-image viewer. |
index |
int |
0 |
Initial image index for FletMultiViewer. |
show_close_button |
bool |
False |
Shows a close button on FletImageViewer. |
BoxFit |
ft.BoxFit \\| None |
None |
Controls how the image fits inside the viewer. |
overlay |
ft.Control \\| None |
None |
Flet control displayed over the image viewer. |
min_scale / max_scale |
float \\| None |
None |
Minimum and maximum zoom levels. |
on_long_press |
event handler | None |
Called when the image is long-pressed. |
on_double_tap |
event handler | None |
Called when the image is double-tapped. |
Events
Register handlers directly on either viewer:
def handle_double_tap(event: ft.ControlEvent):
print("Viewer double-tapped")
viewer = FletImageViewer(
src="https://picsum.photos/900/600",
on_double_tap=handle_double_tap,
)
Platform support
The extension supports all Flet platforms except Web:
| Platform | Support |
|---|---|
| Android | Supported |
| iOS | Supported |
| Linux | Supported |
| macOS | Supported |
| Windows | Supported |
| Web | Not supported |
Build and run
For desktop development, build the client once and then use flet run:
flet build windows
flet run
Rebuild the client when the extension's Dart code changes. Python-only changes can be picked up with the normal Flet development workflow after the extension has been built.
Build the example
The example application is in
examples/flet_image_viewer_example/:
cd examples/flet_image_viewer_example
flet build windows
flet run
Replace windows with another supported desktop or mobile target.
Documentation
See the complete API documentation for the generated control reference.
Development
The project follows Flet's extension structure:
src/flet_image_viewer/ Python controls
src/flutter/flet_image_viewer/ Native Flutter extension
examples/flet_image_viewer_example/ Sample Flet application
docs/ API documentation
License
See LICENSE.
Made with ❤️ by Zaim Sheali
Metadata
Release files for flet-image-viewer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flet_image_viewer-0.1.1.tar.gz | 5.2 kB | With provenance | Details for flet_image_viewer-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flet_image_viewer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for flet_image_viewer-0.1.1-py3-none-any.whl |
Total release size: 11.7 kB
Release files / flet_image_viewer-0.1.1.tar.gz
| Download URL | flet_image_viewer-0.1.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b30b2256b25e3cb38bbc25bb025f01bc3d286dd03526155a51f76ef807fe0516
|
|
BLAKE2b-256 checksum How to use checksums |
b3f0c65adc775765dbbb6cc8f20dad098789364a2ceaa01d864694cfe792dabd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logRelease files / flet_image_viewer-0.1.1-py3-none-any.whl
| Download URL | flet_image_viewer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cc59e2b25f1580812875fed6f008bbda30ae1c2094b28d01189a5d59daf8532
|
|
BLAKE2b-256 checksum How to use checksums |
ea006c179506271c26b252095c64f0813a14c437c09cdfc2890f91d2f98f8f38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logSecurity for flet-image-viewer 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flet_image_viewer-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.