getScrollPhysics method

ScrollPhysics getScrollPhysics(
  1. BuildContext context

The scroll physics to use for the platform given by getPlatform.

Defaults to RangeMaintainingScrollPhysics mixed with BouncingScrollPhysics on iOS and ClampingScrollPhysics on Android.


ScrollPhysics getScrollPhysics(BuildContext context) {
  // When modifying this function, consider modifying the implementation in
  // the Material and Cupertino subclasses as well.
  switch (getPlatform(context)) {
    case TargetPlatform.iOS:
      return _bouncingPhysics;
    case TargetPlatform.macOS:
      return _bouncingDesktopPhysics;
    case TargetPlatform.fuchsia:
    case TargetPlatform.linux:
      return _clampingPhysics;