Basic Syntax of InteractiveViewer Widget
InteractiveViewer(
child: YourChildWidget(),
boundaryMargin: EdgeInsets.all(0.0), // Optional: Margin around the content
minScale: 1.0, // Optional: Minimum scale (zoom out)
maxScale: 3.0, // Optional: Maximum scale (zoom in)
scaleEnabled: true, // Optional: Allow scaling (zooming)
panEnabled: true, // Optional: Allow panning (dragging)
alignPanAxis: false, // Optional: Align panning to one axis
)
Flutter – Zoom In and Zoom Out an Image
In this article we are using the InteractiveViewer widget in Flutter allows you to create interactive and zoomable widgets. It’s commonly used for displaying images, maps, or any content that the user can zoom, and interact with. In this article, we are going to implement the InteractiveViewer widget. A sample video is given below to get an idea about what we are going to do in this article.