Repository navigation
Conversation
nativeapi has no show/hide window event, so 0.5.x code that pauses and
resumes work on onWindowEvent('show'/'hide') went silent under the
legacy bridge. show() and hide() now emit those events when the call
actually changes the window's visibility, re-checked after the native
call. When hiding, a minimized window counts as shown, since macOS
reports it as not visible. Visibility changes made outside the legacy
API are still not reported: nativeapi offers no event for them.
A minimized window that is maximized comes back with a maximized event
alone, which left the bridge believing it was still minimized, so the
next restored event was reported as restore instead of unmaximize. A
maximized event now clears the minimized flag, and a restored event
re-reads isMaximized from the window instead of guessing.
Adds a @VisibleForTesting debugBindWindow so the bridge can be driven
by a simulated nativeapi.Window in tests.
This was referenced Nov 10, 2026
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.
Problem
Two gaps in the 0.5.x bridge (
package:window_manager/legacy.dart):show/hideevents. nativeapi has no show/hide window event, so code that pauses and resumes work ononWindowEvent('show' / 'hide')never hears about it under the bridge.restoreinstead ofunmaximize.Change
show()/hide()emitonWindowEvent('show' / 'hide')only when the call actually changes the window's visibility, re-checked after the native call (a refused or no-op change emits nothing). When hiding, a minimized window counts as shown, since macOS reports it as not visible. Visibility changes made outside the legacy API are still not reported, as nativeapi offers no event for them.isMaximizedfrom the window instead of guessing.@visibleForTesting debugBindWindow(nativeapi.Window?)lets tests drive the bridge with a simulatednativeapi.Window.Tests
New
test/legacy_visibility_test.dartwith a fakenativeapi.Window: show/hide only on visibility change (including minimized windows), nothing when the platform refuses the change, restore/unmaximize tracking in both orders, and the named callbacks following the tracked state.dart format --set-exit-if-changed .,flutter analyze(package and example) andflutter test(package and example) pass locally (Flutter 3.47.7, Windows), and the full CI workflow passes on the identical commit in my fork.Related
Part of a set of independent PRs, each based on
mainand mergeable on its own: widgets #598, #599, #600, #601; legacy bridge #602 (this), #603, #604, #605, #606.#604 and #605 add the identical
debugBindWindowtest seam and merge cleanly with this PR. Expected conflict with #606 (late window resolution) inshow()/hide(): resolve by keeping #606's pending-show handling and moving this PR's visibility check andshow/hideemits into_showWindow/hide();debugBindWindowcan then delegate tobindWindow.