diff --git a/packages/devtools_app/lib/src/screens/network/network_screen.dart b/packages/devtools_app/lib/src/screens/network/network_screen.dart index 66843cf09b0..81202fb34e6 100644 --- a/packages/devtools_app/lib/src/screens/network/network_screen.dart +++ b/packages/devtools_app/lib/src/screens/network/network_screen.dart @@ -194,8 +194,6 @@ class _NetworkProfilerControlsState extends State<_NetworkProfilerControls> _recording = controller.recordingNotifier.value; }); }); - - addAutoDisposeListener(controller.filteredData); } @override @@ -205,7 +203,6 @@ class _NetworkProfilerControlsState extends State<_NetworkProfilerControls> } final screenWidth = ScreenSize(context).width; - final hasRequests = controller.filteredData.value.isNotEmpty; return Column( children: [ Row( @@ -233,7 +230,6 @@ class _NetworkProfilerControlsState extends State<_NetworkProfilerControls> Expanded( child: SearchField( searchController: controller, - searchFieldEnabled: hasRequests, searchFieldWidth: screenWidth <= MediaSize.xs ? defaultSearchFieldWidth : wideSearchFieldWidth, diff --git a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md index 2cd2c928fe0..1b2bf4e5e43 100644 --- a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md +++ b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md @@ -39,7 +39,9 @@ TODO: Remove this section if there are not any updates. ## Network profiler updates -TODO: Remove this section if there are not any updates. +* Fixed the Network tab search field becoming disabled after clearing all + requests, so the search query can now be edited at any time. - + [#9855](https://github.com/flutter/devtools/pull/9855) ## Logging updates diff --git a/packages/devtools_app/test/screens/network/network_profiler_test.dart b/packages/devtools_app/test/screens/network/network_profiler_test.dart index ff469552771..4e967e6e5a9 100644 --- a/packages/devtools_app/test/screens/network/network_profiler_test.dart +++ b/packages/devtools_app/test/screens/network/network_profiler_test.dart @@ -338,6 +338,48 @@ void main() { // Wait to ensure all the timers have been cancelled. await tester.pumpAndSettle(const Duration(seconds: 2)); }); + + testWidgetsWithWindowSize( + 'search field stays enabled after clearing', + windowSize, + (WidgetTester tester) async { + // Load the network profiler screen. + controller = NetworkController(); + await pumpNetworkScreen(tester); + + // Populate the screen with requests. + await loadRequestsAndCheck(tester); + + Finder searchFieldTextField() => find.descendant( + of: find.byType(SearchField), + matching: find.byType(TextField), + ); + + // The search field is enabled while requests are present. + expect( + tester.widget(searchFieldTextField()).enabled, + isTrue, + ); + + // Pause the profiler so polling does not repopulate the requests after + // they are cleared below. + await tester.tap(find.byType(StartStopRecordingButton)); + await tester.pumpAndSettle(); + + // Clear the results. + await tester.tap(find.byType(ClearButton)); + await tester.pumpAndSettle(const Duration(seconds: 2)); + expect(controller.requests.value, isEmpty); + + // The search field must stay enabled even with no requests present, so + // the query can still be edited before the next batch of requests + // arrives. + expect( + tester.widget(searchFieldTextField()).enabled, + isTrue, + ); + }, + ); }); group('NetworkRequestOverviewView', () {