Skip to main content

viewfinder 1.2.0 copy "viewfinder: ^1.2.0" to clipboard
viewfinder: ^1.2.0 copied to clipboard

Modern Flutter photo viewer / gallery. Pinch / double-tap / wheel zoom with rubber-band edges, fling, drag-to-dismiss, loop paging, thumbnails, page indicator, keyboard shortcuts.

viewfinder #

pub package GitHub license CI codecov

A photo viewer for Flutter. Pinch / double-tap / rotation zoom, an arena-aware gesture layer that hands off edge pans to a parent PageView, drag-to-dismiss, loop paging, a synchronized thumbnail strip, a page indicator, keyboard shortcuts, screen-reader announcements, and a chrome controller for tap-to-toggle UX.

Accepts any ImageProvider (NetworkImage, AssetImage, FileImage, MemoryImage, …) and feeds it straight to Image(). No runtime dependencies beyond the Flutter SDK.

Live demo #

https://koji-1009.github.io/viewfinder/

A hosted build of the example app — try the gallery, single-photo viewer, vertical pager, embedded zoom, rotation, and content-warning scenarios in the browser. The gallery's settings sheet (tune icon) flips the gallery's knobs live.

Pinch and double-tap zoom    Swipe between pages with thumbnail sync

Highlights #

  • Native-feel gestures — pinch, pan, fling on translation and scale, double-tap ladder, double-tap-and-drag continuous zoom (iOS Photos style), opt-in two-finger rotation, rubber-band over-pan with snap-back on release, long-press / right-click hooks for save-and-share menus.
  • Built for every input — touch, stylus, trackpad, mouse, mouse wheel (zoom or page-turn), hardware keyboard. Mouse-drag swipes pages on web and desktop out of the box.
  • Widgets layer only — imports nothing from Material, so it drops into Material, Cupertino, and plain-widgets apps alike (and is ready for the Flutter 3.44 material/SDK split).
  • Plays well with parents — an arena-aware gesture layer hands edge pans back to a parent PageView so a zoomed photo can swipe to the next page without lifting the finger, on either axis — and only in the direction the photo has actually run out of content.
  • Gallery affordances included — Viewfinder.images([...]) covers the common case; thumbnail strip overlaying the full-bleed viewer (4 positions or fully custom), page indicator (dots / label / adaptive), drag-to-dismiss with overscroll-to-dismiss, loop paging, tap-to-toggle chrome controller with optional immersive system UI. All opt-in.
  • Accessible by default — page changes are announced to screen readers, thumbnails and indicators carry semantics, the platform reduce-motion setting is honored, and RTL locales get correctly mirrored paging and arrow keys.
  • Robust pop / back-button — pop while zoomed snaps every page back to its initial transform first, so any Hero flight starts from a sensible source rect; the first back / Esc on a zoomed photo resets the zoom, the second pops.
  • No runtime dependencies beyond the Flutter SDK.

Quick start #

Viewfinder.images(
  photos, // List<ImageProvider>
  dismiss: ViewfinderDismiss(onDismiss: () => Navigator.pop(context)),
)

Single photo, full-screen #

Viewfinder.single(
  image: const NetworkImage('https://example.com/photo.jpg'),
  dismiss: ViewfinderDismiss(onDismiss: () => Navigator.pop(context)),
  maxScale: 10,
)
Viewfinder(
  itemCount: photos.length,
  precacheAdjacent: 2,
  thumbnails: const ViewfinderThumbnails(size: 64),
  indicator: const ViewfinderPageIndicatorAdaptive(),
  dismiss: ViewfinderDismiss(onDismiss: () => Navigator.pop(context)),
  itemBuilder: (context, index) => ViewfinderItem(
    image: photos[index],
    thumbImage: photosLowRes[index], // optional progressive load
    semanticLabel: 'Vacation photo ${index + 1}',
  ),
)

Embedded zoomable image #

For a single zoomable image inside another scrollable layout (no chrome, no dismiss), use ViewfinderImage directly:

ViewfinderImage(
  image: const NetworkImage('https://example.com/photo.jpg'),
  initialScale: const ViewfinderInitialScale.contain(),
  doubleTapScales: const [1, 2.5, 5],
  maxScale: 8.0,
)

For non-image content, ViewfinderImage.child(child: …, contentKey: …) zooms any widget. The required contentKey is any Object whose == identifies the rendered content; for a single static .child, a constant string works (contentKey: 'main').

Documentation #

Guide Covers
Zoom, pan and image loading Initial scale (contain / cover), zoom and pan knobs, progressive loading
Gallery Paging knobs, drag-to-dismiss, thumbnail strip and thumbnailBar, page frames, page indicator
Imperative control ViewfinderController, ViewfinderImageController, ViewfinderChromeController, panGate
Hero Hero flights in and out of the viewer, route advice
Inputs and accessibility Mouse, wheel, trackpad and keyboard; announcements, semantics, reduce motion, RTL
Images and memory Decode size, network byte caching, video and other non-image pages
Web URL sync and testing Browser back and deep links; keys for widget tests

License #

MIT.

4
likes
160
points
898
downloads
screenshot

Documentation

API reference

Publisher

verified publisherkoji-1009.com

Weekly Downloads

Modern Flutter photo viewer / gallery. Pinch / double-tap / wheel zoom with rubber-band edges, fling, drag-to-dismiss, loop paging, thumbnails, page indicator, keyboard shortcuts.

Repository (GitHub)
View/report issues

Topics

#photo #gallery #image-viewer #zoom #thumbnails

License

MIT (license)

Dependencies

flutter

More

Packages that depend on viewfinder