-
Notifications
You must be signed in to change notification settings - Fork 30.3k
[two_dimensional_scrollables] TableView trailing pinned spans are laid out twice #185842
Copy link
Copy link
Open
flutter/packages
#11624Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables packageIssues pertaining to the two_dimensional_scrollables packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables packageIssues pertaining to the two_dimensional_scrollables packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
In
TableView, whentrailingPinnedColumnCountortrailingPinnedRowCountis greater than 0, the spans designated as trailing pinned are being incorrectly included in the range of "regular" (non-pinned) spans. This results in these cells being built and laid out twice during every layout pass.Steps to Reproduce
TableViewwith a large number of rows/columns.trailingPinnedColumnCount: 1.cellBuilder) that cells in the last column are built twice.Expected Results
Each
TableVicinityshould be built and laid out exactly once per layout pass. Trailing pinned spans should be excluded from the "non-pinned" range.Actual Results
Trailing pinned spans are included in the non-pinned range because the range is capped by the total metrics length rather than the index of the first trailing pinned span.
Root Cause
In
RenderTableViewport._updateFirstAndLastVisibleCell(lib/src/table_view/table.dart), the_lastNonPinnedColumnand_lastNonPinnedRowindices are defaulted to the end of the metrics maps (metrics.length - 1) instead of being capped by_lastRegularColumnIndexand_lastRegularRowIndex.Proposed Fix
Update the capping logic to use the pre-calculated regular span indices (
_lastRegularColumnIndex/_lastRegularRowIndex).