setScrollbarControllers method
void
setScrollbarControllers()
Set the scrollbar controllers.
Instead of overriding this function, consider to override getScrollbarController instead to provide a custom scrollbar controller, without the need to provide an own TransformScrollbarWidgetInterface.
Implementation
void setScrollbarControllers() {
if (!widget.showScrollbars) {
if (scrollbarController != null) {
scrollbarController!.dispose();
}
scrollbarController = null;
return;
}
scrollbarController ??= getScrollbarController(
vsync: this,
controlInterface: CustomTransformScrollbarWidgetInterface(
fgetTransform: () => transformationController!.value,
fgetViewport: () => widgetViewport.size,
fgetContent: () => childBoundaryRect.size,
fcontext: () => context,
fjumpVertical: (v) {
transformationController!.value = matrixTranslate(
transformationController!.value,
Offset(0, v / transformationController!.value.getScaleOnZAxis()));
},
fjumpHorizontal: (h) {
transformationController!.value = matrixTranslate(
transformationController!.value,
Offset(h / transformationController!.value.getScaleOnZAxis(), 0));
},
fanimateVertical: (v, d, c) {
Matrix4 newTransform = matrixTranslate(
transformationController!.value,
Offset(
0, -v / transformationController!.value.getScaleOnZAxis()));
animateTo(newTransform, duration: d, curve: c, noZoom: true);
},
fanimateHorizontal: (h, d, c) {
Matrix4 newTransform = matrixTranslate(
transformationController!.value,
Offset(
-h / transformationController!.value.getScaleOnZAxis(), 0));
animateTo(newTransform, duration: d, curve: c, noZoom: true);
},
),
);
}