RawScrollbar constructor Null safety

const RawScrollbar(
  1. {Key? key,
  2. required Widget child,
  3. ScrollController? controller,
  4. bool? thumbVisibility,
  5. OutlinedBorder? shape,
  6. Radius? radius,
  7. double? thickness,
  8. Color? thumbColor,
  9. double minThumbLength = _kMinThumbExtent,
  10. double? minOverscrollLength,
  11. bool? trackVisibility,
  12. Radius? trackRadius,
  13. Color? trackColor,
  14. Color? trackBorderColor,
  15. Duration fadeDuration = _kScrollbarFadeDuration,
  16. Duration timeToFade = _kScrollbarTimeToFade,
  17. Duration pressDuration = Duration.zero,
  18. ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
  19. bool? interactive,
  20. ScrollbarOrientation? scrollbarOrientation,
  21. double mainAxisMargin = 0.0,
  22. double crossAxisMargin = 0.0,
  23. EdgeInsets? padding,
  24. @Deprecated('Use thumbVisibility instead. ' 'This feature was deprecated after v2.9.0-1.0.pre.') bool? isAlwaysShown}
)

Creates a basic raw scrollbar that wraps the given child.

The child, or a descendant of the child, should be a source of ScrollNotification notifications, typically a Scrollable widget.

The child, fadeDuration, pressDuration, and timeToFade arguments must not be null.

Implementation

const RawScrollbar({
  super.key,
  required this.child,
  this.controller,
  this.thumbVisibility,
  this.shape,
  this.radius,
  this.thickness,
  this.thumbColor,
  this.minThumbLength = _kMinThumbExtent,
  this.minOverscrollLength,
  this.trackVisibility,
  this.trackRadius,
  this.trackColor,
  this.trackBorderColor,
  this.fadeDuration = _kScrollbarFadeDuration,
  this.timeToFade = _kScrollbarTimeToFade,
  this.pressDuration = Duration.zero,
  this.notificationPredicate = defaultScrollNotificationPredicate,
  this.interactive,
  this.scrollbarOrientation,
  this.mainAxisMargin = 0.0,
  this.crossAxisMargin = 0.0,
  this.padding,
  @Deprecated(
    'Use thumbVisibility instead. '
    'This feature was deprecated after v2.9.0-1.0.pre.',
  )
  this.isAlwaysShown,
}) : assert(child != null),
     assert(
       thumbVisibility == null || isAlwaysShown == null,
       'Scrollbar thumb appearance should only be controlled with thumbVisibility, '
       'isAlwaysShown is deprecated.'
     ),
     assert(
       !((thumbVisibility == false || isAlwaysShown == false) && (trackVisibility ?? false)),
       'A scrollbar track cannot be drawn without a scrollbar thumb.'
     ),
     assert(minThumbLength != null),
     assert(minThumbLength >= 0),
     assert(minOverscrollLength == null || minOverscrollLength <= minThumbLength),
     assert(minOverscrollLength == null || minOverscrollLength >= 0),
     assert(fadeDuration != null),
     assert(radius == null || shape == null),
     assert(timeToFade != null),
     assert(pressDuration != null),
     assert(mainAxisMargin != null),
     assert(crossAxisMargin != null);