Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/devtools_app/integration_test/run_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,8 @@ final _disabledTestsForDevice = <String, Set<String>>{
'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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,26 @@ class _ProjectRootTextFieldState extends State<ProjectRootTextField>
child: Container(
height: defaultTextFieldHeight,
padding: const EdgeInsets.symmetric(horizontal: defaultSpacing),
child: DevToolsClearableTextField(
child: DevToolsTextField(
controller: controller,
enabled: widget.enabled,
onSubmitted: (String path) {
widget.onValidatePressed(path.trim());
},
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();
},
),
),
],
),
),
);
Expand Down
32 changes: 22 additions & 10 deletions packages/devtools_app/lib/src/shared/ui/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class _StandaloneFilterFieldState<T> extends State<StandaloneFilterField<T>>
child: ValueListenableBuilder<bool>(
valueListenable: widget.controller.useRegExp,
builder: (context, useRegExp, _) {
return DevToolsClearableTextField(
return DevToolsTextField(
hintText: 'Filter',
controller: queryTextFieldController,
prefixIcon: widget.controller.settingFilters.isNotEmpty
Expand Down Expand Up @@ -687,18 +687,30 @@ class _StandaloneFilterFieldState<T> extends State<StandaloneFilterField<T>>
: 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',
Expand Down
3 changes: 3 additions & 0 deletions packages/devtools_app_shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
68 changes: 56 additions & 12 deletions packages/devtools_app_shared/lib/src/ui/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
),
),
),
Expand All @@ -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 <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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading