Skip to content

Validate itemExtent with geometry in RenderSliverFixedExtentBoxAdaptor#185159

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
Piinks:fix-2121
Apr 17, 2026
Merged

Validate itemExtent with geometry in RenderSliverFixedExtentBoxAdaptor#185159
auto-submit[bot] merged 3 commits into
flutter:masterfrom
Piinks:fix-2121

Conversation

@Piinks

@Piinks Piinks commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

This PR implements a validation assertion for RenderSliverFixedExtentBoxAdaptor (the modern successor to the RenderBlockViewport mentioned in the original issue) to ensure that the total scroll extent is consistent with the fixed item extent.

When a sliver has a fixed itemExtent, the total scrollExtent should always be an even multiple of that extent. If a custom implementation of computeMaxScrollOffset (or manual geometry manipulation in a subclass) returns a value that isn't a multiple, it can lead to unexpected layout behavior or rounding issues in scroll offsets.

This change adds a debugAssertDoesMeetConstraints override to RenderSliverFixedExtentBoxAdaptor that verifies:

  1. itemExtentBuilder is null (meaning a single fixed itemExtent is being used).
  2. The resulting geometry.scrollExtent is a multiple of the itemExtent, within
    precisionErrorTolerance.

Fixes #2121

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

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 Apr 16, 2026
@Piinks Piinks changed the title Fix 2121 Validate itemExtent with geometry in RenderSliverFixedExtentBoxAdaptor Apr 16, 2026
@Piinks Piinks added the CICD Run CI/CD label Apr 16, 2026

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

Copy link
Copy Markdown
Contributor

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 adds a debug assertion to RenderSliverFixedExtentBoxAdaptor to verify that the scrollExtent is a multiple of the itemExtent, including tests for the assertion and precision tolerance. Review feedback recommends clarifying the error message by replacing the term "even multiple" with "multiple" and updating the associated test expectations.

Comment thread packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart
AbdeMohlbi
AbdeMohlbi previously approved these changes Apr 16, 2026

@AbdeMohlbi AbdeMohlbi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SGTM

@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 16, 2026
@Piinks Piinks added the CICD Run CI/CD label Apr 16, 2026
@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Apr 16, 2026
Merged via the queue into flutter:master with commit 5c5000e Apr 17, 2026
86 of 87 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 17, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 17, 2026
flutter/flutter@31f1802...8e8a194

2026-04-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix ImageInfo.isCloneOf to correctly compare scale values (fixes #184626) (#184643)" (flutter/flutter#185203)
2026-04-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (#185192)" (flutter/flutter#185199)
2026-04-17 [email protected] [iOS] Migrate FlutterLaunchEngine to Swift (flutter/flutter#185151)
2026-04-17 [email protected] Remove unused `FlutterRunArguments.java` file  (flutter/flutter#184160)
2026-04-17 [email protected] Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (flutter/flutter#185192)
2026-04-17 [email protected] [Impeller] Fix morphology filter asymmetric dilation/erosion (flutter/flutter#184913)
2026-04-17 [email protected] `AnimationStyle` methods (flutter/flutter#182333)
2026-04-17 [email protected] Fix _scheduleSystemFontsUpdate assertion during non-idle scheduler phase (flutter/flutter#184332)
2026-04-17 [email protected] Revert "Unpin sdk package dependencies" (flutter/flutter#185186)
2026-04-16 [email protected] Clarify why the `child` is nullable in `AnimatedTransitionBuilder` (flutter/flutter#182995)
2026-04-16 [email protected] Roll Fuchsia Linux SDK from IdBT8fSMYrYSip65j... to di3JdYrdE9OFu8Iyl... (flutter/flutter#185173)
2026-04-16 [email protected] Add dart_skills_lint to dev/tool with test and update readme instructions for new skills authors (flutter/flutter#185033)
2026-04-16 [email protected] [Impeller] Provide std::optional getter for stroke property (flutter/flutter#185112)
2026-04-16 [email protected] Validate itemExtent with geometry in RenderSliverFixedExtentBoxAdaptor (flutter/flutter#185159)
2026-04-16 [email protected] [iOS] Clarify provisioning profile error instructions (flutter/flutter#184051)
2026-04-16 [email protected] [Widget Preview] Fix flaky integration test timeout during flutter clean (flutter/flutter#184991)
2026-04-16 [email protected] Roll Dart SDK from fbddcbe0cd96 to 7c2564c18770 (2 revisions) (flutter/flutter#185143)
2026-04-16 [email protected] Unpin sdk package dependencies (flutter/flutter#184821)
2026-04-16 [email protected] Fix ImageInfo.isCloneOf to correctly compare scale values (fixes #184626) (flutter/flutter#184643)
2026-04-16 [email protected] Roll Skia from 391cdbe3ffe9 to d8415c5d7b91 (2 revisions) (flutter/flutter#185141)
2026-04-16 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#185166)
2026-04-16 [email protected] Revert "Move widget_preview_scaffold into pub workspace" (flutter/flutter#185164)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11523)

flutter/flutter@31f1802...8e8a194

2026-04-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix ImageInfo.isCloneOf to correctly compare scale values (fixes #184626) (#184643)" (flutter/flutter#185203)
2026-04-17 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (#185192)" (flutter/flutter#185199)
2026-04-17 [email protected] [iOS] Migrate FlutterLaunchEngine to Swift (flutter/flutter#185151)
2026-04-17 [email protected] Remove unused `FlutterRunArguments.java` file  (flutter/flutter#184160)
2026-04-17 [email protected] Roll Fuchsia Test Scripts from R2EllDf4DgBXVNuiN... to dQ4PjIJB5kZFU8Y32... (flutter/flutter#185192)
2026-04-17 [email protected] [Impeller] Fix morphology filter asymmetric dilation/erosion (flutter/flutter#184913)
2026-04-17 [email protected] `AnimationStyle` methods (flutter/flutter#182333)
2026-04-17 [email protected] Fix _scheduleSystemFontsUpdate assertion during non-idle scheduler phase (flutter/flutter#184332)
2026-04-17 [email protected] Revert "Unpin sdk package dependencies" (flutter/flutter#185186)
2026-04-16 [email protected] Clarify why the `child` is nullable in `AnimatedTransitionBuilder` (flutter/flutter#182995)
2026-04-16 [email protected] Roll Fuchsia Linux SDK from IdBT8fSMYrYSip65j... to di3JdYrdE9OFu8Iyl... (flutter/flutter#185173)
2026-04-16 [email protected] Add dart_skills_lint to dev/tool with test and update readme instructions for new skills authors (flutter/flutter#185033)
2026-04-16 [email protected] [Impeller] Provide std::optional getter for stroke property (flutter/flutter#185112)
2026-04-16 [email protected] Validate itemExtent with geometry in RenderSliverFixedExtentBoxAdaptor (flutter/flutter#185159)
2026-04-16 [email protected] [iOS] Clarify provisioning profile error instructions (flutter/flutter#184051)
2026-04-16 [email protected] [Widget Preview] Fix flaky integration test timeout during flutter clean (flutter/flutter#184991)
2026-04-16 [email protected] Roll Dart SDK from fbddcbe0cd96 to 7c2564c18770 (2 revisions) (flutter/flutter#185143)
2026-04-16 [email protected] Unpin sdk package dependencies (flutter/flutter#184821)
2026-04-16 [email protected] Fix ImageInfo.isCloneOf to correctly compare scale values (fixes #184626) (flutter/flutter#184643)
2026-04-16 [email protected] Roll Skia from 391cdbe3ffe9 to d8415c5d7b91 (2 revisions) (flutter/flutter#185141)
2026-04-16 [email protected] Sync CHANGELOG.md from stable (flutter/flutter#185166)
2026-04-16 [email protected] Revert "Move widget_preview_scaffold into pub workspace" (flutter/flutter#185164)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD 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.

RenderBlockViewport should override debugAssertDoesMeetConstraints to verify intrinsics match itemExtent

2 participants