DocumentMagnifierBuilder typedef

DocumentMagnifierBuilder = Widget Function(BuildContext, Key magnifierKey, LeaderLink focalPoint, bool isVisible)

Builds a full-screen magnifier display, with the magnifier following the given focalPoint, and with the magnifier attached to the given magnifierKey.

The visible parameter is used to let the magnifier animate its appearance and disappearance. For example, visible can be false and the magnifier can still be present in the widget tree while an exit animation runs. Upon animation end, the widget bound to magnifierKey should be removed from the widget tree. If an animation isn't desired, a SizedBox can be returned when visible is false.

The magnifierKey is used to find the magnifier in the widget tree for various purposes, e.g., within tests to verify the presence or absence of a magnifier. If your builder chooses not to build a magnifier, e.g., returns a SizedBox() instead of a magnifier, then you shouldn't use the magnifierKey.

The magnifierKey must be attached to the magnifier, not the top-level widget returned from this builder, because the magnifierKey might be used to verify the size and location of the magnifier. For example:

Widget buildMagnifier(context, magnifierKey, focalPoint) {
  return Follower(
    link: focalPoint,
    child: Magnifier(
      key: magnifierKey,
      width: 100,
      height: 42,
      magnification: 1.5,
    ),
  );
}

Implementation

typedef DocumentMagnifierBuilder = Widget Function(
    BuildContext, Key magnifierKey, LeaderLink focalPoint, bool isVisible);