InteractiveViewer constructor Null safety

InteractiveViewer(
  1. {Key? key,
  2. Clip clipBehavior,
  3. bool alignPanAxis,
  4. EdgeInsets boundaryMargin,
  5. bool constrained,
  6. double maxScale,
  7. double minScale,
  8. GestureScaleEndCallback? onInteractionEnd,
  9. GestureScaleStartCallback? onInteractionStart,
  10. GestureScaleUpdateCallback? onInteractionUpdate,
  11. bool panEnabled,
  12. bool scaleEnabled,
  13. TransformationController? transformationController,
  14. required Widget child}
)

Create an InteractiveViewer.

The child parameter must not be null.

Implementation

InteractiveViewer({
  Key? key,
  this.clipBehavior = Clip.hardEdge,
  this.alignPanAxis = false,
  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.onInteractionEnd,
  this.onInteractionStart,
  this.onInteractionUpdate,
  this.panEnabled = true,
  this.scaleEnabled = true,
  this.transformationController,
  required Widget this.child,
}) : assert(alignPanAxis != null),
     assert(child != null),
     assert(constrained != null),
     assert(minScale != null),
     assert(minScale > 0),
     assert(minScale.isFinite),
     assert(maxScale != null),
     assert(maxScale > 0),
     assert(!maxScale.isNaN),
     assert(maxScale >= minScale),
     assert(panEnabled != null),
     assert(scaleEnabled != null),
     // 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,
     super(key: key);