getScrollPhysics method

  1. @override
ScrollPhysics getScrollPhysics(
  1. BuildContext context
)
override

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

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

Implementation

@override
ScrollPhysics getScrollPhysics(BuildContext context) {
  // When modifying this function, consider modifying the implementation in
  // the base class ScrollBehavior as well.
  if (getPlatform(context) == TargetPlatform.macOS) {
    return const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast);
  }
  return const BouncingScrollPhysics();
}