-
Notifications
You must be signed in to change notification settings - Fork 402
Fix RenderFlex overflow in debugging controls at narrow widths #9949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
srawlins
merged 4 commits into
flutter:master
from
theprantadutta:fix/debugger-controls-overflow
Aug 12, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a028440
Fix RenderFlex overflow in debugging controls at narrow widths
theprantadutta bed3e3b
Add release note for the debugging controls overflow fix
theprantadutta 8c66629
Point the release note at the actual PR number
theprantadutta db401ca
Move test setup into a setUp block
theprantadutta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
89 changes: 89 additions & 0 deletions
89
packages/devtools_app/test/screens/debugger/debugger_controls_overflow_test.dart
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // Copyright 2026 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. | ||
|
|
||
| import 'package:devtools_app/devtools_app.dart'; | ||
| import 'package:devtools_app/src/screens/debugger/controls.dart'; | ||
| import 'package:devtools_app_shared/ui.dart'; | ||
| import 'package:devtools_app_shared/utils.dart'; | ||
| import 'package:devtools_test/devtools_test.dart'; | ||
| import 'package:devtools_test/helpers.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:mockito/mockito.dart'; | ||
|
|
||
| void main() { | ||
| /// Widths the debugging controls are expected to lay out at without | ||
| /// overflowing. | ||
| /// | ||
| /// The controls stop showing button labels below | ||
| /// [DebuggingControls.minWidth], but the remaining icon-only content still | ||
| /// did not fit below roughly 630px, which is a realistic width for DevTools | ||
| /// embedded in an IDE side panel. See | ||
| /// https://github.com/flutter/devtools/issues/4917. | ||
| const windowWidths = [1200.0, 800.0, 600.0, 500.0, 400.0]; | ||
|
|
||
| const windowHeight = 800.0; | ||
|
|
||
| final fakeServiceConnection = FakeServiceConnectionManager(); | ||
| final scriptManager = MockScriptManager(); | ||
| mockConnectedApp(fakeServiceConnection.serviceManager.connectedApp!); | ||
| setGlobal(ServiceConnectionManager, fakeServiceConnection); | ||
| setGlobal(IdeTheme, IdeTheme()); | ||
| setGlobal(ScriptManager, scriptManager); | ||
| setGlobal(NotificationService, NotificationService()); | ||
| setGlobal(BreakpointManager, BreakpointManager()); | ||
| setGlobal( | ||
| DevToolsEnvironmentParameters, | ||
| ExternalDevToolsEnvironmentParameters(), | ||
| ); | ||
| setGlobal(PreferencesController, PreferencesController()); | ||
| fakeServiceConnection.consoleService.ensureServiceInitialized(); | ||
| when( | ||
| fakeServiceConnection.errorBadgeManager.errorCountNotifier('debugger'), | ||
| ).thenReturn(ValueNotifier<int>(0)); | ||
| final debuggerController = createMockDebuggerControllerWithDefaults(); | ||
|
|
||
| Future<void> pumpControls(WidgetTester tester) async { | ||
| await tester.pumpWidget( | ||
| wrapWithControllers( | ||
| const DebuggingControls(), | ||
| debugger: debuggerController, | ||
| ), | ||
| ); | ||
| await tester.pump(); | ||
| } | ||
|
|
||
| group('DebuggingControls', () { | ||
| for (final width in windowWidths) { | ||
| testWidgetsWithWindowSize( | ||
| 'does not overflow at ${width.toInt()}px', | ||
| Size(width, windowHeight), | ||
| (WidgetTester tester) async { | ||
| await pumpControls(tester); | ||
|
|
||
| expect(tester.takeException(), isNull); | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| testWidgetsWithWindowSize( | ||
| 'keeps the file explorer button pinned to the right edge', | ||
| const Size(1200.0, windowHeight), | ||
| (WidgetTester tester) async { | ||
| await pumpControls(tester); | ||
|
|
||
| final controlsRight = tester | ||
| .getRect(find.byType(DebuggingControls)) | ||
| .right; | ||
| final fileExplorerButtonRight = tester | ||
| .getRect( | ||
| find.widgetWithIcon(GaDevToolsButton, Icons.folder_outlined), | ||
| ) | ||
| .right; | ||
|
|
||
| expect(fileExplorerButtonRight, equals(controlsRight)); | ||
| }, | ||
| ); | ||
| }); | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CONCERN] Stateful mocks, controllers, and global services should be initialized inside a
setUpblock rather than at the top level ofmain(). When initialized at the top level ofmain(), they are shared across all tests in the file, which can lead to test pollution, side effects, and flakiness if one test modifies their state.References
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's wrap this in a setUp block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call — moved the mocks, controller, and global service setup into a
setUpblock in db401ca so each test gets a fresh instance. Tests still pass.