Skip to content

Commit 8544918

Browse files
Combine the pause and resume buttons in the debugger (#9095)
1 parent 5a95174 commit 8544918

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

packages/devtools_app/lib/src/screens/debugger/controls.dart

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,32 @@ class _DebuggingControlsState extends State<DebuggingControls>
9090
required bool resuming,
9191
}) {
9292
final isSystemIsolate = controller.isSystemIsolate;
93+
// Note: this could be refactored to use a single [GaDevToolsButton] instead
94+
// of a [RoundedButtonGroup] with only one child, but this would require
95+
// changes to the underlying [DevToolsButton] widget from
96+
// package:devtools_app_shared to accept an `iconAsset` as a parameter.
9397
return RoundedButtonGroup(
9498
items: [
95-
ButtonGroupItemData(
96-
tooltip: 'Pause',
97-
icon: Icons.pause,
98-
autofocus: true,
99-
// Disable when paused or selected isolate is a system isolate.
100-
onPressed:
101-
(isPaused || isSystemIsolate)
102-
? null
103-
: () => unawaited(controller.pause()),
104-
),
105-
ButtonGroupItemData(
106-
tooltip: 'Resume',
107-
iconAsset: 'icons/material_symbols/resume.png',
108-
iconSize: DebuggingControls.materialIconSize,
109-
// Enable while paused + not resuming and selected isolate is not
110-
// a system isolate.
111-
onPressed:
112-
((isPaused && !resuming) && !isSystemIsolate)
113-
? () => unawaited(controller.resume())
114-
: null,
115-
),
99+
!isPaused
100+
? ButtonGroupItemData(
101+
tooltip: 'Pause',
102+
icon: Icons.pause,
103+
autofocus: true,
104+
// Disable when selected isolate is a system isolate.
105+
onPressed:
106+
isSystemIsolate ? null : () => unawaited(controller.pause()),
107+
)
108+
: ButtonGroupItemData(
109+
tooltip: 'Resume',
110+
iconAsset: 'icons/material_symbols/resume.png',
111+
iconSize: DebuggingControls.materialIconSize,
112+
// Enable not resuming and selected isolate is not a system
113+
// isolate.
114+
onPressed:
115+
(!resuming && !isSystemIsolate)
116+
? () => unawaited(controller.resume())
117+
: null,
118+
),
116119
],
117120
);
118121
}

packages/devtools_app/lib/src/shared/ui/common_widgets.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class GaDevToolsButton extends DevToolsButton {
111111
class PauseButton extends GaDevToolsButton {
112112
PauseButton({
113113
super.key,
114-
required super.tooltip,
114+
super.tooltip = 'Pause',
115115
required super.onPressed,
116116
required super.gaScreen,
117117
required super.gaSelection,
@@ -124,7 +124,7 @@ class PauseButton extends GaDevToolsButton {
124124
class ResumeButton extends GaDevToolsButton {
125125
ResumeButton({
126126
super.key,
127-
required super.tooltip,
127+
super.tooltip = 'Resume',
128128
required super.onPressed,
129129
required super.gaScreen,
130130
required super.gaSelection,

packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ TODO: Remove this section if there are not any general updates.
6161

6262
## Debugger updates
6363

64-
TODO: Remove this section if there are not any general updates.
64+
* Combine the Pause and Resume buttons into a single button. -
65+
[#9095](https://github.com/flutter/devtools/pull/9095)
6566

6667
## Network profiler updates
6768

packages/devtools_app/test/screens/debugger/debugger_screen_paused_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ void main() {
8888
await tester.pump();
8989

9090
final pauseButtonFinder = findDebuggerButtonWithIcon(Icons.pause);
91-
expect(pauseButtonFinder, findsOneWidget);
92-
final pause = getWidgetFromFinder<OutlinedButton>(pauseButtonFinder);
93-
expect(pause.onPressed, isNull);
91+
expect(pauseButtonFinder, findsNothing);
9492

9593
final resumeButtonFinder = findDebuggerButtonWithIconAsset('resume.png');
9694
expect(resumeButtonFinder, findsOneWidget);

packages/devtools_app/test/screens/debugger/debugger_screen_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ void main() {
133133
expect(pause.onPressed, isNotNull);
134134

135135
final resumeButtonFinder = findDebuggerButtonWithIconAsset('resume.png');
136-
expect(resumeButtonFinder, findsOneWidget);
137-
final resume = getWidgetFromFinder<OutlinedButton>(resumeButtonFinder);
138-
expect(resume.onPressed, isNull);
136+
expect(resumeButtonFinder, findsNothing);
139137
});
140138

141139
testWidgetsWithWindowSize(
874 Bytes
Loading
-3.17 KB
Loading

0 commit comments

Comments
 (0)