Fix failing DevTools integration tests by excluding semantics on some tooltips (#9660)
diff --git a/flutter-candidate.txt b/flutter-candidate.txt index f32407a..1efe0e0 100644 --- a/flutter-candidate.txt +++ b/flutter-candidate.txt
@@ -1 +1 @@ -5f49837cddf55149ed9af642a80a2bb45b0149ec +8034db0bd38b1c682146474cc5986e2e00dad96f
diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index 099a61a..8aca87c 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart
@@ -34,16 +34,8 @@ 'eval_and_browse_test.dart', // https://github.com/flutter/devtools/issues/7425 'export_snapshot_test.dart', - // https://github.com/flutter/devtools/issues/9639 - 'network_screen_test.dart', // https://github.com/flutter/devtools/issues/9641 - 'devtools_extensions_test.dart', - // https://github.com/flutter/devtools/issues/9642 'perfetto_test.dart', - // https://github.com/flutter/devtools/issues/9645 - 'app_test.dart', - // https://github.com/flutter/devtools/issues/9646 - 'service_extensions_test.dart', }, TestAppDevice.flutterChrome.name: { // TODO(https://github.com/flutter/devtools/issues/7145): Figure out why
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/project_root_selection/root_selector.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/project_root_selection/root_selector.dart index dc76fb8..891ebc1 100644 --- a/packages/devtools_app/lib/src/screens/deep_link_validation/project_root_selection/root_selector.dart +++ b/packages/devtools_app/lib/src/screens/deep_link_validation/project_root_selection/root_selector.dart
@@ -55,7 +55,7 @@ child: Container( height: defaultTextFieldHeight, padding: const EdgeInsets.symmetric(horizontal: defaultSpacing), - child: DevToolsClearableTextField( + child: DevToolsTextField( controller: controller, enabled: widget.enabled, onSubmitted: (String path) { @@ -63,6 +63,18 @@ }, labelText: 'Path to Flutter project', roundedBorder: true, + additionalSuffixActions: [ + // TODO(elliette): Remove ExcludeSemantics once + // https://github.com/flutter/flutter/issues/161630 is + // fixed and use DevToolsClearableTextField instead. + ExcludeSemantics( + child: InputDecorationSuffixButton.clear( + onPressed: () { + controller.clear(); + }, + ), + ), + ], ), ), );
diff --git a/packages/devtools_app/lib/src/shared/table/table_controller.dart b/packages/devtools_app/lib/src/shared/table/table_controller.dart index c7945e8..d3f2d03 100644 --- a/packages/devtools_app/lib/src/shared/table/table_controller.dart +++ b/packages/devtools_app/lib/src/shared/table/table_controller.dart
@@ -397,16 +397,16 @@ } } -// Ignoring the 'avoid_classes_with_only_static_members' lint because the static -// members here allow us to add asserts that guarantee unique keys for tables -// across DevTools. -// ignore: avoid_classes_with_only_static_members /// Stores the [TableUiState] for each table, keyed on a unique [String]. /// /// This store will remain alive for the entire life of the DevTools instance. /// This allows us to cache the [TableUiState] for tables without having to /// keep table [State] classes or table controller classes alive. @visibleForTesting +// Note: Ignoring the 'avoid_classes_with_only_static_members' lint because the +// static members here allow us to add asserts that guarantee unique keys for +// tables across DevTools. +// ignore: avoid_classes_with_only_static_members, see reason above. abstract class TableUiStateStore<T> { static final _tableUiStateStore = <String, TableUiState>{};
diff --git a/packages/devtools_app/lib/src/shared/ui/filter.dart b/packages/devtools_app/lib/src/shared/ui/filter.dart index 0b6308b..f4a517f 100644 --- a/packages/devtools_app/lib/src/shared/ui/filter.dart +++ b/packages/devtools_app/lib/src/shared/ui/filter.dart
@@ -654,7 +654,7 @@ child: ValueListenableBuilder<bool>( valueListenable: widget.controller.useRegExp, builder: (context, useRegExp, _) { - return DevToolsClearableTextField( + return DevToolsTextField( hintText: 'Filter', controller: queryTextFieldController, prefixIcon: widget.controller.settingFilters.isNotEmpty @@ -687,18 +687,30 @@ : null, additionalSuffixActions: [ if (widget.controller.queryFilterArgs.isNotEmpty) - InputDecorationSuffixButton.help( + // TODO(elliette): Remove ExcludeSemantics once + // https://github.com/flutter/flutter/issues/161630 is + // fixed and use DevToolsClearableTextField instead. + ExcludeSemantics( + child: InputDecorationSuffixButton.help( + onPressed: () { + showDevToolsDialog( + context: context, + title: 'Filter Syntax', + content: _FilterSyntax( + controller: widget.controller, + filteredItem: widget.filteredItem, + ), + ); + }, + ), + ), + ExcludeSemantics( + child: InputDecorationSuffixButton.clear( onPressed: () { - showDevToolsDialog( - context: context, - title: 'Filter Syntax', - content: _FilterSyntax( - controller: widget.controller, - filteredItem: widget.filteredItem, - ), - ); + queryTextFieldController.clear(); }, ), + ), DevToolsToggleButton( icon: Icons.emergency, message: 'Use regular expressions',
diff --git a/packages/devtools_app_shared/CHANGELOG.md b/packages/devtools_app_shared/CHANGELOG.md index d09686f..9a7873d 100644 --- a/packages/devtools_app_shared/CHANGELOG.md +++ b/packages/devtools_app_shared/CHANGELOG.md
@@ -3,6 +3,9 @@ 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. --> +## 0.5.1 (not released) +* Add DevTools-styled text field `DevToolsTextField`. + ## 0.5.0 * **Breaking change:** remove `scaleByFontFactor`. * **Breaking change:** remove `IdeTheme.fontSize` and `IdeTheme.fontSizeFactor`.
diff --git a/packages/devtools_app_shared/lib/src/ui/text_field.dart b/packages/devtools_app_shared/lib/src/ui/text_field.dart index d6cb27d..eda5451 100644 --- a/packages/devtools_app_shared/lib/src/ui/text_field.dart +++ b/packages/devtools_app_shared/lib/src/ui/text_field.dart
@@ -7,9 +7,9 @@ import 'common.dart'; import 'theme/theme.dart'; -/// A DevTools-styled text field with a suffix action to clear the search field. -final class DevToolsClearableTextField extends StatelessWidget { - DevToolsClearableTextField({ +/// A DevTools-styled text field. +final class DevToolsTextField extends StatelessWidget { + DevToolsTextField({ super.key, TextEditingController? controller, this.labelText, @@ -78,15 +78,7 @@ height: inputDecorationElementHeight, child: Row( mainAxisSize: MainAxisSize.min, - children: [ - ...additionalSuffixActions, - InputDecorationSuffixButton.clear( - onPressed: () { - controller.clear(); - onChanged?.call(''); - }, - ), - ], + children: additionalSuffixActions, ), ), ), @@ -95,6 +87,58 @@ } } +/// A DevTools-styled text field with a suffix action to clear the search field. +final class DevToolsClearableTextField extends StatelessWidget { + DevToolsClearableTextField({ + super.key, + TextEditingController? controller, + this.labelText, + this.hintText, + this.prefixIcon, + this.additionalSuffixActions = const <Widget>[], + this.onChanged, + this.onSubmitted, + this.autofocus = false, + this.enabled, + this.roundedBorder = false, + }) : controller = controller ?? TextEditingController(); + + final TextEditingController controller; + final String? hintText; + final Widget? prefixIcon; + final List<Widget> additionalSuffixActions; + final String? labelText; + final void Function(String)? onChanged; + final void Function(String)? onSubmitted; + final bool autofocus; + final bool? enabled; + final bool roundedBorder; + + @override + Widget build(BuildContext context) { + return DevToolsTextField( + controller: controller, + labelText: labelText, + hintText: hintText, + prefixIcon: prefixIcon, + additionalSuffixActions: [ + ...additionalSuffixActions, + InputDecorationSuffixButton.clear( + onPressed: () { + controller.clear(); + onChanged?.call(''); + }, + ), + ], + onChanged: onChanged, + onSubmitted: onSubmitted, + autofocus: autofocus, + enabled: enabled, + roundedBorder: roundedBorder, + ); + } +} + /// A DevTools-styled icon action button intended to be used as an /// [InputDecoration.suffix] widget. final class InputDecorationSuffixButton extends StatelessWidget {
diff --git a/packages/devtools_app_shared/pubspec.yaml b/packages/devtools_app_shared/pubspec.yaml index 4e1b028..5e1fd8f 100644 --- a/packages/devtools_app_shared/pubspec.yaml +++ b/packages/devtools_app_shared/pubspec.yaml
@@ -3,7 +3,7 @@ # found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. name: devtools_app_shared description: Package of Dart & Flutter structures shared between devtools_app and devtools extensions. -version: 0.5.0 +version: 0.5.1 repository: https://github.com/flutter/devtools/tree/master/packages/devtools_app_shared environment: