showLevitDialog<T> function

Future<T?> showLevitDialog<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. bool barrierDismissible = true,
  4. Color? barrierColor,
  5. String? barrierLabel,
  6. bool useSafeArea = true,
  7. bool useRootNavigator = true,
  8. RouteSettings? routeSettings,
  9. Offset? anchorPoint,
  10. TraversalEdgeBehavior? traversalEdgeBehavior,
})

Shows a Dialog that keeps access to the nearest Levit scope from context.

Wraps the dialog content with LScope.capture so context.levit.find still resolves page- or app-local dependencies inside the overlay route.

Implementation

Future<T?> showLevitDialog<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  bool barrierDismissible = true,
  Color? barrierColor,
  String? barrierLabel,
  bool useSafeArea = true,
  bool useRootNavigator = true,
  RouteSettings? routeSettings,
  Offset? anchorPoint,
  TraversalEdgeBehavior? traversalEdgeBehavior,
}) {
  return showDialog<T>(
    context: context,
    barrierDismissible: barrierDismissible,
    barrierColor: barrierColor,
    barrierLabel: barrierLabel,
    useSafeArea: useSafeArea,
    useRootNavigator: useRootNavigator,
    routeSettings: routeSettings,
    anchorPoint: anchorPoint,
    traversalEdgeBehavior: traversalEdgeBehavior,
    builder: (_) => LScope.capture(
      context,
      child: Builder(builder: builder),
    ),
  );
}