ZoomViewer class

A widget that makes its child zoomable with pinch and pan gestures.

This widget wraps any child widget and allows it to be zoomed in/out using pinch gestures and panned around, similar to how images work in a gallery app.

Example:

ZoomViewer(
  minScale: 0.5,
  maxScale: 4.0,
  child: Container(
    width: 200,
    height: 200,
    color: Colors.blue,
  ),
)
Inheritance

Constructors

ZoomViewer({Key? key, required Widget child, double minScale = 0.5, double maxScale = 4.0, double initialScale = 1.0, bool enablePan = true, Color? backgroundColor, ValueChanged<double>? onScaleChanged, bool resetOnDoubleTap = true, Duration animationDuration = const Duration(milliseconds: 300), bool clipBehavior = true})
const

Properties

animationDuration Duration
Duration for reset animation. Default is 300ms
final
backgroundColor Color?
Background color behind the zoomable widget
final
child Widget
The widget to make zoomable
final
clipBehavior bool
Whether to clip the child widget. Default is true
final
enablePan bool
Whether to enable panning. Default is true
final
hashCode int
The hash code for this object.
no setterinherited
initialScale double
Initial scale factor. Default is 1.0 (100%)
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxScale double
Maximum scale factor. Default is 4.0 (400%)
final
minScale double
Minimum scale factor. Default is 0.5 (50%)
final
onScaleChanged ValueChanged<double>?
Called when scale changes
final
resetOnDoubleTap bool
Reset to initial state when double tapped. Default is true
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ZoomViewer>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited