flutter_permission_wizard 0.1.4
flutter_permission_wizard: ^0.1.4 copied to clipboard
Declarative permission wizard for Flutter: themeable rationale, denial, restricted, and settings flows built on permission_handler.
Changelog #
0.1.3 — Pub hygiene, deps, and docs #
Changed #
- README rewritten for a shorter, friendlier quick start while keeping the same APIs and examples.
pubspec.yaml: shorter package description (pub.dev convention), widened direct deps to current stable (permission_handler^12,app_settings^7), andflutter_lints^6.- Minor lint-driven tweaks (
wizard_session.dart,wizard_slots.dart) for a cleandart analyzeunder the latest lints.
Housekeeping #
- Example app
flutter_lintsaligned with the package.
0.1.2 — Dynamic dialog customisation #
Added #
- Per-slot builders on
PermissionRationaleandPermissionDeniedConfig: override just one section (iconBuilder,titleBuilder,descriptionBuilder,bulletsBuilder,actionsBuilder) without rewriting the whole dialog, or inject extra content above/below viaheaderBuilder/footerBuilder. - Expanded
WizardThemewith many new knobs:iconColor,barrierColor,dragHandleColortitleAlign,descriptionAlignprimaryButtonHeight,secondaryButtonHeightactionsLayout(vertical/horizontal/auto),actionsHorizontalBreakpoint,actionsSpacingsectionSpacing,dialogMaxWidth,dialogInsetPaddingiconSize,iconContainerSize,iconContainerRadiusbottomSheetInitialSize,bottomSheetMinSize,bottomSheetMaxSizetransitionBuilderfor custom dialog/sheet entry animations.
- Theme presets:
WizardTheme.compact(),WizardTheme.expressive(),WizardTheme.minimal(). WizardTheme.mergeWith(other)— layer a preset onto an app-wide base.- Public default-slot widgets (
DefaultRationaleIcon,DefaultRationaleTitle,DefaultRationaleDescription,DefaultRationaleBullets,DefaultRationaleActions,DefaultDeniedIcon,DefaultDeniedTitle,DefaultDeniedDescription,DefaultDeniedActions) for reuse from user-supplied builders. ResolvedWizardThemeextension is now exported so custom builders can reuse the same resolution helpers the wizard uses internally (resolvedPrimary,resolvedSectionSpacing,useHorizontalActions, …).- Nine new widget tests in
test/widget/dialog_customisation_test.dartcover header/footer/icon/actions/description slot overrides, theme presets,copyWith/mergeWith, and the dualOpen Settings + Retryrendering path.
Changed #
- Denied dialog/sheet/full-screen layouts now correctly render both
Open SettingsandTry Againsimultaneously when both labels are supplied (a regression introduced internally during the slot refactor — caught and locked down by a test). - Theme-driven
barrierColoris now applied to dialogs and bottom sheets created by the orchestrator.
0.1.1 — Stability hardening #
Added #
PermissionWizardController.cancel()— abort an in-flight wizard run from outside the widget tree. Resolves the pending future withCancelledResult(reason: 'cancelled_by_host').PermissionWizardController.isBusy— true while a wizard run is in flight.WizardCancelReason.cancelledByHostandWizardCancelReason.internalErrorconstants for the two new termination paths.PermissionWizard.resolveChecker(),resolveLifecycle(),resolveSettingsLauncher(), and thecachegetter — exposed so the controller and other power-user integrations can re-use the same resolution logic the static entry point uses (and therefore honour anydebugConfigure-installed fakes).- Edge-case test suite (
test/widget/edge_cases_test.dart) covering concurrent requests, app-backgrounded during rationale, limited / provisional grants,maxRetryAttempts: 0, host-driven cancellation, and dispose-during-run.
Changed #
PermissionWizardBuildernow routes status reads through the platform checker resolved byPermissionWizard, so anydebugConfigure-installed fake is honoured during tests and during composable testing.PermissionWizard.request(andrequestBatch) now trap unexpected exceptions raised inside the wizard, report them viaFlutterError.reportError, and surface aCancelledResult(reason: 'internal_error')instead of propagating — the wizard now contractually never throws to its caller.WizardSession.dispose()is idempotent; calling it while a run is in flight cancels the run and unwinds cleanly.PermissionRequestconstructor assertsmaxRetryAttempts >= 0.AppLifecycleObserverno longer adds events to a closed broadcast controller, eliminating a latent crash path in test tear-down.PermissionStateMachine.awaitingResumenow also acceptsappBackgrounded(transitioning tocancelled), so a settings round-trip that's interrupted by another background event doesn't leave the FSM stuck.
Fixed #
PermissionWizardControllerno longer leaks anAppLifecycleObserverwhen constructed with acheckerOverridebut nolifecycleOverride. Observers spawned by the controller are detached indispose.PermissionWizardController._emitis now disposal-safe — late stream events do not throw after the controller is disposed.- Settings-launcher exceptions are now caught, reported via
FlutterError.reportError, and the round-trip waiter is unblocked immediately (returnsDeniedResult(isPermanent: true)rather than hanging forever). - Removed the dead
_DefaultPlatformChecker/_LocalResolverindirection inside the controller in favour of the newPermissionWizard.resolveChecker()helper.
0.1.0 — Initial release #
First public release of flutter_permission_wizard.
Added #
PermissionWizard.request()— single-permission imperative wizard API.PermissionWizard.requestBatch()— batch wizards withcombinedandsequentialstrategies, with shared rationale support.PermissionWizardBuilder— reactive widget that exposes the currentWizardStatusplus arequestPermissioncallback.PermissionWizardController—ChangeNotifier-based controller for triggering wizards outside the widget tree, with aStream<WizardStatus>.PermissionStateMachine— pure FSM with full event history, used internally and unit-testable end-to-end.- Platform abstraction (
PlatformPermissionChecker) with concreteIosPermissionCheckerandAndroidPermissionCheckerimplementations handling iOS first-denial-is-permanent, AndroidshouldShowRequestPermissionRationale,limited/provisionalPhotos / Notification statuses, and the location-always-needs-when-in-use chained flow. - Sealed
PermissionWizardResult(Granted,Limited,Denied,Restricted,Cancelled) so callers must exhaustively handle every outcome at compile time. BatchPermissionWizardResultwithallGranted,anyGranted,grantedPermissions, anddeniedPermissions.- Three configurable presentation styles for both rationale and denied
states (
dialog,bottomSheet,fullScreen). - Optional
customBuilderescape hatch on both rationale and denied configs for fully bespoke UI while keeping the FSM in charge of flow logic. WizardThemefor fine-grained theming; full Material 3 / dark-mode inheritance from the ambientThemeDataby default.- Settings round-trip detection via
AppLifecycleObserver, with a configurablesettingsReturnDelay. - Internal
RequestQueueto serialise concurrent wizard calls. - TTL-based
PermissionCacheto de-duplicate status lookups during a single flow. PermissionWizard.debugConfigure()/debugReset()for ergonomic testing: inject a fakePlatformPermissionChecker, custom lifecycle observer, or fake settings launcher.- Observer-only callback set (
PermissionWizardCallbacks) covering every meaningful step of the flow — perfect for analytics wiring.
Tested #
- 80 unit, widget, and golden tests covering: every FSM transition, the
permission cache, request-queue serialisation, sealed-result equality,
every UI surface (rationale / denied dialogs, bottom sheets,
full-screen), the controller lifecycle, the builder widget, batch flows
in both strategies, soft / permanent denial paths, Settings
round-tripping, retry budgets, callback ordering, concurrent requests,
app-backgrounded interrupts, limited / provisional grants,
maxRetryAttempts: 0, host-driven cancellation, and dispose-during-run.