Replace inner Navigator with Overlay (fixes #31, #35) — v5.0.0#38
Draft
tomalabaster wants to merge 1 commit into
Draft
Replace inner Navigator with Overlay (fixes #31, #35) — v5.0.0#38tomalabaster wants to merge 1 commit into
tomalabaster wants to merge 1 commit into
Conversation
AppLock now layers lock and inactive screens via OverlayEntry instead of a nested Navigator, fixing Hero animations (#31) and Android back navigation after dialogs (#35). - Imperative overlay sync with first-frame initialEntries - Defer background lock until app resumes when timer fires off-screen - Offstage app content when lock or inactive overlay is visible - Remove deprecated lockScreen, enabled, and backgroundLockLatency APIs - Add overlay and navigation regression tests - Extend example app with Hero and dialog/back demos Co-authored-by: Tom Alabaster <tomalabasteruk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Revives the overlay-based approach from
feature/#31_-_use_overlay_instead_of_navigator, rebased onto currentdevelop(4.3.0), as a 5.0.0 release.AppLockno longer wraps the app in a nestedNavigator. Lock and inactive screens are layered viaOverlayEntryinstead, leavingMaterialApp's navigator as the sole route stack.Fixes
Architecture
Notable implementation details
_syncOverlays()path; avoids mixinginitialEntrieswith manual insert/remove (root cause of iOS background-lock bugs on the old WIP branch)resumed(addresses iOS reports on After implementing AppLock, the device back button closes the app instead of returning to the previous screen (Android) #35)Offstageapp content — when lock or inactive overlay is visible, app content stays mounted (maintainState) but is offstage, matching prior navigator semantics for tests and state preservationlockScreen,enabled, andbackgroundLockLatencyconstructor parameters (slated for 5.0.0)Test plan
test/src/app_lock_overlay_test.dart):InactiveBehavior.alwaysShowwhen disabledflutter analyzecleanExample app adds Hero test and Dialog then back test buttons for manual QA.
Migration (4.x → 5.0)
No integration pattern change — still use
MaterialApp.builder. Replace any remaining deprecated constructor args:lockScreenlockScreenBuilderenabledinitiallyEnabledbackgroundLockLatencyinitialBackgroundLockLatencyCloses #31, #35