scrollByPixels method

  1. @override
Future<bool> scrollByPixels(
  1. double pixels
)
override

Coarse step on alignment requests, with a refuse-small-delta guard.

Implementation

@override
Future<bool> scrollByPixels(double pixels) async {
  final mag = pixels.abs();
  if (mag < 1) return false;
  final snap = captureSnapshot();
  if (snap != null) {
    final dominant = planScrollables(snap).dominant;
    if (dominant != null) {
      final pageStep = scrollsHorizontally(dominant)
          ? dominant.bounds.width
          : dominant.bounds.height;
      if (pageStep > 0 && mag < pageStep * 0.7) return false;
    }
  }
  return pixels > 0 ? stepForward() : stepBackward();
}