Skip to content

Image viewing: InteractiveViewer (pinch-zoom/pan) and Image.network(headers:) for authenticated images #62

Closed

Description

@AbdurahmanAlmehdi

Select your plan

Community - basic support

Confirmations

  • I searched the existing feature requests and this is not a duplicate.

Framework or plugin?

Framework

Platform

Both

Use case

Our app (a fleet ledger ported from Flutter) keeps photos of receipts and invoices on maintenance records. The record page opens an attachment full-screen so the owner can zoom in and read the amounts. The Flutter viewer:

InteractiveViewer(
  maxScale: 5,
  child: Image.network(url, headers: {'Authorization': 'Bearer $token'}, fit: BoxFit.contain),
)

On DartNative 1.0.0 neither part exists:

error • The function 'InteractiveViewer' isn't defined • undefined_function
error • The named parameter 'headers' isn't defined • undefined_named_parameter
  • There is no InteractiveViewer or other pinch-zoom/pan container. A receipt photo shown with Image stays at 1x; on a phone the line items are hard to read.
  • Image.network(url, {width, height, fit, alignment, cachePolicy, fadeInDuration, placeholder, placeholderMinDuration, errorWidget, cacheWidth, cacheHeight}) takes no headers. Our attachments are behind the API's bearer token (with refresh-on-401 in our HTTP client), so Image.network can't load them.

Workaround: the viewer downloads the file through the app's HTTP client into the documents directory and shows it with Image.file, without zoom. That duplicates the cache Image.network already has. GestureDetector does report onScaleUpdate, so a hand-made zoom with Transform is possible, but then pan limits, double-tap and fling are all ours to write.

The repro shows a bundled receipt image: pinching it does nothing, while a GestureDetector(onScaleUpdate:) around it counts the pinches to show they reach the app (in the recording: 1 pinch, scale 5.51, receipt still at 1x).

Repro repo: https://github.com/AbdurahmanAlmehdi/dartnative-repro-interactive-viewer-image-headers

recording

Proposal

  1. Image.network(url, headers: Map<String, String>?), sent with the request and part of the cache key (Flutter's NetworkImage.headers). CanvasImage.network / precacheImage would want the same.
  2. InteractiveViewer({minScale = 0.8, maxScale = 2.5, panEnabled = true, scaleEnabled = true, boundaryMargin, required Widget child}). On iOS a UIScrollView with viewForZooming gives pinch, pan, bounce and (with a small addition) double-tap to zoom; on Android a scale/pan gesture on the child's view. TransformationController can come later.

A native zoomable image viewer widget (zoom, pan, headers) would also cover our case if that fits the framework better.

Activity

  1. gabrijm commented on Oct 4, 2026

    @gabrijm
    Contributor

    Thank you for reporting this! We’ll look into it very soon and include a fix in this week’s framework update.

  2. added
    feature
    next-release
    on Oct 4, 2026
  3. gabrijm commented on Oct 6, 2026

    @gabrijm
    Contributor

    Both are in this week's framework update: InteractiveViewer (minScale, maxScale, panEnabled, scaleEnabled, boundaryMargin, clipBehavior), with pinch, pan and fling handled natively on iPhone and Android, and Image.network(url, headers: {...}), also on NetworkImage, so precacheImage sends them too.
    With cachePolicy: ImageCachePolicy.memoryOnly, your receipts stay off the disk. TransformationController and the onInteraction callbacks will come later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixedfeaturenext-release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions