Skip to content

Conversation

@navaronbracke
Copy link
Contributor

@navaronbracke navaronbracke commented Jan 14, 2026

This PR removes Divider usages from test/widgets/scroll_view_test.dart and test/widgets/list_view_test.dart.
Usages of Divider() still exist under examples/api and in code samples under lib/widgets, though.

Part of #177415
Part of #180501

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Jan 14, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively removes usages of Divider from several widget tests to reduce dependencies on the material package. The changes correctly replace Divider with SizedBox or custom widget implementations as appropriate. A new file, widget_test_utils.dart, is introduced to provide basic widgets for tests, which is a good step towards better test modularity. The changes are well-executed and align with the PR's goal. I have one suggestion for the new test utility file to improve clarity and maintainability.

Comment on lines 9 to 14
/// Get a random color for use in a widget test.
///
/// The returned color will be fully opaque,
/// but the [Color.r], [Color.g], and [Color.b] channels
/// will each be randomized between `00` and `FF`.
Color getRandomTestColor(int index) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The function name getRandomTestColor and its documentation are misleading. The function returns a deterministic color from a predefined list based on the index, not a random color. The documentation also incorrectly states that RGB channels are randomized.

To improve clarity and accuracy, I suggest renaming the function to getTestColor and updating the documentation to reflect its actual behavior. This aligns with the style guide's emphasis on readability and useful documentation.

/// Get a deterministic color for use in a widget test.
///
/// The returned color will be fully opaque and is selected from a predefined
/// list of colors based on the given [index].
Color getTestColor(int index) {
References
  1. The style guide emphasizes optimizing for readability. The function name getRandomTestColor is misleading as it's not random, which harms readability. (link)
  2. The style guide requires documentation to be useful. The current documentation is inaccurate and therefore not useful. (link)

@navaronbracke navaronbracke force-pushed the remove_divider_from_widgets_tests branch from b8ee04d to 7ab2ade Compare January 15, 2026 08:34
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍


// Regression test for https://github.com/flutter/flutter/issues/100451
testWidgets('ListView.separator respects findChildIndexCallback', (WidgetTester tester) async {
testWidgets('ListView.separated respects findChildIndexCallback', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@navaronbracke
Copy link
Contributor Author

Since this has 2 approvals now, can this get an autosubmit as well?

@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 17, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Jan 17, 2026
Merged via the queue into flutter:master with commit e561a9f Jan 17, 2026
148 of 149 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jan 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants