copyWith method Null safety

ScrollBehavior copyWith(
  1. {bool scrollbars = true,
  2. bool overscroll = true,
  3. Set<PointerDeviceKind>? dragDevices,
  4. ScrollPhysics? physics,
  5. TargetPlatform? platform}
)

Creates a copy of this ScrollBehavior, making it possible to easily toggle scrollbar and overscrollIndicator effects.

This is used by widgets like PageView and ListWheelScrollView to override the current ScrollBehavior and manage how they are decorated. Widgets such as these have the option to provide a ScrollBehavior on the widget level, like PageView.scrollBehavior, in order to change the default.

Implementation

ScrollBehavior copyWith({
  bool scrollbars = true,
  bool overscroll = true,
  Set<PointerDeviceKind>? dragDevices,
  ScrollPhysics? physics,
  TargetPlatform? platform,
}) {
  return _WrappedScrollBehavior(
    delegate: this,
    scrollbar: scrollbars,
    overscrollIndicator: overscroll,
    physics: physics,
    platform: platform,
    dragDevices: dragDevices,
  );
}