diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index 099a61a1f6f..8aca87c19d7 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart @@ -34,16 +34,8 @@ final _disabledTestsForDevice = >{ '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 dc76fb8e7ac..891ebc15cf0 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 @@ class _ProjectRootTextFieldState extends State 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 @@ class _ProjectRootTextFieldState extends State }, 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/ui/filter.dart b/packages/devtools_app/lib/src/shared/ui/filter.dart index 0b6308b0b1c..f4a517fd248 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 @@ class _StandaloneFilterFieldState extends State> child: ValueListenableBuilder( valueListenable: widget.controller.useRegExp, builder: (context, useRegExp, _) { - return DevToolsClearableTextField( + return DevToolsTextField( hintText: 'Filter', controller: queryTextFieldController, prefixIcon: widget.controller.settingFilters.isNotEmpty @@ -687,18 +687,30 @@ class _StandaloneFilterFieldState extends State> : 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 d09686f5bb6..9a7873ddf0e 100644 --- a/packages/devtools_app_shared/CHANGELOG.md +++ b/packages/devtools_app_shared/CHANGELOG.md @@ -3,6 +3,9 @@ Copyright 2025 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. --> +## 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 d6cb27db59d..eda5451d8ba 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 'package:flutter/material.dart'; 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 @@ final class DevToolsClearableTextField extends StatelessWidget { height: inputDecorationElementHeight, child: Row( mainAxisSize: MainAxisSize.min, - children: [ - ...additionalSuffixActions, - InputDecorationSuffixButton.clear( - onPressed: () { - controller.clear(); - onChanged?.call(''); - }, - ), - ], + children: additionalSuffixActions, ), ), ), @@ -95,6 +87,58 @@ final class DevToolsClearableTextField extends StatelessWidget { } } +/// 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 [], + 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 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 4e1b0289b40..5e1fd8f3131 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: