Repository navigation
Conversation
setProgressBar and setBadgeLabel go through nativeapi's Application, which targets the application's primary window. On Windows, with no primary window set, it falls back to the first window of WindowManager.getAll(), which enumerates visible titled top-level windows without a process filter, so the progress could land on another application's taskbar button. Both calls now make the addressed window the primary window first when the app has not chosen one. A primary window the app set itself is left alone. Adds @VisibleForTesting debugBindWindow and debugApplicationOverride so the bridge can be driven by simulated nativeapi objects 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
setProgressBarandsetBadgeLabelofpackage:window_manager/legacy.dartgo through nativeapi'sApplication, which targets the application's primary window. On Windows, with no primary window set, it falls back to the first window ofWindowManager.getAll(), which enumerates visible titled top-level windows without a process filter, so the taskbar progress can land on another application's button.Change
Both calls first make the addressed window the application's primary window when none is set (
Application.getPrimaryWindow() == null). A primary window the app chose itself is left alone.Test seams:
@visibleForTesting debugBindWindow(nativeapi.Window?)anddebugApplicationOverride.Tests
New
test/legacy_taskbar_test.dartwith a fake window and a fakeApplication: progress and badge designate the addressed window when there is no primary window, and keep a primary window the app chose.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, #603, #604, #605 (this), #606.#602 and #604 add the identical
debugBindWindowtest seam; merges cleanly with all legacy PRs including #606.