Skjár-local Overlay State

Represent diaskrás and sheets with OverlayBeiðni? and render them through SkjárOverlayHost or AnimatedSkjárOverlayHost.

Single overlay slot

Model overlay as OverlayBeiðni? and clear it to dismiss.

Diaskrá and sheet support

Use DiaskráBeiðni and BottomSheetBeiðni with optional payload data.

Back order control

Dismiss overlay first, then pop pages, via back-scope widgets.

Overlay Host Pattern

Keep overlay in state and build overlay UI through overlayBuilder.

Overlay State Rule

Animated Overlay Host

return AnimatedSkjárOverlayHost(
  overlay: _overlay,
  onDismiss: _dismissOverlay,
  overlayBuilder: (context, req, dismiss) => switch (req) {
    DiaskráBeiðni(key: 'hello') => AlertDiaskrá(
      title: const Text('Hello'),
      actions: [TextButton(onPressed: dismiss, child: const Text('Close'))],
    ),
    _ => null,
  },
  child: DeclarativePagesNavigator(
    pages: _pages,
    buildPage: _buildPage,
    onPopTop: _popTop,
    canPopTop: () => _overlay == null,
  ),
);
Important

When overlay is visible, block pop gestures with canPopTop to avoid back-swipe inconsistency on iOS.