show method

Future<void> show(
  1. {required BuildContext context,
  2. required WidgetBuilder builder,
  3. Widget? debugRequiredFor,
  4. OverlayEntry? below}
)

Shows the RawMagnifier that this controller controls.

Returns a future that completes when the magnifier is fully shown, i.e. done with its entry animation.

To control what overlays are shown in the magnifier, utilize below. See overlayEntry for more details on how to utilize below.

If the magnifier already exists (i.e. overlayEntry != null), then show will override the old overlay and not play an exit animation. Consider awaiting hide first, to guarantee

Implementation

Future<void> show({
  required BuildContext context,
  required WidgetBuilder builder,
  Widget? debugRequiredFor,
  OverlayEntry? below,
}) async {
  _overlayEntry?.remove();
  _overlayEntry?.dispose();

  final OverlayState overlayState = Overlay.of(
    context,
    rootOverlay: true,
    debugRequiredFor: debugRequiredFor,
  );

  final CapturedThemes capturedThemes = InheritedTheme.capture(
    from: context,
    to: Navigator.maybeOf(context)?.context,
  );

  _overlayEntry = OverlayEntry(
    builder: (BuildContext context) => capturedThemes.wrap(builder(context)),
  );
  overlayState.insert(overlayEntry!, below: below);

  if (animationController != null) {
    await animationController?.forward();
  }
}