AdaptiveScrollbar constructor

AdaptiveScrollbar({
  1. required Widget child,
  2. required ScrollController controller,
  3. ScrollbarPosition position = ScrollbarPosition.right,
  4. double width = 16.0,
  5. double? sliderHeight,
  6. Widget? sliderChild,
  7. Color sliderDefaultColor = Colors.blueGrey,
  8. Color? sliderActiveColor,
  9. Color underColor = Colors.white,
  10. EdgeInsetsGeometry underSpacing = const EdgeInsets.all(0.0),
  11. EdgeInsetsGeometry sliderSpacing = const EdgeInsets.all(2.0),
  12. double scrollToClickDelta = 100.0,
  13. int scrollToClickFirstDelay = 400,
  14. int scrollToClickOtherDelay = 100,
  15. BoxDecoration? underDecoration,
  16. BoxDecoration? sliderDecoration,
  17. BoxDecoration? sliderActiveDecoration,
})

Wraps your child widget that contains ScrollView object, takes the position indicated by position and tracks scrolls only of this ScrollView, via the specified controller.

Implementation

AdaptiveScrollbar({
  required this.child,
  required this.controller,
  this.position = ScrollbarPosition.right,
  this.width = 16.0,
  this.sliderHeight,
  this.sliderChild,
  this.sliderDefaultColor = Colors.blueGrey,
  Color? sliderActiveColor,
  this.underColor = Colors.white,
  this.underSpacing = const EdgeInsets.all(0.0),
  this.sliderSpacing = const EdgeInsets.all(2.0),
  this.scrollToClickDelta = 100.0,
  this.scrollToClickFirstDelay = 400,
  this.scrollToClickOtherDelay = 100,
  BoxDecoration? underDecoration,
  BoxDecoration? sliderDecoration,
  BoxDecoration? sliderActiveDecoration,
})  : assert(sliderSpacing.horizontal < width),
      assert(width > 0),
      assert(scrollToClickDelta >= 0),
      assert(scrollToClickFirstDelay >= 0),
      assert(scrollToClickOtherDelay >= 0) {
  if (sliderActiveColor == null) {
    this.sliderActiveColor = sliderDefaultColor.withRed(10);
  } else {
    this.sliderActiveColor = sliderActiveColor;
  }

  if (underDecoration == null) {
    this.underDecoration =
        BoxDecoration(shape: BoxShape.rectangle, color: underColor);
  } else {
    this.underDecoration = underDecoration;
  }

  if (sliderDecoration == null) {
    this.sliderDecoration =
        BoxDecoration(shape: BoxShape.rectangle, color: sliderDefaultColor);
  } else {
    this.sliderDecoration = sliderDecoration;
  }

  if (sliderActiveDecoration == null) {
    this.sliderActiveDecoration = BoxDecoration(
        shape: BoxShape.rectangle, color: this.sliderActiveColor);
  } else {
    this.sliderActiveDecoration = sliderActiveDecoration;
  }
}