viewfinder 0.1.0
viewfinder: ^0.1.0 copied to clipboard
Modern Flutter photo viewer / gallery. Pinch / double-tap / mouse-wheel zoom with rubber-band edges and fling, drag-to-dismiss, thumbnails, page indicator, and keyboard shortcuts.
0.1.0 #
- Initial release.
Viewfindergallery (PageView-backed, horizontal or verticalpagerAxis) andViewfinderImage/.childsingle viewer.ViewfinderInitialScale.contain([factor])/.cover([factor])accept an optional multiplier —contain(0.8)shows the photo at 80% of fit,cover(1.2)zooms to 120% of fill..value(scale)remains as an absolute-multiplier shortcut.- Pinch, pan, double-tap ladder, double-tap-drag continuous zoom, opt-in two-finger rotation; post-release fling on both pan and scale via
FrictionSimulation(X / Y / scale axes), anchored to the focal point captured at release. - Rubber-band elastic edges — pulling a zoomed image past its boundary shows live elastic over-pan with diminishing returns, then animates back on release.
- Custom
ZoomableViewportgesture layer that yields edge pans to the parent scrollable viacanPan(Axis, int). Yields single-pointer drags along the pager axis when not zoomed, so mouse-drag and trackpad-drag swipe pages on web/desktop. Viewfinder.swipeDragDevices— explicit pointer-kind set for the underlyingPageView. Defaults to all kinds (kViewfinderDefaultSwipeDragDevices) — overrides Flutter's defaultScrollBehaviorwhich excludes mouse on web/desktop.ViewfinderItem.thumbImage— low-res preview that cross-fades into the main image on first frame.ViewfinderThumbnails(4 positions,.custom()), sealedViewfinderPageIndicatorwithDots/Label/Adaptivevariants (Adaptivefalls back from dots to a"1 / N"label pastmaxDots;Labelaccepts a customlabelBuilder).ViewfinderDismissdrag-to-dismiss withslideType: wholePage | onlyImageand anonProgresscallback that reports normalized drag progress through the spring-back.ViewfinderChromeController— tap-to-toggle, auto-hide after idle, auto-hide while zoomed.- Keyboard (arrows, PageUp/Down, two-stage Escape), Android back-button two-stage,
PopScope-based Hero coherence on pop. - Mouse wheel + trackpad pinch zoom.
precacheAdjacentwarmsimageCachefor pages ±N around the current one, using the user'sImageProviderdirectly so cache keys match whatImage()will resolve.kViewfinderDefaultFlingDrag = 0.0000135, overridable viainteractionEndFrictionCoefficient.- Semantics labels per image and at gallery level.
Viewfinder.reverse— forwarded toPageView.reversefor right-to-left galleries.Viewfinder.allowEdgeHandoff(defaulttrue) — whenfalse, a zoomed image consumes all pan and never yields to the parentPageView; the user must reset zoom before swiping.Viewfinder.rubberBandPan/ViewfinderImage.rubberBandPan(defaulttrue) — opt out of elastic over-pan for hard edge clamping.ViewfinderImage.onScaleStart/onScaleEnd— gesture lifecycle callbacks, useful for haptics and analytics.ViewfinderImage.gaplessPlayback/ViewfinderImageItem.gaplessPlayback(defaulttrue) — forwarded to the underlyingImage.gaplessPlayback.ViewfinderImageController.currentTransformgetter andjumpToTransform/animateToTransformsetters for imperative position / rotation control.