TextMagnifier constructor

const TextMagnifier(
  1. {Key? key,
  2. required ValueNotifier<MagnifierInfo> magnifierInfo}
)

A Magnifier positioned by rules dictated by the native Android magnifier.

These constants and default parameters were taken from the Android 12 source code where directly transferable, and eyeballed on a Pixel 6 running Android 12 otherwise.

Positions itself based on magnifierInfo. Specifically, follows the following rules:

  • Tracks the gesture's x coordinate, but clamped to the beginning and end of the currently editing line.
  • Focal point may never contain anything out of bounds.
  • Never goes out of bounds vertically; offset until the entire magnifier is in the screen. The focal point, regardless of this transformation, always points to the touch y coordinate.
  • If just jumped between lines (prevY != currentY) then animate for duration jumpBetweenLinesAnimationDuration.

Implementation

const TextMagnifier({
  super.key,
  required this.magnifierInfo,
});