Interface IOverlayService
- Namespace
- Nalu
- Assembly
- Nalu.Maui.Scaffold.dll
MVVM overlay presentation: shows model-first popups and bottom sheets registered via
AddOverlay<TModel, TView>(), mirroring the navigation
engine's conventions — intents delivered to OnEnteringAsync(TIntent),
ILeavingAware and IAsyncDisposable/IDisposable honored on close, one
DI scope per presentation.
public interface IOverlayService
Remarks
Construction: the model is created via ActivatorUtilities against a provider serving
IOverlayRef; the view likewise, with the model additionally resolvable — each
constructor declares only what it needs (services, the ref, the model). Keep ONE public
constructor per model/view: multi-constructor selection is not service-aware.
The returned task completes when the overlay CLOSES, whatever the path: with the result the
model reported via CloseAsync(object?), or default on
dismissal (scrim tap, pull-down, system back, navigation). Closing from
OnEnteringAsync skips the presentation entirely — the task completes without ever
showing the overlay.
Whenever the app is not scaffold-hosted — a non-scaffold navigation host, or a platform
without scaffold hosting (Windows, Mac Catalyst) — every call is a graceful no-op
completing immediately with default: shared page models can inject and call the
service unconditionally.
Methods
ShowBottomSheetAsync<TModel>(object?, ScaffoldBottomSheetOptions?)
Shows a registered overlay model as a bottom sheet with no result; the task completes when it closes.
Task ShowBottomSheetAsync<TModel>(object? intent = null, ScaffoldBottomSheetOptions? options = null) where TModel : class
Parameters
intentobjectOptional intent delivered to the model's
OnEnteringAsync(TIntent); falls back to the parameterlessOnEnteringAsync()when no matching overload exists.optionsScaffoldBottomSheetOptionsCall-site presentation overrides (each set property wins over the view's attached values).
Returns
Type Parameters
TModelThe registered overlay model.
ShowBottomSheetAsync<TModel, TResult>(object?, ScaffoldBottomSheetOptions?)
Shows a registered overlay model as a bottom sheet and awaits its result.
Task<TResult?> ShowBottomSheetAsync<TModel, TResult>(object? intent = null, ScaffoldBottomSheetOptions? options = null) where TModel : class
Parameters
intentobjectOptional intent delivered to the model's
OnEnteringAsync(TIntent); falls back to the parameterlessOnEnteringAsync()when no matching overload exists.optionsScaffoldBottomSheetOptionsCall-site presentation overrides (each set property wins over the view's attached values).
Returns
- Task<TResult>
Type Parameters
TModelThe registered overlay model.
TResultThe result type the model reports via CloseAsync(object?).
ShowPopupAsync<TModel>(object?, ScaffoldPopupOptions?)
Shows a registered overlay model as a popup with no result; the task completes when it closes.
Task ShowPopupAsync<TModel>(object? intent = null, ScaffoldPopupOptions? options = null) where TModel : class
Parameters
intentobjectOptional intent delivered to the model's
OnEnteringAsync(TIntent); falls back to the parameterlessOnEnteringAsync()when no matching overload exists.optionsScaffoldPopupOptionsCall-site presentation overrides (each set property wins over the view's attached values).
Returns
Type Parameters
TModelThe registered overlay model.
ShowPopupAsync<TModel, TResult>(object?, ScaffoldPopupOptions?)
Shows a registered overlay model as a popup and awaits its result.
Task<TResult?> ShowPopupAsync<TModel, TResult>(object? intent = null, ScaffoldPopupOptions? options = null) where TModel : class
Parameters
intentobjectOptional intent delivered to the model's
OnEnteringAsync(TIntent); falls back to the parameterlessOnEnteringAsync()when no matching overload exists.optionsScaffoldPopupOptionsCall-site presentation overrides (each set property wins over the view's attached values).
Returns
- Task<TResult>
Type Parameters
TModelThe registered overlay model.
TResultThe result type the model reports via CloseAsync(object?).