onScaleChanged property

ValueChanged<double>? onScaleChanged
final

Callback fired when the user Ctrl+scrolls (or Cmd+scrolls on macOS) over the view while blocking is in effect, requesting a scale change.

The library calls this with the proposed new scale value, unclamped, while blocking is in effect (see blockModifierScroll). By default that is whenever this callback is non-null.

The caller should update scale in response:

onScaleChanged: (newScale) {
  setState(() => _scale = newScale.clamp(0.5, 3.0));
},

With blockModifierScroll: false, modifier+wheel scrolls the view and this callback is never called. When this is null, modifier+wheel scrolls normally, unless blockModifierScroll: true blocks it.

Implementation

final ValueChanged<double>? onScaleChanged;