showSafaehAnchored<T> function

Future<T?> showSafaehAnchored<T>({
  1. required BuildContext context,
  2. Widget? child,
  3. Widget childBuilder(
    1. BuildContext context,
    2. double progress
    )?,
  4. SafaehAnchoredMotion motion = SafaehAnchoredMotion.drop,
  5. LayerLink? link,
  6. Rect? sourceRect,
  7. bool opensAbove = false,
  8. ShapeBorder sourceShape = const CircleBorder(),
  9. double maxCardWidth = 420,
  10. bool barrierDismissible = true,
})

Opens child from an anchor with motion.

Pass link so the card follows a live target. sourceRect places the drop card and cuts the genie scrim hole. The host owns the card.

Implementation

Future<T?> showSafaehAnchored<T>({
  required BuildContext context,
  Widget? child,
  Widget Function(BuildContext context, double progress)? childBuilder,
  SafaehAnchoredMotion motion = SafaehAnchoredMotion.drop,
  LayerLink? link,
  Rect? sourceRect,
  bool opensAbove = false,
  ShapeBorder sourceShape = const CircleBorder(),
  double maxCardWidth = 420,
  bool barrierDismissible = true,
}) {
  assert(child != null || childBuilder != null);
    if (motion == SafaehAnchoredMotion.genie) SafaehGenieShader.preload();
    final captured = sourceRect;
    final barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel;
    return Navigator.of(context, rootNavigator: true).push<T>(
      _AnchoredRoute<T>(
        motion: motion,
        link: link,
        sourceRect: captured,
        opensAbove: opensAbove,
        sourceShape: sourceShape,
        maxCardWidth: maxCardWidth,
        dismissible: barrierDismissible,
        barrierLabel: barrierLabel,
        child: child,
        childBuilder: childBuilder,
      ),
    );
}