Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: flutter/packages
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 93cbed6
Choose a base ref
...
head repository: flutter/packages
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2ec2236
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on May 12, 2026

  1. [two_dimensional_scrollables] Fixes TreeView crash when empty or last…

    … node collapsed (#11622)
    
    This PR provides a robust fix for a crash in TreeView and resolves a regression introduced by a previous partial fix in PR #9103.
    
    Previous attempts to fix the "empty tree" crash (shrinking to 0 rows) by moving _updateScrollBounds to the end of layout introduced a subtle inconsistency. When a node collapse triggered a scroll correction, the visible row range was recalculated after the layout loop had finished. This resulted in the paint phase attempting to access children that were never built, causing a null dereference (as seen in the Expand then collapse with offscreen nodes (top) test).
    
    * _updateVerticalScrollBounds is now called before the child layout loop. This ensures that any vertical scroll corrections (e.g., clamping when content shrinks) happen first, so the layout loop builds exactly the rows that will be visible.
    * Accurate Extent Calculation: Updated _updateScrollBounds to calculate the vertical scroll extent using the total height of all rows in _rowMetrics (via _rowMetrics.last.trailingOffset). This provides a consistent maxScrollExtent and correctly handles the "empty tree" state.
    * Correct Horizontal Bounds: Updated the horizontal extent calculation to use absolute content-relative positions, ensuring correct scroll bounds when scrolling horizontally.
    
    Fixes flutter/flutter#164981
    
    ## Pre-Review Checklist
    
    **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). 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.
    
    [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
    Piinks authored May 12, 2026
    Configuration menu
    Copy the full SHA
    2ec2236 View commit details
    Browse the repository at this point in the history
Loading