Skip to content

[two_dimensional_scrollables] TableView trailing pinned spans are laid out twice #185842

Closed
flutter/packages
#12666

Description

@Piinks

Description

In TableView, when trailingPinnedColumnCount or trailingPinnedRowCount is 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

  1. Create a TableView with a large number of rows/columns.
  2. Set trailingPinnedColumnCount: 1.
  3. Observe (e.g., via logs in cellBuilder) that cells in the last column are built twice.

Expected Results

Each TableVicinity should 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 _lastNonPinnedColumn and _lastNonPinnedRow indices are defaulted to the end of the metrics maps (metrics.length - 1) instead of being capped by _lastRegularColumnIndex and _lastRegularRowIndex.

Proposed Fix

Update the capping logic to use the pre-calculated regular span indices (_lastRegularColumnIndex / _lastRegularRowIndex).

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    packageflutter/packages repository. See also p: labels.
    p: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables package
    on Apr 30, 2026
  2. self-assigned this
    on Apr 30, 2026
  3. added
    P2Important issues not at the top of the work list
    on Apr 30, 2026
  4. removed their assignment
    on Aug 25, 2026
  5. added
    has partial patchThere is a PR awaiting someone to take it across the finish line
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 25, 2026
  6. github-actions commented on Oct 9, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listhas partial patchThere is a PR awaiting someone to take it across the finish linep: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables packagepackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions