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