ensureTableVisibility method

Future<void> ensureTableVisibility({
  1. double alignment = 0.0,
  2. Duration duration = Duration.zero,
  3. Curve curve = Curves.ease,
  4. ScrollPositionAlignmentPolicy alignmentPolicy = ScrollPositionAlignmentPolicy.explicit,
})

Scroll to the table in the vertical axis.

See also:

Implementation

Future<void> ensureTableVisibility({
  double alignment = 0.0,
  Duration duration = Duration.zero,
  Curve curve = Curves.ease,
  ScrollPositionAlignmentPolicy alignmentPolicy =
      ScrollPositionAlignmentPolicy.explicit,
}) async {
  // If this controller is not attached, do nothing.
  if (!isAttached) {
    return;
  }

  // Find the render objects that represents this table.
  final tableRenderObject = _internalContext!
      .findRootAncestorStateOfType<SliverSwayzeTableState>()!
      .context
      .findRenderObject()!;

  // Scroll to the render object.
  return verticalScrollController!.position.ensureVisible(
    tableRenderObject,
    alignment: alignment,
    duration: duration,
    curve: curve,
    alignmentPolicy: alignmentPolicy,
  );
}