Skip to content

Commit 8673d6e

Browse files
authored
Stop changing tooltip on state change. (#4928)
1 parent 0ddbf17 commit 8673d6e

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

packages/devtools_app/lib/src/screens/memory/panes/chart/chart_control_pane.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class _LegendButton extends StatelessWidget {
126126
},
127127
icon: legendVisible ? Icons.close : Icons.storage,
128128
label: 'Legend',
129-
tooltip: 'Show chart legend',
129+
tooltip: 'Toggle visibility of the chart legend',
130130
minScreenWidthForTextBeforeScaling: memoryControlsMinVerboseWidth,
131131
),
132132
);

packages/devtools_app/lib/src/screens/memory/panes/control/primary_controls.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ class PrimaryControls extends StatelessWidget {
1515

1616
@override
1717
Widget build(BuildContext context) {
18-
return ChartVisibilityButton(
19-
showChart: preferences.memory.showChart,
18+
return VisibilityButton(
19+
show: preferences.memory.showChart,
2020
onPressed: (show) => preferences.memory.showChart.value = show,
2121
minScreenWidthForTextBeforeScaling: memoryControlsMinVerboseWidth,
22+
label: 'Memory chart',
23+
tooltip: 'Toggle visibility of the Memory usage chart',
2224
);
2325
}
2426
}

packages/devtools_app/lib/src/screens/performance/performance_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ class _PrimaryControls extends StatelessWidget {
199199
return Row(
200200
children: [
201201
if (serviceManager.connectedApp!.isFlutterAppNow!) ...[
202-
ChartVisibilityButton(
203-
showChart:
204-
controller.flutterFramesController.showFlutterFramesChart,
202+
VisibilityButton(
203+
show: controller.flutterFramesController.showFlutterFramesChart,
205204
onPressed:
206205
controller.flutterFramesController.toggleShowFlutterFrames,
207206
label: 'Flutter frames',
207+
tooltip: 'Toggle visibility of the Flutter frames chart',
208208
),
209209
const SizedBox(width: denseSpacing),
210210
],

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -511,30 +511,33 @@ class CollapseAllButton extends StatelessWidget {
511511
///
512512
/// The button automatically toggles the icon and the tooltip to indicate the
513513
/// shown or hidden state.
514-
class ChartVisibilityButton extends StatelessWidget {
515-
const ChartVisibilityButton({
516-
required this.showChart,
514+
class VisibilityButton extends StatelessWidget {
515+
const VisibilityButton({
516+
required this.show,
517517
required this.onPressed,
518518
this.minScreenWidthForTextBeforeScaling,
519-
this.label = 'Chart',
519+
required this.label,
520+
required this.tooltip,
520521
});
521522

522-
final ValueListenable<bool> showChart;
523+
final ValueListenable<bool> show;
523524

524525
final void Function(bool) onPressed;
525526

526527
final double? minScreenWidthForTextBeforeScaling;
527528

528529
final String label;
529530

531+
final String tooltip;
532+
530533
@override
531534
Widget build(BuildContext context) {
532535
return ValueListenableBuilder<bool>(
533-
valueListenable: showChart,
536+
valueListenable: show,
534537
builder: (_, show, __) {
535538
return IconLabelButton(
536539
key: key,
537-
tooltip: show ? 'Hide chart' : 'Show chart',
540+
tooltip: tooltip,
538541
icon: show ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
539542
label: label,
540543
minScreenWidthForTextBeforeScaling:

packages/devtools_app/test/performance/performance_screen_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void main() {
104104
find.text('Select a frame above to view analysis data.'),
105105
findsOneWidget,
106106
);
107-
expect(find.byType(ChartVisibilityButton), findsOneWidget);
107+
expect(find.byType(VisibilityButton), findsOneWidget);
108108
expect(find.byIcon(Icons.block), findsOneWidget);
109109
expect(find.text('Performance Overlay'), findsOneWidget);
110110
expect(find.text('Enhance Tracing'), findsOneWidget);
@@ -133,7 +133,7 @@ void main() {
133133
findsNothing,
134134
);
135135
expect(find.byType(EventDetails), findsOneWidget);
136-
expect(find.byType(ChartVisibilityButton), findsNothing);
136+
expect(find.byType(VisibilityButton), findsNothing);
137137
expect(find.byIcon(Icons.block), findsOneWidget);
138138
expect(find.text('Performance Overlay'), findsNothing);
139139
expect(find.text('Enhance Tracing'), findsNothing);
@@ -157,7 +157,7 @@ void main() {
157157
await pumpPerformanceScreen(tester, runAsync: true);
158158
await tester.pumpAndSettle();
159159

160-
final chartButtonFinder = find.byType(ChartVisibilityButton);
160+
final chartButtonFinder = find.byType(VisibilityButton);
161161
expect(chartButtonFinder, findsOneWidget);
162162

163163
// The flutter frames chart is visible.
16 Bytes
Loading

0 commit comments

Comments
 (0)