hud_overlay 0.1.1
hud_overlay: ^0.1.1 copied to clipboard
A state-management-agnostic, accessibility-first, context-optional Flutter loading overlay. Works in widget trees, BLoC, Riverpod, and service layers with zero boilerplate.
Changelog #
0.1.1 #
- Fix
homepage,repository, andissue_trackerURLs inpubspec.yaml.
0.1.0 #
Initial release.
Core #
- Context-optional API —
HudServiceshows/dismisses overlays from anywhere (BLoC, Riverpod, service layers) with noBuildContext, while theHudOverlaywidget covers any subtree when you prefer a context-aware API. HudScopehosts its ownOverlay, so it works regardless of placement.- Loading states — indeterminate spinner, deterministic
progress, and success / error / info transitions. - Helpers —
wrap()shows a spinner for the lifetime of aFutureand flips to success/error automatically;trackStream()drives determinate progress from aStream<double>. - Named-key stacking — multiple independent overlays via
key, plusdismissAll(). - Navigation auto-dismiss via
HudService.navigatorObserver+HudScope.autoDismissOnNavigation.
Customization #
HudThemecontrols barrier color, blur (frosted glass), card decoration and padding, indicator, position (top/center/bottom), animation duration and curve, andmessageStyle/detailStyletext styling.- Theme presets —
HudTheme.light()andHudTheme.dark()factory constructors, composable withcopyWith. - Custom state widgets —
successWidget,errorWidget,infoWidget. - Secondary detail line —
detailonHudOverlay,HudService.show,HudOverlayContent, andHudStatus. - Cancel button —
onCancel+cancelLabel, styled viaHudTheme.cancelButtonStyle.
Behavior #
- Grace period —
HudTheme.gracePerioddelays the fade-in so very fast operations never flash; a dismiss during the grace window cancels silently. - Minimum show duration —
HudTheme.minShowDurationprevents flicker by keeping the overlay up for a minimum time once shown. - Length-based auto-dismiss — when
autoDismissis omitted for success/error/info, the duration is derived from the message length (floored at 1.5 s, capped at 5 s). - Haptic feedback —
HudTheme.enableHapticsfires a light impact on success/info and a heavy impact on error. - Interactive (non-blocking) mode —
HudTheme.interactivelets touches pass through to the UI beneath the overlay.
Accessibility #
- First-class semantics: screen-reader announcements,
liveRegion, and aSemanticsRole.progressBar(with value/min/max) for determinate progress.