InteractiveViewer cheat sheet

Gautier Siclon
Gautier Siclon

Co-founder, Apparence.io

Flutter tips · Published on

Need to let users pan, zoom, or drag content in your Flutter app? The InteractiveViewer widget is here to help!

It makes adding interaction using simple gestures like pinching and dragging super easy.

Key Properties Explained

scaleEnabled

This controls if users can zoom in or out using pinch gestures.

  • Set to true (default) to allow scaling.
  • Set to false to turn off scaling.

constrained

This property affects how the child fits within the viewer.

  • Set to true (default) to force the child to fit inside the viewer area.
  • Set to false for free panning and zooming outside the viewer boundaries.

panEnabled

This determines if users can drag or pan the content with touch.

  • Set to true (default) to allow dragging.
  • Set to false to disable panning.

Useful Callbacks

InteractiveViewer provides callbacks to know when interaction happens.

onInteractionStart

  • This function runs when a pan or zoom starts.
  • It gives details like where the interaction began and the current scale.

onInteractionUpdate

  • This function is called continuously as the user pans or zooms.
  • It's great for tracking live gesture updates.

onInteractionEnd

  • This function runs when a pan or zoom interaction finishes.

Using these simple options, you can quickly add rich interaction to your images or other widgets in Flutter.

Save 3 months of work

One command. Pick your modules. Firebase or Supabase auto-configured. Start building what matters.

kickstarter for flutter apps

Frequently Asked Questions

What does InteractiveViewer do?

It's a Flutter widget that lets users pan, zoom, and drag content inside it using gestures like pinch and drag.

How do I disable zooming?

Set the `scaleEnabled` property to `false`.

Can I stop the user from panning?

Yes, set the `panEnabled` property to `false`.

What is the `constrained` property for?

It controls if the child content is limited to stay within the viewer's size or if users can pan/zoom outside it.

Read more
You may also be interested in
Made by ApparenceKit logo
Featured on Twelve Tools
ApparenceKit is a flutter start kit | template generator tool by Apparence.io © 2026.
All rights reserved