ensureTableVisibility method
Future<void>
ensureTableVisibility({
- double alignment = 0.0,
- Duration duration = Duration.zero,
- Curve curve = Curves.ease,
- ScrollPositionAlignmentPolicy alignmentPolicy = ScrollPositionAlignmentPolicy.explicit,
Scroll to the table in the vertical axis.
See also:
- ScrollPosition.ensureVisible to understand the parameters.
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,
);
}