What are outlets?
Outlets are widgets that render presentations. They watch a specific surface and rebuild when the active item changes. Outlets contain zero business logic. They just render what the engine tells them to show.Basic outlet
The simplest outlet usesPresentumOutlet:
SizedBox.shrink() by default.
Custom placeholder
Provide a custom widget when nothing is shown:Composition outlets
PresentumOutlet$Composition gives you access to both active and queued items:
Composition outlets are useful for showing βnext upβ indicators or carousels.
Multi-surface composition
Combine items from multiple surfaces:Cross-presentum composition with animations
PresentumOutlet$Composition2 supports combining items from different Presentum instances (cross-universe composition), allowing seamless coordination between multiple presentation systems with smooth animated transitions.
Production example
Hereβs a real-world outlet that combines campaigns and feature flags, showing the highest-priority item with smooth fade and size transitions:How it works
-
Cross-universe composition: Combines items from two separate Presentum instances:
- Campaign presentations (
CampaignPresentumItem) - Feature flag presentations (
FeatureItem)
- Campaign presentations (
- Priority resolution: The resolver merges both lists and sorts by priority, selecting only the highest-priority item to display
-
Animated transitions:
FadeSizeTransitionSwitcherprovides smooth animations when:- A campaign is dismissed and a feature banner appears
- A feature is disabled and a campaign takes its place
- Items change priority dynamically
Smooth transition widget
TheFadeSizeTransitionSwitcher combines fade and size animations:
Key benefits
Seamless coordination
Multiple Presentum instances can compete for the same UI slot without conflicts. The outlet handles priority resolution automatically.
Smooth transitions
When one banner is dismissed, the next highest-priority item smoothly animates
in with fade and size transitions.
Declarative priority
Priority logic is centralized in the resolver. Guards donβt need to know about
other presentation types.
Type-safe composition
Despite combining different item types, the outlet remains type-safe with pattern matching.
Popup hosts
For dialogs and overlays, use a popup host that watches a surface and shows dialogs:Accessing Presentum
Inside outlets, access the Presentum instance via context:Inherited widgets
InheritedPresentumItem
Outlets automatically wrap builders withInheritedPresentumItem, giving child widgets access to the current item:
Outlet patterns
Conditional rendering
With animations
Async loading
Best practices
No business logic in outlets
No business logic in outlets
Donβt check eligibility, fetch data, or make decisions in outlets. That belongs in guards.Bad:Good:
Keep builders lightweight
Keep builders lightweight
Outlets rebuild when state changes. Keep builders fast and simple.
Use InheritedPresentumItem for deep trees
Use InheritedPresentumItem for deep trees
When you have complex widget hierarchies, use the inherited item instead of prop drilling:
Common patterns
Banner outlet
Card outlet with actions
Next steps
Building outlets guide
Step-by-step outlet creation
Popup hosts
Advanced dialog management
Auto-tracking
Automatic impression tracking
Production example
See real popup host