enum CampaignSurface with PresentumSurface { popup, // Fullscreen dialogs and modals watchlistHeader, // Banner at top of watchlist watchlistFooter, // Banner at bottom of watchlist menuTile; // Tile in navigation menu}
// Both target the same surface but different stylesPresentumOption( surface: AppSurface.popup, variant: CampaignVariant.fullscreenDialog, // ...)PresentumOption( surface: AppSurface.popup, variant: CampaignVariant.dialog, // ...)
PresentumOption is generic and must be extended with a concrete implementation.
For example, create CampaignOption extends PresentumOption<CampaignSurface, CampaignVariant>.
class SequencingGuard extends CampaignGuard { @override FutureOr<PresentumState> call( storage, history, state, candidates, context, ) async { // Show popup only after header is dismissed final headerSlot = state.slots[CampaignSurface.watchlistHeader]; final headerActive = headerSlot?.active != null; for (final candidate in candidates) { if (candidate.surface == CampaignSurface.popup && headerActive) { continue; // Don't show popup while header is active } state.setActive(candidate.surface, candidate); } return state; }}