scrollToIndex method

Future<void> scrollToIndex(
  1. int index, {
  2. Duration duration = const Duration(milliseconds: 250),
  3. Curve curve = Curves.linearToEaseOut,
  4. double alignment = 0,
  5. double offset = 0,
})

Scrolls to a specific index in the message list.

Implementation

Future<void> scrollToIndex(
  int index, {
  Duration duration = const Duration(milliseconds: 250),
  Curve curve = Curves.linearToEaseOut,

  /// Desired position of the message in viewport [0.0, 1.0].
  /// 0 = top, 0.5 = middle, 1 = bottom
  double alignment = 0,
  double offset = 0,
}) {
  if (_scrollToIndex == null) {
    return Future.value();
  }

  return (_scrollToIndex as ScrollToIndex)(
    index,
    duration: duration,
    curve: curve,
    alignment: alignment,
    offset: offset,
  );
}