InteractiveViewer constructor
- Key? key,
- Clip clipBehavior = Clip.hardEdge,
- PanAxis panAxis = PanAxis.free,
- EdgeInsets boundaryMargin = EdgeInsets.zero,
- bool constrained = true,
- double maxScale = 2.5,
- double minScale = 0.8,
- double interactionEndFrictionCoefficient = _kDrag,
- GestureScaleEndCallback? onInteractionEnd,
- GestureScaleStartCallback? onInteractionStart,
- GestureScaleUpdateCallback? onInteractionUpdate,
- bool panEnabled = true,
- bool scaleEnabled = true,
- double scaleFactor = kDefaultMouseScrollToScaleFactor,
- TransformationController? transformationController,
- Alignment? alignment,
- bool trackpadScrollCausesScale = false,
- required Widget child,
Create an InteractiveViewer.
Implementation
InteractiveViewer({
super.key,
this.clipBehavior = Clip.hardEdge,
this.panAxis = PanAxis.free,
this.boundaryMargin = EdgeInsets.zero,
this.constrained = true,
// These default scale values were eyeballed as reasonable limits for common
// use cases.
this.maxScale = 2.5,
this.minScale = 0.8,
this.interactionEndFrictionCoefficient = _kDrag,
this.onInteractionEnd,
this.onInteractionStart,
this.onInteractionUpdate,
this.panEnabled = true,
this.scaleEnabled = true,
this.scaleFactor = kDefaultMouseScrollToScaleFactor,
this.transformationController,
this.alignment,
this.trackpadScrollCausesScale = false,
required Widget this.child,
}) : assert(minScale > 0),
assert(interactionEndFrictionCoefficient > 0),
assert(minScale.isFinite),
assert(maxScale > 0),
assert(!maxScale.isNaN),
assert(maxScale >= minScale),
// boundaryMargin must be either fully infinite or fully finite, but not
// a mix of both.
assert(
(boundaryMargin.horizontal.isInfinite
&& boundaryMargin.vertical.isInfinite) || (boundaryMargin.top.isFinite
&& boundaryMargin.right.isFinite && boundaryMargin.bottom.isFinite
&& boundaryMargin.left.isFinite),
),
builder = null;