AdaptiveScrollbar constructor
AdaptiveScrollbar({
- required Widget child,
- required ScrollController controller,
- ScrollbarPosition position = ScrollbarPosition.right,
- double width = 16.0,
- Color sliderDefaultColor = Colors.blueGrey,
- Color? sliderActiveColor,
- Color bottomColor = Colors.white,
- EdgeInsetsGeometry bottomPadding = const EdgeInsets.all(0.0),
- EdgeInsetsGeometry sliderPadding = const EdgeInsets.all(2.0),
- double scrollToClickDelta = 100.0,
- int scrollToClickFirstDelay = 400,
- int scrollToClickOtherDelay = 100,
- BoxDecoration? bottomDecoration,
- 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;
}
}