InteractiveViewer constructor

InteractiveViewer(
  1. {Key? key,
  2. Clip clipBehavior = Clip.hardEdge,
  3. @Deprecated('Use panAxis instead. ' 'This feature was deprecated after v3.3.0-0.5.pre.') bool alignPanAxis = false,
  4. PanAxis panAxis = PanAxis.free,
  5. EdgeInsets boundaryMargin = EdgeInsets.zero,
  6. bool constrained = true,
  7. double maxScale = 2.5,
  8. double minScale = 0.8,
  9. double interactionEndFrictionCoefficient = _kDrag,
  10. GestureScaleEndCallback? onInteractionEnd,
  11. GestureScaleStartCallback? onInteractionStart,
  12. GestureScaleUpdateCallback? onInteractionUpdate,
  13. bool panEnabled = true,
  14. bool scaleEnabled = true,
  15. double scaleFactor = kDefaultMouseScrollToScaleFactor,
  16. TransformationController? transformationController,
  17. Alignment? alignment,
  18. bool trackpadScrollCausesScale = false,
  19. required Widget child}
)

Create an InteractiveViewer.

Implementation

InteractiveViewer({
  super.key,
  this.clipBehavior = Clip.hardEdge,
  @Deprecated(
    'Use panAxis instead. '
    'This feature was deprecated after v3.3.0-0.5.pre.',
  )
  this.alignPanAxis = false,
  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;