[two_dimensional_scrollables] TableView trailing pinned spans are laid out twice

Open Beginner friendly
#185,842 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
dart, flutter
Domain
frontend

Research direction

Start in lib/src/table_view/table.dart at RenderTableViewport._updateFirstAndLastVisibleCell, where the non-pinned row and column bounds are calculated. Reproduce with a TableView using trailingPinnedColumnCount or trailingPinnedRowCount, then verify that trailing pinned spans are excluded from the regular range and each TableVicinity is built and laid out once per pass.

Written by the indexing model from the issue text.

Description

has partial patch p: two_dimensional_scrollables P2 package team-ecosystem triaged-ecosystem
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).

Dominant language
Dart
Stars
179k
Forks
31.7k
Avg merge
1d 21h
Merged PRs (30d)
413

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flutter/flutter

All issues in flutter/flutter

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.