Remove unnecessary Material import from restoration_scopes_moving_test#184591
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the import statement in the test file and replaces an OutlinedButton with a GestureDetector in the CounterState widget. The review suggests adding HitTestBehavior.opaque to the GestureDetector to ensure reliable hit testing during tap interactions in tests.
| return GestureDetector( | ||
| onTap: () { |
There was a problem hiding this comment.
When replacing a button with a GestureDetector in tests, it is recommended to set behavior: HitTestBehavior.opaque. This ensures that the entire area of the widget is hit-testable, even if the child (like a Text widget) has transparent areas between its glyphs, which helps prevent flaky test failures during tap interactions.
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {There was a problem hiding this comment.
If the tests pass I'm not concerned with this.
victorsanni
left a comment
There was a problem hiding this comment.
Should this be removed from dev/bots/check_tests_cross_imports.dart?
|
Good catch, thanks! Removed it from |
Replace OutlinedButton with GestureDetector to remove the Material dependency. The test only needs a tappable widget with text. Part of flutter#177415.
06c121e to
c6a9de2
Compare
|
Resolved the merge conflict in |
| 'packages/flutter/test/widgets/list_view_viewporting_test.dart', | ||
| 'packages/flutter/test/widgets/semantics_clipping_test.dart', |
The Material import was removed, so the file no longer needs to be in the knownWidgetsCrossImports allowlist.
c6a9de2 to
a7c9e69
Compare
|
Sorry about that — |
| return GestureDetector( | ||
| onTap: () { |
There was a problem hiding this comment.
If the tests pass I'm not concerned with this.
Replace
OutlinedButtonwithGestureDetectorto remove thepackage:flutter/material.dartimport fromrestoration_scopes_moving_test.dart. The test only needs a tappable widget with text, soGestureDetectoris sufficient.Part of #177415.
Pre-launch Checklist
///).