AdaptiveScrollbar constructor

AdaptiveScrollbar({
  1. required Widget child,
  2. required ScrollController controller,
  3. ScrollbarPosition position = ScrollbarPosition.right,
  4. double width = 16.0,
  5. Color sliderDefaultColor = Colors.blueGrey,
  6. Color? sliderActiveColor,
  7. Color bottomColor = Colors.white,
  8. EdgeInsetsGeometry bottomPadding = const EdgeInsets.all(0.0),
  9. EdgeInsetsGeometry sliderPadding = const EdgeInsets.all(2.0),
  10. double scrollToClickDelta = 100.0,
  11. int scrollToClickFirstDelay = 400,
  12. int scrollToClickOtherDelay = 100,
  13. BoxDecoration? bottomDecoration,
  14. BoxDecoration? sliderDecoration,
})

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.sliderDefaultColor = Colors.blueGrey,
  Color? sliderActiveColor,
  this.bottomColor = Colors.white,
  this.bottomPadding = const EdgeInsets.all(0.0),
  this.sliderPadding = const EdgeInsets.all(2.0),
  this.scrollToClickDelta = 100.0,
  this.scrollToClickFirstDelay = 400,
  this.scrollToClickOtherDelay = 100,
  BoxDecoration? bottomDecoration,
  BoxDecoration? sliderDecoration,
})  : assert(sliderPadding.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 (bottomDecoration == null) {
    this.bottomDecoration =
        BoxDecoration(shape: BoxShape.rectangle, color: bottomColor);
  } else {
    this.bottomDecoration = bottomDecoration;
  }

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