Skip to content

Commit 5710fde

Browse files
authored
Fix failing DevTools integration tests by excluding semantics on some tooltips (#9660)
1 parent 0a0cf24 commit 5710fde

8 files changed

Lines changed: 100 additions & 37 deletions

File tree

flutter-candidate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5f49837cddf55149ed9af642a80a2bb45b0149ec
1+
8034db0bd38b1c682146474cc5986e2e00dad96f

packages/devtools_app/integration_test/run_tests.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,8 @@ final _disabledTestsForDevice = <String, Set<String>>{
3434
'eval_and_browse_test.dart',
3535
// https://github.com/flutter/devtools/issues/7425
3636
'export_snapshot_test.dart',
37-
// https://github.com/flutter/devtools/issues/9639
38-
'network_screen_test.dart',
3937
// https://github.com/flutter/devtools/issues/9641
40-
'devtools_extensions_test.dart',
41-
// https://github.com/flutter/devtools/issues/9642
4238
'perfetto_test.dart',
43-
// https://github.com/flutter/devtools/issues/9645
44-
'app_test.dart',
45-
// https://github.com/flutter/devtools/issues/9646
46-
'service_extensions_test.dart',
4739
},
4840
TestAppDevice.flutterChrome.name: {
4941
// TODO(https://github.com/flutter/devtools/issues/7145): Figure out why

packages/devtools_app/lib/src/screens/deep_link_validation/project_root_selection/root_selector.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,26 @@ class _ProjectRootTextFieldState extends State<ProjectRootTextField>
5555
child: Container(
5656
height: defaultTextFieldHeight,
5757
padding: const EdgeInsets.symmetric(horizontal: defaultSpacing),
58-
child: DevToolsClearableTextField(
58+
child: DevToolsTextField(
5959
controller: controller,
6060
enabled: widget.enabled,
6161
onSubmitted: (String path) {
6262
widget.onValidatePressed(path.trim());
6363
},
6464
labelText: 'Path to Flutter project',
6565
roundedBorder: true,
66+
additionalSuffixActions: [
67+
// TODO(elliette): Remove ExcludeSemantics once
68+
// https://github.com/flutter/flutter/issues/161630 is
69+
// fixed and use DevToolsClearableTextField instead.
70+
ExcludeSemantics(
71+
child: InputDecorationSuffixButton.clear(
72+
onPressed: () {
73+
controller.clear();
74+
},
75+
),
76+
),
77+
],
6678
),
6779
),
6880
);

packages/devtools_app/lib/src/shared/table/table_controller.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,16 @@ class TableUiState {
397397
}
398398
}
399399

400-
// Ignoring the 'avoid_classes_with_only_static_members' lint because the static
401-
// members here allow us to add asserts that guarantee unique keys for tables
402-
// across DevTools.
403-
// ignore: avoid_classes_with_only_static_members
404400
/// Stores the [TableUiState] for each table, keyed on a unique [String].
405401
///
406402
/// This store will remain alive for the entire life of the DevTools instance.
407403
/// This allows us to cache the [TableUiState] for tables without having to
408404
/// keep table [State] classes or table controller classes alive.
409405
@visibleForTesting
406+
// Note: Ignoring the 'avoid_classes_with_only_static_members' lint because the
407+
// static members here allow us to add asserts that guarantee unique keys for
408+
// tables across DevTools.
409+
// ignore: avoid_classes_with_only_static_members, see reason above.
410410
abstract class TableUiStateStore<T> {
411411
static final _tableUiStateStore = <String, TableUiState>{};
412412

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ class _StandaloneFilterFieldState<T> extends State<StandaloneFilterField<T>>
654654
child: ValueListenableBuilder<bool>(
655655
valueListenable: widget.controller.useRegExp,
656656
builder: (context, useRegExp, _) {
657-
return DevToolsClearableTextField(
657+
return DevToolsTextField(
658658
hintText: 'Filter',
659659
controller: queryTextFieldController,
660660
prefixIcon: widget.controller.settingFilters.isNotEmpty
@@ -687,18 +687,30 @@ class _StandaloneFilterFieldState<T> extends State<StandaloneFilterField<T>>
687687
: null,
688688
additionalSuffixActions: [
689689
if (widget.controller.queryFilterArgs.isNotEmpty)
690-
InputDecorationSuffixButton.help(
690+
// TODO(elliette): Remove ExcludeSemantics once
691+
// https://github.com/flutter/flutter/issues/161630 is
692+
// fixed and use DevToolsClearableTextField instead.
693+
ExcludeSemantics(
694+
child: InputDecorationSuffixButton.help(
695+
onPressed: () {
696+
showDevToolsDialog(
697+
context: context,
698+
title: 'Filter Syntax',
699+
content: _FilterSyntax(
700+
controller: widget.controller,
701+
filteredItem: widget.filteredItem,
702+
),
703+
);
704+
},
705+
),
706+
),
707+
ExcludeSemantics(
708+
child: InputDecorationSuffixButton.clear(
691709
onPressed: () {
692-
showDevToolsDialog(
693-
context: context,
694-
title: 'Filter Syntax',
695-
content: _FilterSyntax(
696-
controller: widget.controller,
697-
filteredItem: widget.filteredItem,
698-
),
699-
);
710+
queryTextFieldController.clear();
700711
},
701712
),
713+
),
702714
DevToolsToggleButton(
703715
icon: Icons.emergency,
704716
message: 'Use regular expressions',

packages/devtools_app_shared/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Copyright 2025 The Flutter Authors
33
Use of this source code is governed by a BSD-style license that can be
44
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
55
-->
6+
## 0.5.1 (not released)
7+
* Add DevTools-styled text field `DevToolsTextField`.
8+
69
## 0.5.0
710
* **Breaking change:** remove `scaleByFontFactor`.
811
* **Breaking change:** remove `IdeTheme.fontSize` and `IdeTheme.fontSizeFactor`.

packages/devtools_app_shared/lib/src/ui/text_field.dart

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import 'package:flutter/material.dart';
77
import 'common.dart';
88
import 'theme/theme.dart';
99

10-
/// A DevTools-styled text field with a suffix action to clear the search field.
11-
final class DevToolsClearableTextField extends StatelessWidget {
12-
DevToolsClearableTextField({
10+
/// A DevTools-styled text field.
11+
final class DevToolsTextField extends StatelessWidget {
12+
DevToolsTextField({
1313
super.key,
1414
TextEditingController? controller,
1515
this.labelText,
@@ -78,15 +78,7 @@ final class DevToolsClearableTextField extends StatelessWidget {
7878
height: inputDecorationElementHeight,
7979
child: Row(
8080
mainAxisSize: MainAxisSize.min,
81-
children: [
82-
...additionalSuffixActions,
83-
InputDecorationSuffixButton.clear(
84-
onPressed: () {
85-
controller.clear();
86-
onChanged?.call('');
87-
},
88-
),
89-
],
81+
children: additionalSuffixActions,
9082
),
9183
),
9284
),
@@ -95,6 +87,58 @@ final class DevToolsClearableTextField extends StatelessWidget {
9587
}
9688
}
9789

90+
/// A DevTools-styled text field with a suffix action to clear the search field.
91+
final class DevToolsClearableTextField extends StatelessWidget {
92+
DevToolsClearableTextField({
93+
super.key,
94+
TextEditingController? controller,
95+
this.labelText,
96+
this.hintText,
97+
this.prefixIcon,
98+
this.additionalSuffixActions = const <Widget>[],
99+
this.onChanged,
100+
this.onSubmitted,
101+
this.autofocus = false,
102+
this.enabled,
103+
this.roundedBorder = false,
104+
}) : controller = controller ?? TextEditingController();
105+
106+
final TextEditingController controller;
107+
final String? hintText;
108+
final Widget? prefixIcon;
109+
final List<Widget> additionalSuffixActions;
110+
final String? labelText;
111+
final void Function(String)? onChanged;
112+
final void Function(String)? onSubmitted;
113+
final bool autofocus;
114+
final bool? enabled;
115+
final bool roundedBorder;
116+
117+
@override
118+
Widget build(BuildContext context) {
119+
return DevToolsTextField(
120+
controller: controller,
121+
labelText: labelText,
122+
hintText: hintText,
123+
prefixIcon: prefixIcon,
124+
additionalSuffixActions: [
125+
...additionalSuffixActions,
126+
InputDecorationSuffixButton.clear(
127+
onPressed: () {
128+
controller.clear();
129+
onChanged?.call('');
130+
},
131+
),
132+
],
133+
onChanged: onChanged,
134+
onSubmitted: onSubmitted,
135+
autofocus: autofocus,
136+
enabled: enabled,
137+
roundedBorder: roundedBorder,
138+
);
139+
}
140+
}
141+
98142
/// A DevTools-styled icon action button intended to be used as an
99143
/// [InputDecoration.suffix] widget.
100144
final class InputDecorationSuffixButton extends StatelessWidget {

packages/devtools_app_shared/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44
name: devtools_app_shared
55
description: Package of Dart & Flutter structures shared between devtools_app and devtools extensions.
6-
version: 0.5.0
6+
version: 0.5.1
77
repository: https://github.com/flutter/devtools/tree/master/packages/devtools_app_shared
88

99
environment:

0 commit comments

Comments
 (0)