onZoomFactorChanged method

  1. @override
void onZoomFactorChanged(
  1. covariant ZoomController controller,
  2. ScaleUpdateDetails details
)
override

Triggered when the day view zoom factor has changed.

Implementation

@override
void onZoomFactorChanged(ZoomController controller, ScaleUpdateDetails details) {
  if (!mounted) {
    return;
  }

  double hourRowHeight = _calculateHourRowHeight(controller);
  double widgetHeight = (context.findRenderObject() as RenderBox).size.height;
  double maxPixels = calculateHeight(hourRowHeight) - widgetHeight + widget.style.headerSize;

  if (verticalScrollController != null) {
    verticalScrollController!.jumpTo(math.min(maxPixels, controller.contentOffset * controller.zoomFactor - details.localFocalPoint.dy));
  }

  setState(() {
    this.hourRowHeight = hourRowHeight;
  });
}