ensureVisible method

  1. @override
Future<void> ensureVisible(
  1. RenderObject object, {
  2. double alignment = 0.0,
  3. Duration duration = Duration.zero,
  4. Curve curve = Curves.ease,
  5. ScrollPositionAlignmentPolicy alignmentPolicy = ScrollPositionAlignmentPolicy.explicit,
  6. RenderObject? targetRenderObject,
})
override

Animates the position such that the given object is as visible as possible by just scrolling this position.

The optional targetRenderObject parameter is used to determine which area of that object should be as visible as possible. If targetRenderObject is null, the entire RenderObject (as defined by its RenderObject.paintBounds) will be as visible as possible. If targetRenderObject is provided, it must be a descendant of the object.

See also:

Implementation

@override
Future<void> ensureVisible(
  RenderObject object, {
  double alignment = 0.0,
  Duration duration = Duration.zero,
  Curve curve = Curves.ease,
  ScrollPositionAlignmentPolicy alignmentPolicy =
      ScrollPositionAlignmentPolicy.explicit,
  RenderObject? targetRenderObject,
}) {
  // Since the _PagePosition is intended to cover the available space within
  // its viewport, stop trying to move the target render object to the center
  // - otherwise, could end up changing which page is visible and moving the
  // targetRenderObject out of the viewport.
  return super.ensureVisible(
    object,
    alignment: alignment,
    duration: duration,
    curve: curve,
    alignmentPolicy: alignmentPolicy,
    targetRenderObject: null,
  );
}